release-1.10release-1.7release-1.8release-1.9
Last change
on this file since 8106870 was
8106870,
checked in by Anders Kaseorg <andersk@mit.edu>, 14 years ago
|
Twitter: BarnOwl::quote the replycmd
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | use warnings; |
---|
2 | use strict; |
---|
3 | |
---|
4 | =head1 NAME |
---|
5 | |
---|
6 | BarnOwl::Message::Twitter |
---|
7 | |
---|
8 | =head1 DESCRIPTION |
---|
9 | |
---|
10 | =cut |
---|
11 | |
---|
12 | package BarnOwl::Message::Twitter; |
---|
13 | use base qw(BarnOwl::Message); |
---|
14 | |
---|
15 | sub context {'twitter'} |
---|
16 | sub subcontext {undef} |
---|
17 | sub service { return (shift->{"service"} || "http://twitter.com"); } |
---|
18 | sub account { return shift->{"account"}; } |
---|
19 | sub retweeted_by { shift->{retweeted_by}; } |
---|
20 | sub long_sender { |
---|
21 | my $self = shift; |
---|
22 | $self->service =~ m#^\s*(.*?://.*?)/.*$#; |
---|
23 | my $service = $1 || $self->service; |
---|
24 | my $long = $service . '/' . $self->sender; |
---|
25 | if ($self->retweeted_by) { |
---|
26 | $long = "(retweeted by " . $self->retweeted_by . ") $long"; |
---|
27 | } |
---|
28 | return $long; |
---|
29 | } |
---|
30 | |
---|
31 | sub replycmd { |
---|
32 | my $self = shift; |
---|
33 | if($self->is_private) { |
---|
34 | return $self->replysendercmd; |
---|
35 | } elsif(exists($self->{status_id})) { |
---|
36 | return BarnOwl::quote('twitter-atreply', $self->sender, $self->{status_id}, $self->account); |
---|
37 | } else { |
---|
38 | return BarnOwl::quote('twitter-atreply', $self->sender, $self->account); |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | sub replysendercmd { |
---|
43 | my $self = shift; |
---|
44 | return BarnOwl::quote('twitter-direct', $self->sender, $self->account); |
---|
45 | } |
---|
46 | |
---|
47 | sub smartfilter { |
---|
48 | my $self = shift; |
---|
49 | my $inst = shift; |
---|
50 | my $filter; |
---|
51 | |
---|
52 | if($inst) { |
---|
53 | $filter = "twitter-" . $self->sender; |
---|
54 | BarnOwl::command("filter", $filter, |
---|
55 | qw{type ^twitter$ and sender}, '^'.$self->sender.'$'); |
---|
56 | } else { |
---|
57 | $filter = "twitter"; |
---|
58 | } |
---|
59 | return $filter; |
---|
60 | } |
---|
61 | |
---|
62 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.