Changeset acdd52e for lib/BarnOwl/Module


Ignore:
Timestamp:
May 7, 2009, 5:12:56 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
b56f2c3
Parents:
b25b5a4
Message:
Correctly tag replies with the in_reply_to_status_id parameter.
File:
1 edited

Legend:

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

    rb25b5a4 racdd52e  
    183183                source    => decode_entities($tweet->{source}),
    184184                location  => decode_entities($tweet->{user}{location}||""),
    185                 body      => decode_entities($tweet->{text})
     185                body      => decode_entities($tweet->{text}),
     186                status_id => $tweet->{id}
    186187               );
    187188            BarnOwl::queue_message($msg);
     
    227228sub twitter {
    228229    my $msg = shift;
     230    my $reply_to = shift;
     231
    229232    if($msg =~ m{\Ad\s+([^\s])+(.*)}sm) {
    230233        twitter_direct($1, $2);
    231234    } elsif(defined $twitter) {
    232         $twitter->update($msg);
     235        $twitter->update({
     236            status => $msg,
     237            defined($reply_to) ? (in_reply_to_status_id => $reply_to) : ()
     238           });
    233239    }
    234240}
     
    258264sub twitter_atreply {
    259265    my $to  = shift;
     266    my $id  = shift;
    260267    my $msg = shift;
    261     twitter("@".$to." ".$msg);
     268    if(defined($id)) {
     269        twitter("@".$to." ".$msg, $id);
     270    } else {
     271        twitter("@".$to." ".$msg);
     272    }
    262273}
    263274
     
    303314sub cmd_twitter_atreply {
    304315    my $cmd  = shift;
    305     my $user = shift;
    306     BarnOwl::start_edit_win("Reply to \@" . $user, sub { twitter_atreply($user, shift) });
     316    my $user = shift || die("Usage: $cmd USER [In-Reply-To ID]\n");
     317    my $id   = shift;
     318    BarnOwl::start_edit_win("Reply to \@" . $user, sub { twitter_atreply($user, $id, shift) });
    307319}
    308320
Note: See TracChangeset for help on using the changeset viewer.