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

release-1.10release-1.7release-1.8release-1.9
Last change on this file since f6413c3 was f6413c3, checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
Remove a stub 'SEE ALSO' section
  • Property mode set to 100644
File size: 1.3 KB
Line 
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}
17sub service { return (shift->{"service"} || "http://twitter.com"); }
18sub account { return shift->{"account"}; }
19sub long_sender {
20    my $self = shift;
21    $self->service =~ m#^\s*(.*?://.*?)/.*$#;
22    my $service = $1 || $self->service;
23    return $service . '/' . $self->sender
24}
25
26sub 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
37sub replysendercmd {
38    my $self = shift;
39    return 'twitter-direct ' . $self->sender . " " . $self->account;
40}
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
571;
Note: See TracBrowser for help on using the repository browser.