Ignore:
Timestamp:
Dec 22, 2009, 6:37:38 PM (10 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
a2a5236
Parents:
6396c1e
git-author:
Alejandro R. Sedeño <asedeno@mit.edu> (12/22/09 01:15:39)
git-committer:
Alejandro R. Sedeño <asedeno@mit.edu> (12/22/09 18:37:38)
Message:
Factor out some common jabber connect-time code

Call it upon successful connection and reconnection.
File:
1 edited

Legend:

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

    r2b66c361 r0dbb7d2  
    465465                    }
    466466                );
    467                 my $roster = $conn->getRosterFromJID($jidStr);
    468                 $roster->fetch();
    469                 $client->PresenceSend( priority => 1 );
    470                 my $fullJid = $client->{SESSION}->{FULLJID} || $jidStr;
    471                 $conn->renameConnection($jidStr, $fullJid);
    472                 queue_admin_msg("Connected to jabber as $fullJid");
    473                 # The remove_io_dispatch() method is called from the
    474                 # ConnectionManager's removeConnection() method.
    475                 $client->{fileno} = $client->getSocket()->fileno();
    476                 #queue_admin_msg("Connected to jabber as $fullJid ($client->{fileno})");
    477                 BarnOwl::add_io_dispatch($client->{fileno}, 'r', sub { $client->OwlProcess($fullJid) });
    478 
    479                 # populate completion from roster.
    480                 for my $buddy ( $roster->jids('all') ) {
    481                     my %jq  = $roster->query($buddy);
    482                     my $name = $jq{name} || $buddy->GetUserID();
    483                     $completion_jids{$name} = 1;
    484                     $completion_jids{$buddy->GetJID()} = 1;
    485                 }
    486                 $vars{idletime} |= BarnOwl::getidletime();
    487                 unless (exists $vars{keepAliveTimer}) {
    488                     $vars{keepAliveTimer} = BarnOwl::Timer->new({
    489                         'after' => 5,
    490                         'interval' => 5,
    491                         'cb' => sub { BarnOwl::Module::Jabber::do_keep_alive_and_auto_away(@_) }
    492                                                                 });
    493                 }
     467                $client->onConnect($conn, $jidStr);
    494468            }
    495469        }
Note: See TracChangeset for help on using the changeset viewer.