Changeset 7f33c18 for perl


Ignore:
Timestamp:
Apr 12, 2007, 6:05:37 PM (14 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
80e54a7
Parents:
c2c5c77
Message:
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.
Location:
perl/modules/Jabber/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r2cedb7a r7f33c18  
    363363                $conn->getRosterFromJID($jidStr)->fetch();
    364364                $client->PresenceSend( priority => 1 );
    365                 queue_admin_msg("Connected to jabber as $jidStr");
     365                my $fullJid = $client->{SESSION}->{FULLJID};
     366                $conn->renameConnection($jidStr, $fullJid);
     367                queue_admin_msg("Connected to jabber as $fullJid");
    366368            }
    367369        }
    368 
    369370    }
    370371    delete $vars{jlogin_jid};
     
    374375    delete $vars{jlogin_connhash};
    375376    delete $vars{jlogin_authhash};
     377 
    376378    return "";
    377379}
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm

    r2cedb7a r7f33c18  
    4141    delete $self->{$jidStr};
    4242
     43    return 1;
     44}
     45
     46sub renameConnection {
     47    my $self = shift;
     48    my $oldJidStr = shift;
     49    my $newJidStr = shift;
     50    return 0 unless exists $self->{$oldJidStr};
     51    return 0 if $oldJidStr eq $newJidStr;
     52
     53    $self->{$newJidStr} = $self->{$oldJidStr};
     54    delete $self->{$oldJidStr};
    4355    return 1;
    4456}
  • perl/modules/Jabber/lib/Net/XMPP/Protocol.pm

    rc2bed55 r7f33c18  
    19781978    {
    19791979        $self->{DEBUG}->Log1("AuthSASL: Binding to resource");
    1980         $self->BindResource($args{resource});
     1980        my $jid = $self->BindResource($args{resource});
     1981        $self->{SESSION}->{FULLJID} = $jid;
    19811982    }
    19821983
     
    20192020
    20202021    my $result = $self->SendAndReceiveWithID($iq);
     2022    return $result->GetChild(&ConstXMLNS("xmpp-bind"))->GetJID();;
    20212023}
    20222024
Note: See TracChangeset for help on using the changeset viewer.