source: perl/modules/Twitter/lib/BarnOwl/Message/Twitter.pm @ 47a5e46

release-1.7release-1.8release-1.9
Last change on this file since 47a5e46 was 47a5e46, checked in by Nelson Elhage <nelhage@mit.edu>, 10 years ago
Merge Twitter under perl/modules
  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[8618438]1use warnings;
2use strict;
3
4=head1 NAME
5
6BarnOwl::Message::Twitter
7
8=head1 DESCRIPTION
9
10=cut
11
12package BarnOwl::Message::Twitter;
13use base qw(BarnOwl::Message);
14
15sub context {'twitter'}
16sub subcontext {undef}
[a0385ad3]17sub service { return (shift->{"service"} || "http://twitter.com"); }
[159aaad]18sub account { return shift->{"account"}; }
[a0385ad3]19sub long_sender {
20    my $self = shift;
21    $self->service =~ m#^\s*(.*?://.*?)/.*$#;
22    my $service = $1 || $self->service;
23    return $service . '/' . $self->sender
24}
[8618438]25
[927c186]26sub replycmd {
27    my $self = shift;
[b4b5a7e]28    if($self->is_private) {
[927c186]29        return $self->replysendercmd;
[acdd52e]30    } elsif(exists($self->{status_id})) {
[159aaad]31        return 'twitter-atreply ' . $self->sender . " " . $self->{status_id} . " " . $self->account;
[927c186]32    } else {
[159aaad]33        return 'twitter-atreply ' . $self->sender . " " . $self->account;
[927c186]34    }
35}
36
37sub replysendercmd {
38    my $self = shift;
[159aaad]39    return 'twitter-direct ' . $self->sender . " " . $self->account;
[927c186]40}
[8618438]41
42sub 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
59Foo, Bar, Baz
60
61=cut
62
631;
Note: See TracBrowser for help on using the repository browser.