Index: perl/modules/Facebook/lib/BarnOwl/Message/Facebook.pm
===================================================================
--- perl/modules/Facebook/lib/BarnOwl/Message/Facebook.pm	(revision 3d10ed33da36a786045fc0b54cf8cf46532b7f37)
+++ perl/modules/Facebook/lib/BarnOwl/Message/Facebook.pm	(revision 99f0a777795b06164735209436ecf386eca5b6de)
@@ -14,5 +14,5 @@
 
 sub context { return shift->{"name"}; }
-sub subcontext { return shift->{"postid"}; }
+sub subcontext { return shift->{"topic"}; }
 sub service { return "http://www.facebook.com"; }
 sub long_sender { return shift->{"zsig"}; } # XXX hack, shouldn't be named zsig
Index: perl/modules/Facebook/lib/BarnOwl/Module/Facebook.pm
===================================================================
--- perl/modules/Facebook/lib/BarnOwl/Module/Facebook.pm	(revision 3199d8e6bd5b06700d11c8eff2bef830451f73c4)
+++ perl/modules/Facebook/lib/BarnOwl/Module/Facebook.pm	(revision 99f0a777795b06164735209436ecf386eca5b6de)
@@ -130,9 +130,11 @@
 sub cmd_facebook_comment {
     my $cmd  = shift;
-    my $postid   = shift;
+    my $postid = shift;
+
+    my $topic = $facebook_handle->get_topic($postid);
 
     # XXX UI should give some (better) indication /which/ conversation
     # is being commented on
-    BarnOwl::start_edit_win("Write a comment... ($postid)",
+    BarnOwl::start_edit_win("Write a comment on '$topic'...",
                             sub { $facebook_handle->facebook_comment($postid, shift) });
 }
Index: perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm
===================================================================
--- perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm	(revision 3199d8e6bd5b06700d11c8eff2bef830451f73c4)
+++ perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm	(revision 99f0a777795b06164735209436ecf386eca5b6de)
@@ -15,5 +15,7 @@
 
 use Facebook::Graph;
-use Data::Dumper;
+
+use Lingua::EN::Keywords;
+
 use JSON;
 use Date::Parse;
@@ -80,5 +82,8 @@
         'login_url' => 'http://goo.gl/yA42G',
 
-        'logged_in' => 0
+        'logged_in' => 0,
+
+        # would need another hash for topic de-dup
+        'topics' => {},
     };
 
@@ -144,4 +149,7 @@
     # Ideally, we should have some worker thread for polling facebook.
     # But BarnOwl is probably not thread-safe >_<
+
+    my $old_topics = $self->{topics};
+    $self->{topics} = {};
 
     my $updates = eval {
@@ -158,6 +166,4 @@
     $self->die_on_error($@);
 
-    #warn Dumper($updates);
-
     my $new_last_poll = $self->{last_poll};
     for my $post ( reverse @{$updates->{data}} ) {
@@ -173,8 +179,12 @@
         my $name    = $post->{to}{data}[0]{name} || $post->{from}{name};
         my $name_id = $post->{to}{data}[0]{id} || $post->{from}{id};
+        my $postid  = $post->{id};
 
         # Only handle post if it's new
         my $created_time = str2time($post->{created_time});
         if ($created_time >= $self->{last_poll}) {
+            my @keywords = keywords($post->{name} || $post->{message});
+            my $topic = $keywords[0] || 'personal';
+            $self->{topics}->{$postid} = $topic;
             # XXX indexing is fragile
             my $msg = BarnOwl::Message->new(
@@ -186,5 +196,6 @@
                 direction => 'in',
                 body      => $self->format_body($post),
-                postid    => $post->{id},
+                postid    => $postid,
+                topic     => $topic,
                 time      => asctime(localtime $created_time),
                 # XXX The intent is to get the 'Comment' link, which also
@@ -194,4 +205,6 @@
                );
             BarnOwl::queue_message($msg);
+        } else {
+            $self->{topics}->{$postid} = $old_topics->{$postid} || 'personal';
         }
 
@@ -214,5 +227,6 @@
                     direction => 'in',
                     body      => $comment->{message},
-                    postid    => $post->{id},
+                    postid    => $postid,
+                    topic     => $self->get_topic($postid),
                     time      => asctime(localtime $comment_time),
                    );
@@ -224,4 +238,5 @@
         }
     }
+    # old_topics gets GC'd
 
     $self->{last_poll} = $new_last_poll;
@@ -308,3 +323,11 @@
 }
 
+sub get_topic {
+    my $self = shift;
+
+    my $postid = shift;
+
+    return $self->{topics}->{$postid} || 'personal';
+}
+
 1;
