Changeset b56f2c3


Ignore:
Timestamp:
May 7, 2009, 5:18:27 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
188b745
Parents:
acdd52e
Message:
Get the last message before setting the timeout.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/BarnOwl/Module/Twitter.pm

    racdd52e rb56f2c3  
    9797}
    9898
     99our $last_poll        = 0;
     100our $last_direct_poll = 0;
     101our $last_id          = undef;
     102our $last_direct      = undef;
     103
     104unless(defined($last_id)) {
     105    eval {
     106        $last_id = $twitter->friends_timeline({count => 1})->[0]{id};
     107    };
     108    $last_id = 0 unless defined($last_id);
     109}
     110
     111unless(defined($last_direct)) {
     112    eval {
     113        $last_direct = $twitter->direct_messages()->[0]{id};
     114    };
     115    $last_direct = 0 unless defined($last_direct);
     116}
     117
    99118eval {
    100119    $twitter->{ua}->timeout(1);
     
    117136        twitter($m->body);
    118137    }
    119 }
    120 
    121 our $last_poll        = 0;
    122 our $last_direct_poll = 0;
    123 our $last_id          = undef;
    124 our $last_direct      = undef;
    125 
    126 unless(defined($last_id)) {
    127     eval {
    128         $last_id = $twitter->friends_timeline({count => 1})->[0]{id};
    129     };
    130     $last_id = 0 unless defined($last_id);
    131 }
    132 
    133 unless(defined($last_direct)) {
    134     eval {
    135         $last_direct = $twitter->direct_messages()->[0]{id};
    136     };
    137     $last_direct = 0 unless defined($last_direct);
    138138}
    139139
Note: See TracChangeset for help on using the changeset viewer.