Index: perl/modules/jabber.pl
===================================================================
--- perl/modules/jabber.pl	(revision ffe70f96546cd83da24fe3d2a651bc087638cd44)
+++ perl/modules/jabber.pl	(revision d609dd69d0e893047ea3bc6a87b974a7a675a748)
@@ -40,5 +40,5 @@
 
     my %args = ();
-    if(owl::getvar('debug') eq 'on') {
+    if(BarnOwl::getvar('debug') eq 'on') {
         $args{debuglevel} = 1;
         $args{debugfile} = 'jabber.log';
@@ -127,5 +127,5 @@
 
 sub onStart {
-    if ( eval { \&owl::queue_message } ) {
+    if ( eval { \&BarnOwl::queue_message } ) {
         register_owl_commands();
         push @::onMainLoop,     sub { owl_jabber::onMainLoop(@_) };
@@ -133,5 +133,5 @@
     } else {
         # Our owl doesn't support queue_message. Unfortunately, this
-        # means it probably *also* doesn't support owl::error. So just
+        # means it probably *also* doesn't support BarnOwl::error. So just
         # give up silently.
     }
@@ -148,5 +148,5 @@
         my $status = $client->Process(0);
         if ( !defined($status) ) {
-            owl::error("Jabber account $jid disconnected!");
+            BarnOwl::error("Jabber account $jid disconnected!");
             do_logout($jid);
         }
@@ -225,14 +225,14 @@
 ### Owl Commands
 sub register_owl_commands() {
-    owl::new_command(
+    BarnOwl::new_command(
         jabberlogin => \&cmd_login,
         { summary => "Log into jabber", },
         { usage   => "jabberlogin JID" }
     );
-    owl::new_command(
+    BarnOwl::new_command(
         jabberlogout => \&cmd_logout,
         { summary => "Log out of jabber" }
     );
-    owl::new_command(
+    BarnOwl::new_command(
         jwrite => \&cmd_jwrite,
         {
@@ -241,5 +241,5 @@
         }
     );
-    owl::new_command(
+    BarnOwl::new_command(
         jlist => \&cmd_jlist,
         {
@@ -248,5 +248,5 @@
         }
     );
-    owl::new_command(
+    BarnOwl::new_command(
         jmuc => \&cmd_jmuc,
         {
@@ -258,5 +258,5 @@
               . "            The muc is taken from the current message if not supplied.\n\n"
               . "invite JID MUC\n"
-              . "            Invite {jid} to [muc].\n"
+              . "            Invite JID to MUC.\n"
               . "            The muc is taken from the current message if not supplied.\n\n"
               . "configure MUC\n"
@@ -267,5 +267,5 @@
         }
     );
-    owl::new_command(
+    BarnOwl::new_command(
         jroster => \&cmd_jroster,
         {
@@ -289,10 +289,10 @@
 
     if ( !$uid || !$componentname ) {
-        owl::error("usage: $cmd {jid}");
+        BarnOwl::error("usage: $cmd JID");
         return;
     }
 
     if ( $conn->jidExists($jidStr) ) {
-        owl::error("Already logged in as $jidStr.");
+        BarnOwl::error("Already logged in as $jidStr.");
         return;
     }
@@ -321,5 +321,5 @@
     my $jidStr = $vars{jlogin_jid};
     if ( !$jidStr && $vars{jlogin_havepass}) {
-        owl::error("Got password but have no jid!");
+        BarnOwl::error("Got password but have no jid!");
     }
     else
@@ -348,17 +348,17 @@
         if ( !$status ) {
             $conn->removeConnection($jidStr);
-            owl::error("We failed to connect");
+            BarnOwl::error("We failed to connect");
         } else {
             my @result = $client->AuthSend( %{ $vars{jlogin_authhash} } );
 
             if ( !@result || $result[0] ne 'ok' ) {
-                if ( !$vars{jlogin_havepass} && ( $#result == -1 || $result[0] eq '401' ) ) {
+                if ( !$vars{jlogin_havepass} && ( !@result || $result[0] eq '401' ) ) {
                     $vars{jlogin_havepass} = 1;
                     $conn->removeConnection($jidStr);
-                    owl::start_password( "Password for $jidStr: ", \&do_login );
+                    BarnOwl::start_password( "Password for $jidStr: ", \&do_login );
                     return "";
                 }
                 $conn->removeConnection($jidStr);
-                owl::error( "Error in connect: " . join( " ", @result ) );
+                BarnOwl::error( "Error in connect: " . join( " ", @result ) );
             } else {
                 $conn->getRosterFromJidStr($jidStr)->fetch();
@@ -420,13 +420,13 @@
 sub cmd_jlist {
     if ( !( scalar $conn->getJids() ) ) {
-        owl::error("You are not logged in to Jabber.");
+        BarnOwl::error("You are not logged in to Jabber.");
         return;
     }
-    owl::popless_ztext( onGetBuddyList() );
+    BarnOwl::popless_ztext( onGetBuddyList() );
 }
 
 sub cmd_jwrite {
     if ( !$conn->connected() ) {
-        owl::error("You are not logged in to Jabber.");
+        BarnOwl::error("You are not logged in to Jabber.");
         return;
     }
@@ -453,5 +453,5 @@
 
     if ( scalar @ARGV != 1 ) {
-        owl::error(
+        BarnOwl::error(
             "Usage: jwrite JID [-g] [-t thread] [-s 'subject'] [-a account]");
         return;
@@ -466,5 +466,5 @@
         }
         else {
-            owl::error("Please specify an account with -a {jid}");
+            BarnOwl::error("Please specify an account with -a JID");
             return;
         }
@@ -484,8 +484,8 @@
     };
 
-    owl::message(
+    BarnOwl::message(
 "Type your message below.  End with a dot on a line by itself.  ^C will quit."
     );
-    owl::start_edit_win( join( ' ', @args ), \&process_owl_jwrite );
+    BarnOwl::start_edit_win( join( ' ', @args ), \&process_owl_jwrite );
 }
 
@@ -508,5 +508,5 @@
     my $func = $jmuc_commands{$cmd};
     if ( !$func ) {
-        owl::error("jmuc: Unknown command: $cmd");
+        BarnOwl::error("jmuc: Unknown command: $cmd");
         return;
     }
@@ -516,5 +516,5 @@
         my $jid;
         my $muc;
-        my $m = owl::getcurmsg();
+        my $m = BarnOwl::getcurmsg();
         if ( $m->is_jabber && $m->{jtype} eq 'groupchat' ) {
             $muc = $m->{room};
@@ -531,5 +531,5 @@
         }
         else {
-            owl::error('You must specify an account with -a {jid}');
+            BarnOwl::error('You must specify an account with -a {jid}');
         }
         return $func->( $jid, $muc, @ARGV );
@@ -623,5 +623,5 @@
     my $func = $jroster_commands{$cmd};
     if ( !$func ) {
-        owl::error("jroster: Unknown command: $cmd");
+        BarnOwl::error("jroster: Unknown command: $cmd");
         return;
     }
@@ -647,5 +647,5 @@
         }
         else {
-            owl::error('You must specify an account with -a {jid}');
+            BarnOwl::error('You must specify an account with -a {jid}');
         }
         return $func->( $jid, $name, \@groups, $purgeGroups,  @ARGV );
@@ -809,6 +809,6 @@
 
     my $m = j2o( $j, { direction => 'out' } );
-    if ( $vars{jwrite}{type} ne 'groupchat' && owl::getvar('displayoutgoing') eq 'on') {
-        owl::queue_message($m);
+    if ( $vars{jwrite}{type} ne 'groupchat' && BarnOwl::getvar('displayoutgoing') eq 'on') {
+        BarnOwl::queue_message($m);
     }
 
@@ -821,5 +821,5 @@
 
     delete $vars{jwrite};
-    owl::message("");   # Kludge to make the ``type your message...'' message go away
+    BarnOwl::message("");   # Kludge to make the ``type your message...'' message go away
 }
 
@@ -828,5 +828,5 @@
 sub process_incoming_chat_message {
     my ( $sid, $j ) = @_;
-    owl::queue_message( j2o( $j, { direction => 'in',
+    BarnOwl::queue_message( j2o( $j, { direction => 'in',
                                    sid => $sid } ) );
 }
@@ -837,5 +837,5 @@
                               sid => $sid } );
     $jhash{type} = 'admin';
-    owl::queue_message( owl::Message->new(%jhash) );
+    BarnOwl::queue_message( BarnOwl::Message->new(%jhash) );
 }
 
@@ -845,5 +845,5 @@
     # HACK IN PROGRESS (ignoring delayed messages)
     return if ( $j->DefinedX('jabber:x:delay') && $j->GetX('jabber:x:delay') );
-    owl::queue_message( j2o( $j, { direction => 'in',
+    BarnOwl::queue_message( j2o( $j, { direction => 'in',
                                    sid => $sid } ) );
 }
@@ -851,5 +851,5 @@
 sub process_incoming_headline_message {
     my ( $sid, $j ) = @_;
-    owl::queue_message( j2o( $j, { direction => 'in',
+    BarnOwl::queue_message( j2o( $j, { direction => 'in',
                                    sid => $sid } ) );
 }
@@ -871,5 +871,5 @@
     #    }
     #
-    owl::queue_message( owl::Message->new(%jhash) );
+    BarnOwl::queue_message( BarnOwl::Message->new(%jhash) );
 }
 
@@ -906,5 +906,5 @@
     }
     $props{replysendercmd} = $props{replycmd} = "jwrite $from -i $sid";
-    owl::queue_message(owl::Message->new(%props));
+    BarnOwl::queue_message(BarnOwl::Message->new(%props));
 }
 
@@ -924,5 +924,5 @@
     $props{replycmd} = "jroster auth $from -a $to";
     $props{replysendercmd} = "jroster deauth $from -a $to";
-    owl::queue_message(owl::Message->new(%props));
+    BarnOwl::queue_message(BarnOwl::Message->new(%props));
 }
 
@@ -940,5 +940,5 @@
 
     $props{body} = "The user ($from) has been unsubscribed from your ($to) presence.\n";
-    owl::queue_message(owl::Message->new(%props));
+    BarnOwl::queue_message(BarnOwl::Message->new(%props));
 
     # Find a connection to reply with.
@@ -979,5 +979,5 @@
     my $code = $p->GetErrorCode();
     my $error = $p->GetError();
-    owl::error("Jabber: $code $error");
+    BarnOwl::error("Jabber: $code $error");
 }
 
@@ -1056,15 +1056,15 @@
 
 sub j2o {
-    return owl::Message->new( j2hash(@_) );
+    return BarnOwl::Message->new( j2hash(@_) );
 }
 
 sub queue_admin_msg {
     my $err = shift;
-    my $m   = owl::Message->new(
+    my $m   = BarnOwl::Message->new(
         type      => 'admin',
         direction => 'none',
         body      => $err
     );
-    owl::queue_message($m);
+    BarnOwl::queue_message($m);
 }
 
@@ -1118,5 +1118,5 @@
         # Specified account exists
         return $givenJidStr if ($conn->jidExists($givenJidStr) );
-        owl::error("Invalid account: $givenJidStr");
+        BarnOwl::error("Invalid account: $givenJidStr");
     }
 
@@ -1145,5 +1145,5 @@
         # Not one of ours.
         elsif ( $matchingJid eq "" ) {
-            owl::error("Invalid account: $givenJidStr");
+            BarnOwl::error("Invalid account: $givenJidStr");
         }
 
@@ -1159,7 +1159,7 @@
 #####################################################################
 
-package owl::Message::Jabber;
-
-our @ISA = qw( owl::Message );
+package BarnOwl::Message::Jabber;
+
+our @ISA = qw( BarnOwl::Message );
 
 sub jtype { shift->{jtype} };
@@ -1185,5 +1185,5 @@
         $ftext = qq{type ^jabber\$ and ( ( direction ^in\$ and from ^$user ) } .
                  qq{or ( direction ^out\$ and to ^$user ) ) };
-        owl::filter("$filter $ftext");
+        BarnOwl::filter("$filter $ftext");
         return $filter;
     } elsif ($self->jtype eq 'groupchat') {
@@ -1191,5 +1191,5 @@
         $filter = "jabber-room-$room";
         $ftext = qq{type ^jabber\$ and room ^$room\$};
-        owl::filter("$filter $ftext");
+        BarnOwl::filter("$filter $ftext");
         return $filter;
     }
