Changeset 0dbb7d2
- Timestamp:
- Dec 22, 2009, 6:37:38 PM (15 years ago)
- Branches:
- master, release-1.10, 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)
- Location:
- perl/modules/Jabber/lib/BarnOwl/Module
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r2b66c361 r0dbb7d2 465 465 } 466 466 ); 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); 494 468 } 495 469 } -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
r8590774 r0dbb7d2 163 163 } 164 164 165 =head2 OnConnect 166 167 Actions to perform on connecting and reconnecting. 168 169 =cut 170 171 sub onConnect { 172 my $self = shift; 173 my $conn = shift; 174 my $jidStr = shift; 175 176 my $fullJid = $self->{SESSION}->{FULLJID} || $jidStr; 177 my $roster = $conn->getRosterFromJID($jidStr); 178 179 $roster->fetch(); 180 $self->PresenceSend( priority => 1 ); 181 182 $conn->renameConnection($jidStr, $fullJid); 183 BarnOwl::admin_message('Jabber', "Connected to jabber as $fullJid"); 184 # The remove_io_dispatch() method is called from the 185 # ConnectionManager's removeConnection() method. 186 $self->{fileno} = $self->getSocket()->fileno(); 187 BarnOwl::add_io_dispatch($self->{fileno}, 'r', sub { $self->OwlProcess($fullJid) }); 188 189 # populate completion from roster. 190 for my $buddy ( $roster->jids('all') ) { 191 my %jq = $roster->query($buddy); 192 my $name = $jq{name} || $buddy->GetUserID(); 193 $BarnOwl::Module::Jabber::completion_jids{$name} = 1; 194 $BarnOwl::Module::Jabber::completion_jids{$buddy->GetJID()} = 1; 195 } 196 $BarnOwl::Module::Jabber::vars{idletime} |= BarnOwl::getidletime(); 197 unless (exists $BarnOwl::Module::Jabber::vars{keepAliveTimer}) { 198 $BarnOwl::Module::Jabber::vars{keepAliveTimer} = 199 BarnOwl::Timer->new({ 200 'after' => 5, 201 'interval' => 5, 202 'cb' => sub { BarnOwl::Module::Jabber::do_keep_alive_and_auto_away(@_) } 203 }); 204 } 205 } 206 165 207 =head1 SEE ALSO 166 208 -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm
rf1a2736 r0dbb7d2 85 85 $self->{$jidStr}->{ReconnectAt} = time + $self->{$jidStr}->{ReconnectBackoff}; 86 86 87 my $status = $self->{$jidStr}->{Client}->Connect; 87 my $client = $self->{$jidStr}->{Client}; 88 my $status = $client->Connect; 88 89 return 0 unless $status; 89 90 90 my @result = $ self->{$jidStr}->{Client}->AuthSend( %{ $self->{$jidStr}->{Auth} } );91 my @result = $client->AuthSend( %{ $self->{$jidStr}->{Auth} } ); 91 92 if ( !@result || $result[0] ne 'ok' ) { 92 93 $self->removeConnection($jidStr); … … 94 95 return 0; 95 96 } 96 97 BarnOwl::admin_message(Jabber => "Reconnected to jabber as $jidStr"); 98 $self->{$jidStr}{Status} = "available"; 99 100 foreach my $muc ($self->{$jidStr}->{Client}->MUCs()) { 97 $self->{$jidStr}->{Status} = "available"; 98 $client->onConnect($self, $jidStr); 99 foreach my $muc ($client->MUCs()) { 101 100 $muc->Join($muc->{ARGS}); 102 101 }
Note: See TracChangeset
for help on using the changeset viewer.