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

Last change on this file since 51ff997 was 51ff997, checked in by Edward Z. Yang <ezyang@mit.edu>, 10 years ago
Initial commit of Facebook module implementation. This module was inspired by Kevin Riggle's Facebook-hacked-onto-Twitter implementation, but was rewritten to stand alone as its own module and use the new Facebook Graph API. It requires the Facebook::Graph CPAN module. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
  • Property mode set to 100644
File size: 1.0 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->{"postid"}; }
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    if($inst) {
36        # XXX I hope $filter isn't used for anything besides display purposes
37        $filter = "facebook: " . $self->{name};
38        BarnOwl::command("filter", $filter,
39                         qw{type ^facebook$ and name_id}, '^'.$self->{name_id}.'$');
40    } else {
41        $filter = "facebook";
42    }
43    return $filter;
44}
45
461;
Note: See TracBrowser for help on using the repository browser.