[345] in BarnOwl Developers

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

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

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

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Mon,  8 Jan 2007 16:17:31 -0500 (EST)

Author: nelhage
Date: 2007-01-08 16:17:31 -0500 (Mon, 08 Jan 2007)
New Revision: 490

Modified:
   trunk/
   trunk/owl/perl/modules/jabber.pl
Log:
 r17861@phanatique:  nelhage | 2007-01-08 14:34:12 -0500
 First pass at printing presence errors. This works with
 conference.mit.edu, but only prints the error code for
 conference.jabber.org right now.



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:17860
   + bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:17861

Modified: trunk/owl/perl/modules/jabber.pl
===================================================================
--- trunk/owl/perl/modules/jabber.pl	2007-01-08 21:17:27 UTC (rev 489)
+++ trunk/owl/perl/modules/jabber.pl	2007-01-08 21:17:31 UTC (rev 490)
@@ -130,8 +130,7 @@
         register_owl_commands();
         push @::onMainLoop,     sub { owl_jabber::onMainLoop(@_) };
         push @::onGetBuddyList, sub { owl_jabber::onGetBuddyList(@_) };
-    }
-    else {
+    } else {
         # Our owl doesn't support queue_message. Unfortunately, this
         # means it probably *also* doesn't support owl::error. So just
         # give up silently.
@@ -340,7 +339,8 @@
             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(@_) });
+            unsubscribed => sub { owl_jabber::process_presence_unsubscribed(@_) },
+            error        => sub { owl_jabber::process_presence_error(@_) });
 
         my $status = $client->Connect( %{ $vars{jlogin_connhash} } );
         if ( !$status ) {
@@ -974,7 +974,14 @@
     return;
 }
 
+sub process_presence_error {
+    my ( $sid, $p ) = @_;
+    my $code = $p->GetErrorCode();
+    my $error = $p->GetError();
+    owl::error("Jabber: $code $error");
+}
 
+
 ### Helper functions
 
 sub j2hash {
@@ -1069,9 +1076,9 @@
     return '@b{' . $str . '}' if ( $str !~ /\}/ );
     return '@b[' . $str . ']' if ( $str !~ /\]/ );
 
-    my $txt = "\@b($str";
-    $txt =~ s/\)/\)\@b\[\)\]\@b\(/g;
-    return $txt . ')';
+    my $txt = "$str";
+    $txt =~ s{[)]}{)\@b[)]\@b(}g;
+    return '@b(' . $txt . ')';
 }
 
 sub getServerFromJID {


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