release-1.10release-1.7release-1.8release-1.9
Last change
on this file since fe184d4 was
159aaad,
checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
|
Multiple account support
Accounts are specified as a list of hashes in the ~/.owl/twitter file.
Adds 'poll_for_tweets', 'poll_for_dms', 'publish_tweets', 'default_sender',
and 'account_nickname' options to the twitter account hashes. They do about
what they say on the tin.
Add arguments to :twitter, :twitter-direct, and :twitter-atreply to specify
the service to use (by nickname), with sane defaults, plus documentation.
|
-
Property mode set to
100644
|
File size:
1.3 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 long_sender { |
---|
20 | my $self = shift; |
---|
21 | $self->service =~ m#^\s*(.*?://.*?)/.*$#; |
---|
22 | my $service = $1 || $self->service; |
---|
23 | return $service . '/' . $self->sender |
---|
24 | } |
---|
25 | |
---|
26 | sub replycmd { |
---|
27 | my $self = shift; |
---|
28 | if($self->is_private) { |
---|
29 | return $self->replysendercmd; |
---|
30 | } elsif(exists($self->{status_id})) { |
---|
31 | return 'twitter-atreply ' . $self->sender . " " . $self->{status_id} . " " . $self->account; |
---|
32 | } else { |
---|
33 | return 'twitter-atreply ' . $self->sender . " " . $self->account; |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | sub replysendercmd { |
---|
38 | my $self = shift; |
---|
39 | return 'twitter-direct ' . $self->sender . " " . $self->account; |
---|
40 | } |
---|
41 | |
---|
42 | sub smartfilter { |
---|
43 | my $self = shift; |
---|
44 | my $inst = shift; |
---|
45 | my $filter; |
---|
46 | |
---|
47 | if($inst) { |
---|
48 | $filter = "twitter-" . $self->sender; |
---|
49 | BarnOwl::command("filter", $filter, |
---|
50 | qw{type ^twitter$ and sender}, '^'.$self->sender.'$'); |
---|
51 | } else { |
---|
52 | $filter = "twitter"; |
---|
53 | } |
---|
54 | return $filter; |
---|
55 | } |
---|
56 | |
---|
57 | =head1 SEE ALSO |
---|
58 | |
---|
59 | Foo, Bar, Baz |
---|
60 | |
---|
61 | =cut |
---|
62 | |
---|
63 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.