Changeset d658c29 for lib/BarnOwl


Ignore:
Timestamp:
May 8, 2009, 12:09:02 PM (16 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
a0385ad3
Parents:
188b745
Message:
Handle old Net::Twitter, instead of just bailing.
File:
1 edited

Legend:

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

    r188b745 rd658c29  
    2727my $instance = "status";
    2828my $opcode   = "twitter";
     29my $use_reply_to = 0;
    2930
    3031sub fail {
     
    3536}
    3637
    37 if($Net::Twitter::VERSION < 2.06) {
    38     fail("This version of BarnOwl Twitter requires Net::Twitter at least 2.06\n" .
    39          "Only $Net::Twitter::VERSION is currently installed.\n");
     38if($Net::Twitter::VERSION >= 2.06) {
     39    $use_reply_to = 1;
    4040}
    4141
     
    238238        twitter_direct($1, $2);
    239239    } elsif(defined $twitter) {
    240         $twitter->update({
    241             status => $msg,
    242             defined($reply_to) ? (in_reply_to_status_id => $reply_to) : ()
    243            });
     240        if($use_reply_to && defined($reply_to)) {
     241            $twitter->update({
     242                status => $msg,
     243                in_reply_to_status_id => $reply_to
     244               });
     245        } else {
     246            $twitter->update($msg);
     247        }
    244248    }
    245249}
Note: See TracChangeset for help on using the changeset viewer.