Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm
r4839f5a re458b63 111 111 bless($self, $class); 112 112 113 $self->{facebook} = Facebook::Graph->new( app_id => $app_id);114 if ( defined $self->{cfg}->{token}) {113 $self->{facebook} = Facebook::Graph->new(app_id => $app_id); 114 if (defined $self->{cfg}->{token}) { 115 115 $self->facebook_do_auth; 116 116 } … … 190 190 $self->{friends} = {}; 191 191 192 for my $friend ( @{$friends->{data}}) {192 for my $friend (@{$friends->{data}}) { 193 193 if (defined $self->{friends}{$friend->{name}}) { 194 194 # XXX We should try a little harder here, rather than just … … 250 250 # Not using this, because we want to pick up comment 251 251 # updates. We need to manually de-duplicate, though. 252 # ->where_since( "@" . $self->{last_poll})252 # ->where_since("@" . $self->{last_poll}) 253 253 # Facebook doesn't actually give us that many results. 254 254 # But it can't hurt to ask! 255 ->limit_results( 200)255 ->limit_results(200) 256 256 ->request 257 257 ->as_hashref … … 260 260 261 261 my $new_last_poll = $self->{last_poll}; 262 for my $post ( reverse @{$updates->{data}}) {262 for my $post (reverse @{$updates->{data}}) { 263 263 # No app invites, thanks! (XXX make configurable) 264 264 if ($post->{type} eq 'link' && $post->{application}) { … … 317 317 my $updated_time = str2time($post->{updated_time}); 318 318 if ($updated_time >= $self->{last_poll} && defined $post->{comments}{data}) { 319 for my $comment ( @{$post->{comments}{data}}) {319 for my $comment (@{$post->{comments}{data}}) { 320 320 my $comment_time = str2time($comment->{created_time}); 321 321 if ($comment_time < $self->{last_poll}) { … … 377 377 if (defined $user) { 378 378 $user = $self->{friends}{$user} || $user; 379 eval { $self->{facebook}->add_post( $user )->set_message( $msg)->publish; };379 eval { $self->{facebook}->add_post($user)->set_message($msg)->publish; }; 380 380 return unless $self->check_result; 381 381 } else { 382 eval { $self->{facebook}->add_post->set_message( $msg)->publish; };382 eval { $self->{facebook}->add_post->set_message($msg)->publish; }; 383 383 return unless $self->check_result; 384 384 } … … 392 392 my $msg = shift; 393 393 394 eval { $self->{facebook}->add_comment( $post_id )->set_message( $msg)->publish; };394 eval { $self->{facebook}->add_comment($post_id)->set_message($msg)->publish; }; 395 395 return unless $self->check_result; 396 396 $self->sleep(0); … … 424 424 sub facebook_do_auth { 425 425 my $self = shift; 426 if ( ! defined $self->{cfg}->{token}) {426 if (!defined $self->{cfg}->{token}) { 427 427 BarnOwl::admin_message('Facebook', "Login to Facebook at ".$self->{login_url} 428 428 . "\nand run command ':facebook-auth URL' with the URL you are redirected to."
Note: See TracChangeset
for help on using the changeset viewer.