source: perl/modules/Facebook/lib/BarnOwl/Message/Facebook.pm @ f4d1717

Last change on this file since f4d1717 was f4d1717, checked in by Edward Z. Yang <ezyang@mit.edu>, 10 years ago
Implement automatic instance selection, with no de-dup. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
  • Property mode set to 100644
File size: 1.3 KB
Line 
1use warnings;
2use strict;
3
4=head1 NAME
5
6BarnOwl::Message::Facebook
7
8=head1 DESCRIPTION
9
10=cut
11
12package BarnOwl::Message::Facebook;
13use base qw(BarnOwl::Message);
14
15sub context { return shift->{"name"}; }
16sub subcontext { return shift->{"topic"}; }
17sub service { return "http://www.facebook.com"; }
18sub long_sender { return shift->{"zsig"}; } # XXX hack, shouldn't be named zsig
19
20sub replycmd {
21    my $self = shift;
22    # TODO: Support for direct messages
23    # XXX: It seems that Facebook may not support this yet
24    return BarnOwl::quote('facebook-comment', $self->{postid});
25}
26
27#sub replysendercmd {
28#    my $self = shift;
29#}
30
31sub smartfilter {
32    my $self = shift;
33    my $inst = shift;
34    my $filter;
35    # XXX I hope $filter isn't used for anything besides display purposes
36    if($inst) {
37        $filter = "facebook: " . $self->{name} . " " . $self->{postid};
38        BarnOwl::command("filter", $filter,
39                         qw{type ^facebook$ and name_id}, '^'.$self->{name_id}.'$',
40                         qw{and postid}, '^'.$self->{postid}.'$');
41    } else {
42        $filter = "facebook: " . $self->{name};
43        BarnOwl::command("filter", $filter,
44                         qw{type ^facebook$ and name_id}, '^'.$self->{name_id}.'$');
45    }
46    return $filter;
47}
48
491;
Note: See TracBrowser for help on using the repository browser.