Index: perl/modules/jabber.pl
===================================================================
--- perl/modules/jabber.pl	(revision 55512087caa6f3c2bde575850f3d5fbd82e068bb)
+++ perl/modules/jabber.pl	(revision 60986b24c6aa6ef251787213015226735b60da6f)
@@ -1,4 +1,4 @@
 # -*- mode: cperl; cperl-indent-level: 4; indent-tabs-mode: nil -*-
-package owl_jabber;
+package BarnOwl::Jabber;
 use warnings;
 use strict;
@@ -22,5 +22,4 @@
 # Implementing formatting and logging callbacks for C
 # Appropriate callbacks for presence subscription messages.
-#  * Current behavior is auto-accept (default for Net::Jabber)
 #
 ################################################################################
@@ -29,5 +28,5 @@
 ################################################################################
 ################################################################################
-package owl_jabber::ConnectionManager;
+package BarnOwl::Jabber::ConnectionManager;
 sub new {
     my $class = shift;
@@ -123,5 +122,5 @@
 package owl_jabber;
 
-our $conn = new owl_jabber::ConnectionManager unless $conn;;
+our $conn = new BarnOwl::Jabber::ConnectionManager unless $conn;;
 our %vars;
 
@@ -129,6 +128,6 @@
     if ( *BarnOwl::queue_message{CODE} ) {
         register_owl_commands();
-        push @::onMainLoop,     sub { owl_jabber::onMainLoop(@_) };
-        push @::onGetBuddyList, sub { owl_jabber::onGetBuddyList(@_) };
+        push @::onMainLoop,     sub { BarnOwl::Jabber::onMainLoop(@_) };
+        push @::onGetBuddyList, sub { BarnOwl::Jabber::onGetBuddyList(@_) };
     } else {
         # Our owl doesn't support queue_message. Unfortunately, this
@@ -138,5 +137,5 @@
 }
 
-push @::onStartSubs, sub { owl_jabber::onStart(@_) };
+push @::onStartSubs, sub { BarnOwl::Jabber::onStart(@_) };
 
 sub onMainLoop {
@@ -329,19 +328,21 @@
         #XXX Todo: Add more callbacks.
         # * MUC presence handlers
+        # We use the anonymous subrefs in order to have the correct behavior
+        # when we reload
         $client->SetMessageCallBacks(
-            chat      => sub { owl_jabber::process_incoming_chat_message(@_) },
-            error     => sub { owl_jabber::process_incoming_error_message(@_) },
-            groupchat => sub { owl_jabber::process_incoming_groupchat_message(@_) },
-            headline  => sub { owl_jabber::process_incoming_headline_message(@_) },
-            normal    => sub { owl_jabber::process_incoming_normal_message(@_) }
+            chat      => sub { BarnOwl::Jabber::process_incoming_chat_message(@_) },
+            error     => sub { BarnOwl::Jabber::process_incoming_error_message(@_) },
+            groupchat => sub { BarnOwl::Jabber::process_incoming_groupchat_message(@_) },
+            headline  => sub { BarnOwl::Jabber::process_incoming_headline_message(@_) },
+            normal    => sub { BarnOwl::Jabber::process_incoming_normal_message(@_) }
         );
         $client->SetPresenceCallBacks(
-#            available    => sub { owl_jabber::process_presence_available(@_) },
-#            unavailable  => sub { owl_jabber::process_presence_available(@_) },
-            subscribe    => sub { owl_jabber::process_presence_subscribe(@_) },
-            subscribed   => sub { owl_jabber::process_presence_subscribed(@_) },
-            unsubscribe  => sub { owl_jabber::process_presence_unsubscribe(@_) },
-            unsubscribed => sub { owl_jabber::process_presence_unsubscribed(@_) },
-            error        => sub { owl_jabber::process_presence_error(@_) });
+            available    => sub { BarnOwl::Jabber::process_presence_available(@_) },
+#            unavailable  => sub { BarnOwl::Jabber::process_presence_available(@_) },
+            subscribe    => sub { BarnOwl::Jabber::process_presence_subscribe(@_) },
+            subscribed   => sub { BarnOwl::Jabber::process_presence_subscribed(@_) },
+            unsubscribe  => sub { BarnOwl::Jabber::process_presence_unsubscribe(@_) },
+            unsubscribed => sub { BarnOwl::Jabber::process_presence_unsubscribed(@_) },
+            error        => sub { BarnOwl::Jabber::process_presence_error(@_) });
 
         my $status = $client->Connect( %{ $vars{jlogin_connhash} } );
@@ -544,5 +545,5 @@
 
     $muc = shift @ARGV
-      or die("Usage: jmuc join {muc} [-p password] [-a account]");
+      or die("Usage: jmuc join MUC [-p password] [-a account]");
 
     my $presence = new Net::Jabber::Presence;
@@ -561,5 +562,5 @@
 
     $muc = shift @args if scalar @args;
-    die("Usage: jmuc part {muc} [-a account]") unless $muc;
+    die("Usage: jmuc part MUC [-a account]") unless $muc;
 
     $conn->getConnectionFromJidStr($jid)->PresenceSend( to => $muc, type => 'unavailable' );
@@ -573,5 +574,5 @@
     $muc = shift @args if scalar @args;
 
-    die('Usage: jmuc invite {jid} [muc] [-a account]')
+    die('Usage: jmuc invite JID [muc] [-a account]')
       unless $muc && $invite_jid;
 
