[580] in BarnOwl Developers

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

[D-O-H] r694 - in trunk/owl/perl/modules/Jabber/lib: BarnOwl/Module BarnOwl/Module/Jabber Net/XMPP

daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:07:38 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Thu, 12 Apr 2007 18:05:38 -0400 (EDT)

Author: asedeno
Date: 2007-04-12 18:05:37 -0400 (Thu, 12 Apr 2007)
New Revision: 694

Modified:
   trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
   trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm
   trunk/owl/perl/modules/Jabber/lib/Net/XMPP/Protocol.pm
Log:
Net::XMPP::Protocol -  Make resource binding note the full jid on connect.
BarnOwl::Module::Jabber::ConnectionManager - Allow for connections to be renamed.
BarnOwl::Module::Jabber - Rename the connection after connect to match the jid received.

This makes Net::XMPP recognize that the server may in fact connect a
user under a different resource than the one the user specified. In
particular, it works around the crap GoogleTalk appends to the
supplied resource.



Modified: trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm
===================================================================
--- trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm	2007-03-29 02:54:33 UTC (rev 693)
+++ trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm	2007-04-12 22:05:37 UTC (rev 694)
@@ -43,6 +43,18 @@
     return 1;
 }
 
+sub renameConnection {
+    my $self = shift;
+    my $oldJidStr = shift;
+    my $newJidStr = shift;
+    return 0 unless exists $self->{$oldJidStr};
+    return 0 if $oldJidStr eq $newJidStr;
+
+    $self->{$newJidStr} = $self->{$oldJidStr}; 
+    delete $self->{$oldJidStr};
+    return 1;
+}
+
 sub connected {
     my $self = shift;
     return scalar keys %{ $self };

Modified: trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	2007-03-29 02:54:33 UTC (rev 693)
+++ trunk/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	2007-04-12 22:05:37 UTC (rev 694)
@@ -362,10 +362,11 @@
             } else {
                 $conn->getRosterFromJID($jidStr)->fetch();
                 $client->PresenceSend( priority => 1 );
-                queue_admin_msg("Connected to jabber as $jidStr");
+		my $fullJid = $client->{SESSION}->{FULLJID};
+		$conn->renameConnection($jidStr, $fullJid);
+                queue_admin_msg("Connected to jabber as $fullJid");
             }
         }
-
     }
     delete $vars{jlogin_jid};
     $vars{jlogin_password} =~ tr/\0-\377/x/ if $vars{jlogin_password};
@@ -373,6 +374,7 @@
     delete $vars{jlogin_havepass};
     delete $vars{jlogin_connhash};
     delete $vars{jlogin_authhash};
+ 
     return "";
 }
 

Modified: trunk/owl/perl/modules/Jabber/lib/Net/XMPP/Protocol.pm
===================================================================
--- trunk/owl/perl/modules/Jabber/lib/Net/XMPP/Protocol.pm	2007-03-29 02:54:33 UTC (rev 693)
+++ trunk/owl/perl/modules/Jabber/lib/Net/XMPP/Protocol.pm	2007-04-12 22:05:37 UTC (rev 694)
@@ -1977,7 +1977,8 @@
     if ($bind)
     {
         $self->{DEBUG}->Log1("AuthSASL: Binding to resource");
-        $self->BindResource($args{resource});
+        my $jid = $self->BindResource($args{resource});
+	$self->{SESSION}->{FULLJID} = $jid;
     }
 
     #-------------------------------------------------------------------------
@@ -2018,6 +2019,7 @@
     }
 
     my $result = $self->SendAndReceiveWithID($iq);
+    return $result->GetChild(&ConstXMLNS("xmpp-bind"))->GetJID();;
 }
 
 


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