[248] in BarnOwl Developers

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

[D-O-H] r421 - trunk/conf.asedeno/owl/modules

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:04:06 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: Sun, 29 Oct 2006 10:00:17 -0500 (EST)

Author: nelhage
Date: 2006-10-29 10:00:16 -0500 (Sun, 29 Oct 2006)
New Revision: 421

Modified:
   trunk/conf.asedeno/owl/modules/jabber.pl
Log:
Changing the reply code to embed the reply address in the reply
command, like zephyr and AIM do. Eventually, we'll need to add option
parsing to jwrite; We'll probably want to cargo-cult jwgc's.

Modified: trunk/conf.asedeno/owl/modules/jabber.pl
===================================================================
--- trunk/conf.asedeno/owl/modules/jabber.pl	2006-10-29 10:02:26 UTC (rev 420)
+++ trunk/conf.asedeno/owl/modules/jabber.pl	2006-10-29 15:00:16 UTC (rev 421)
@@ -53,10 +53,9 @@
 ### Owl Commands
 sub register_owl_commands()
 {
-    0;
     owl::new_command(jabberlogin => \&cmd_login);
     owl::new_command(jabberlogout => \&cmd_logout);
-    owl::new_command(jabberreply => \&cmd_reply);
+#    owl::new_command(jabberreply => \&cmd_reply);
     owl::new_command(jwrite => \&cmd_jwrite);
 }
 
@@ -82,8 +81,12 @@
 	return;
     }
 
-    # this needs error handling.
-    $client->AuthSend(username => $ENV{USER}, resource => 'owl', password => '');
+    my @result = $client->AuthSend(username => $ENV{USER}, resource => 'owl', password => '');
+    if($result[0] ne 'ok') {
+        owl::error("Error in connect: " . join(" ", $result[1..$#result]));
+        $client->Disconnect();
+        return;
+    }
 
     $jid = new Net::Jabber::JID;
     $jid->SetJID(userid => $ENV{USER},
@@ -199,9 +202,16 @@
     my $dir = shift;
 
     my %props = (type => 'jabber',
-		 replycmd => 'jabberreply',
 		 direction => $dir);
 
+    my $reply_to;
+    if($dir eq 'out') {
+        $reply_to = $j->GetTo;
+    } else {
+        $reply_to = $j->GetFrom;
+    }
+    $props{replycmd} = $props{replysendercmd} = "jwrite $reply_to";
+
     if ($j->DefinedTo())
     {
 	my $jid = $j->GetTo('jid');
@@ -221,5 +231,6 @@
     $props{error} = $j->GetError() if ($j->DefinedError());
     $props{error_code} = $j->GetErrorCode() if ($j->DefinedErrorCode());
 
+
     return owl::Message->new(%props);
 }


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