[412] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r546 - in trunk: . owl/perl/modules

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:05:52 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: Mon, 22 Jan 2007 19:00:18 -0500
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU

Author: nelhage
Date: 2007-01-22 19:00:17 -0500 (Mon, 22 Jan 2007)
New Revision: 546

Modified:
   trunk/
   trunk/owl/perl/modules/jabber.pl
Log:
 r18155@phanatique:  nelhage | 2007-01-22 19:00:11 -0500
 Don't die horribly if a connection becomed undefined (often due to a
 failed reload)



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18107
   + bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18155

Modified: trunk/owl/perl/modules/jabber.pl
===================================================================
--- trunk/owl/perl/modules/jabber.pl	2007-01-22 23:56:52 UTC (rev 545)
+++ trunk/owl/perl/modules/jabber.pl	2007-01-23 00:00:17 UTC (rev 546)
@@ -247,6 +247,11 @@
     foreach my $jid ( $conn->getJids() ) {
         my $client = $conn->getConnectionFromJidStr($jid);
 
+        unless($client) {
+            $conn->removeConnection($jid);
+            BarnOwl::error("Connection for $jid undefined -- error in reload?");
+        }
+        
         my $status = $client->Process(0);
         if ( !defined($status) ) {
             BarnOwl::error("Jabber account $jid disconnected!");
@@ -272,8 +277,10 @@
     my %jq  = $roster->query($buddy);
     my $res = $roster->resource($buddy);
 
-    $blistStr .= $jq{name} ? $jq{name} . "\t(" .$buddy->GetJID() . ')' : $buddy->GetJID();
+    my $name = $jq{name} || $buddy->GetUserID();
 
+    $blistStr .= sprintf '%-15s %s', $name, $buddy->GetJID();
+
     if ($res) {
         my %rq = $roster->resourceQuery( $buddy, $res );
         $blistStr .= " [" . ( $rq{show} ? $rq{show} : 'online' ) . "]";
@@ -305,7 +312,8 @@
 
         foreach my $group ( $roster->groups() ) {
             $blist .= "  Group: $group\n";
-            foreach my $buddy ( $roster->jids( 'group', $group ) ) {
+            my @buddies = $roster->jids( 'group', $group );
+            foreach my $buddy ( @buddies ) {
                 $blist .= blist_listBuddy( $roster, $buddy );
             }
         }
@@ -741,7 +749,6 @@
         auth     => \&jroster_auth,
         deauth   => \&jroster_deauth
     );
-
     my $func = $jroster_commands{$cmd};
     if ( !$func ) {
         BarnOwl::error("jroster: Unknown command: $cmd");


home help back first fref pref prev next nref lref last post