Index: perl/modules/Facebook/lib/BarnOwl/Module/Facebook.pm
===================================================================
--- perl/modules/Facebook/lib/BarnOwl/Module/Facebook.pm	(revision 395d304e3471d746840209fe28540259b33828a5)
+++ perl/modules/Facebook/lib/BarnOwl/Module/Facebook.pm	(revision 7efa1638563560cf032c6d7a8bc35a52a0ead353)
@@ -61,6 +61,6 @@
 #BarnOwl::new_command('facebook-message' => \&cmd_facebook_direct, {
 #    summary     => 'Send a Facebook message',
-#    usage       => 'twitter-direct USER',
-#    description => 'Send a private Facebook Message to USER.'
+#    usage       => 'facebook-message USER',
+#    description => 'Send a private Facebook message to USER.'
 #});
 
@@ -93,5 +93,5 @@
     BarnOwl::start_edit_win(
         defined $user ? "Write something to $user..." : "What's on your mind?",
-        sub{ $facebook_handle->facebook($user, shift) }
+        sub { $facebook_handle->facebook($user, shift) }
     );
 }
@@ -132,5 +132,5 @@
 sub check_ready {
     if (!$facebook_handle->{logged_in}) {
-        BarnOwl::message("Need to login to Facebook first with ':facebook-auth'.");
+        BarnOwl::message("You need to login to Facebook first with ':facebook-auth'.");
         return 0;
     }
@@ -139,4 +139,5 @@
 
 BarnOwl::filter(qw{facebook type ^facebook$});
+BarnOwl::bindkey(qw(recv f command facebook));
 
 sub complete_user { return keys %{$facebook_handle->{friends}}; }
Index: perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm
===================================================================
--- perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm	(revision 8aa81172735f33b29d16507e84ea64b79e93030c)
+++ perl/modules/Facebook/lib/BarnOwl/Module/Facebook/Handle.pm	(revision 7efa1638563560cf032c6d7a8bc35a52a0ead353)
@@ -26,5 +26,5 @@
         my @words = split(' ', lc($sentence));
         return () unless @words;
-        return (reduce{ length($a) > length($b) ? $a : $b } @words,);
+        return (reduce { length($a) > length($b) ? $a : $b } @words);
     };
 } else {
@@ -71,5 +71,5 @@
 
     my $self = {
-        'cfg'  => $cfg,
+        'cfg' => $cfg,
         'facebook' => undef,
 
@@ -238,8 +238,4 @@
     return unless $self->{logged_in};
 
-    # XXX Oh no! This blocks the user interface.  Not good.
-    # Ideally, we should have some worker thread for polling facebook.
-    # But BarnOwl is probably not thread-safe >_<
-
     my $old_topics = $self->{topics};
     $self->{topics} = {};
@@ -289,4 +285,8 @@
             }
 
+            # XXX The intent is to get the 'Comment' link, which also
+            # serves as a canonical link to the post.  The {name}
+            # field should equal 'Comment'.  But we don't check
+            # this, we assume that the first element is the right one.
             my $link = $post->{actions}[0]{link};
 
@@ -294,5 +294,4 @@
             my $created_time = str2time($post->{created_time});
             if ($created_time >= $self->{last_poll}) {
-                # XXX indexing is fragile
                 my $msg = BarnOwl::Message->new(
                     type      => 'Facebook',
@@ -302,11 +301,8 @@
                     name_id   => $name_id,
                     direction => 'in',
-                    body      => $self->format_body($post),
+                    body      => wordwrap($self->format_body($post)),
                     post_id   => $post_id,
                     topic     => $topic,
                     time      => asctime(localtime $created_time),
-                    # XXX The intent is to get the 'Comment' link, which also
-                    # serves as a canonical link to the post.  The {name}
-                    # field should equal 'Comment'.
                     permalink => $link,
                    );
@@ -331,5 +327,5 @@
                         name_id   => $name_id,
                         direction => 'in',
-                        body      => $comment->{message},
+                        body      => wordwrap($comment->{message}),
                         post_id   => $post_id,
                         topic     => $topic,
@@ -348,4 +344,9 @@
         $self->{last_poll} = $new_last_poll;
     });
+}
+
+sub wordwrap {
+    my $text = shift;
+    return BarnOwl::wordwrap($text, BarnOwl::getvar('edit:maxwrapcols'));
 }
 
@@ -431,5 +432,12 @@
     $self->facebook_do_auth(sub {
         my $raw_cfg = to_json($self->{cfg});
-        BarnOwl::admin_message('Facebook', "Add this as the contents of your ~/.owl/facebook file:\n$raw_cfg");
+        my $cfg_file;
+        unless (open($cfg_file, ">", BarnOwl::get_config_dir() . "/facebook")) {
+          BarnOwl::admin_message('Facebook', "Add this as the contents of your ~/.owl/facebook file:\n$raw_cfg");
+          return;
+        }
+        print $cfg_file $raw_cfg;
+        close $cfg_file;
+        BarnOwl::admin_message('Facebook', "Saved your login credentials to ~/.owl/facebook.");
     });
     return;
