Ignore:
Timestamp:
May 29, 2010, 1:42:02 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
2f25537
Parents:
d27ecf3
git-author:
Nelson Elhage <nelhage@mit.edu> (05/26/10 22:46:35)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/29/10 13:42:02)
Message:
Twitter: Handle new-style retweets better
Location:
perl/modules/Twitter/lib/BarnOwl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Twitter/lib/BarnOwl/Message/Twitter.pm

    rf6413c3 r5d59c1e  
    1717sub service { return (shift->{"service"} || "http://twitter.com"); }
    1818sub account { return shift->{"account"}; }
     19sub retweeted_by { shift->{retweeted_by}; }
    1920sub long_sender {
    2021    my $self = shift;
    2122    $self->service =~ m#^\s*(.*?://.*?)/.*$#;
    2223    my $service = $1 || $self->service;
    23     return $service . '/' . $self->sender
     24    my $long = $service . '/' . $self->sender;
     25    if ($self->retweeted_by) {
     26        $long = "(retweeted by " . $self->retweeted_by . ") $long";
     27    }
     28    return $long;
    2429}
    2530
  • perl/modules/Twitter/lib/BarnOwl/Module/Twitter/Handle.pm

    ra2640485 r5d59c1e  
    248248                next;
    249249            }
     250            my $orig = $tweet->{retweeted_status};
     251            $orig = $tweet unless defined($orig);
     252
    250253            my $msg = BarnOwl::Message->new(
    251254                type      => 'Twitter',
    252                 sender    => $tweet->{user}{screen_name},
     255                sender    => $orig->{user}{screen_name},
    253256                recipient => $self->{cfg}->{user} || $self->{user},
    254257                direction => 'in',
    255                 source    => decode_entities($tweet->{source}),
    256                 location  => decode_entities($tweet->{user}{location}||""),
    257                 body      => decode_entities($tweet->{text}),
     258                source    => decode_entities($orig->{source}),
     259                location  => decode_entities($orig->{user}{location}||""),
     260                body      => decode_entities($orig->{text}),
    258261                status_id => $tweet->{id},
    259262                service   => $self->{cfg}->{service},
    260263                account   => $self->{cfg}->{account_nickname},
     264                $tweet->{retweeted_status} ? (retweeted_by => $tweet->{user}{screen_name}) : ()
    261265               );
    262266            BarnOwl::queue_message($msg);
Note: See TracChangeset for help on using the changeset viewer.