Changeset 2c4c4c4


Ignore:
Timestamp:
Jun 22, 2011, 9:56:47 PM (13 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
Children:
2f6c263
Parents:
68fa539
git-author:
Edward Z. Yang <ezyang@mit.edu> (06/22/11 18:42:02)
git-committer:
Edward Z. Yang <ezyang@mit.edu> (06/22/11 21:56:47)
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

    r68fa539 r2c4c4c4  
    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.