Ignore:
Timestamp:
Sep 20, 2011, 11:15:32 PM (13 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
Branches:
master, release-1.10, release-1.9
Children:
01d186f
Parents:
8b62088
git-author:
Edward Z. Yang <ezyang@mit.edu> (06/22/11 18:42:02)
git-committer:
Edward Z. Yang <ezyang@mit.edu> (09/20/11 23:15:32)
Message:
Make topic detection more robust.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm

    r8b62088 r65c2b3c  
    270270        my $post_id  = $post->{id};
    271271
    272         # Only handle post if it's new
    273         my $created_time = str2time($post->{created_time});
    274         if ($created_time >= $self->{last_poll}) {
     272        if (defined $old_topics->{$post_id}) {
     273            $self->{topics}->{$post_id} = $old_topics->{$post_id};
     274        } else {
    275275            my @keywords = keywords($post->{name} || $post->{message});
    276276            my $topic = $keywords[0] || 'personal';
    277277            $topic =~ s/ /-/g;
    278278            $self->{topics}->{$post_id} = $topic;
     279        }
     280
     281        # Only handle post if it's new
     282        my $created_time = str2time($post->{created_time});
     283        if ($created_time >= $self->{last_poll}) {
    279284            # XXX indexing is fragile
    280285            my $msg = BarnOwl::Message->new(
     
    286291                direction => 'in',
    287292                body      => $self->format_body($post),
    288                 post_id    => $post_id,
    289                 topic     => $topic,
     293                post_id   => $post_id,
     294                topic     => $self->get_topic($post_id),
    290295                time      => asctime(localtime $created_time),
    291296                # XXX The intent is to get the 'Comment' link, which also
     
    295300               );
    296301            BarnOwl::queue_message($msg);
    297         } else {
    298             $self->{topics}->{$post_id} = $old_topics->{$post_id} || 'personal';
    299302        }
    300303
Note: See TracChangeset for help on using the changeset viewer.