- Timestamp:
- Sep 12, 2009, 11:22:14 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 7967433
- Parents:
- eea72a13
- git-author:
- Alejandro R. Sedeño <asedeno@mit.edu> (09/12/09 20:54:05)
- git-committer:
- Alejandro R. Sedeño <asedeno@mit.edu> (09/12/09 23:22:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r8362a48 r5118b32 70 70 register_keybindings(); 71 71 register_filters(); 72 $BarnOwl::Hooks::mainLoop->add("BarnOwl::Module::Jabber::onMainLoop");73 72 $BarnOwl::Hooks::getBuddyList->add("BarnOwl::Module::Jabber::onGetBuddyList"); 74 73 $BarnOwl::Hooks::getQuickstart->add("BarnOwl::Module::Jabber::onGetQuickstart"); … … 106 105 $BarnOwl::Hooks::startup->add("BarnOwl::Module::Jabber::onStart"); 107 106 108 sub onMainLoop { 109 return if ( !$conn->connected() ); 107 sub do_keep_alive_and_auto_away { 108 if ( !$conn->connected() ) { 109 # We don't need this timer any more. 110 delete $vars{keepAliveTimer}; 111 return; 112 } 110 113 111 114 $vars{status_changed} = 0; … … 121 124 $vars{status} = 'Auto away after '.$auto_away.' minute'.($auto_away == 1 ? '' : 's').' idle.'; 122 125 $vars{status_changed} = 1; 123 } elsif ($idletime == 0&& $vars{show} ne '') {126 } elsif ($idletime <= $vars{idletime} && $vars{show} ne '') { 124 127 $vars{show} = ''; 125 128 $vars{status} = ''; 126 129 $vars{status_changed} = 1; 127 130 } 131 $vars{idletime} = $idletime; 128 132 129 133 foreach my $jid ( $conn->getJIDs() ) { … … 134 138 BarnOwl::error("Connection for $jid undefined -- error in reload?"); 135 139 } 136 # We keep this in the mainloop hook for keep-alives 137 my $status = $client->Process(0); 140 my $status = $client->Process(0); # keep-alive 138 141 if ( !defined($status) ) { 139 142 BarnOwl::error("Jabber account $jid disconnected!"); 140 143 do_logout($jid); 144 next; 141 145 } 142 146 if ($::shutdown) { … … 450 454 $completion_jids{$buddy->GetJID()} = 1; 451 455 } 456 $vars{idletime} |= BarnOwl::getidletime(); 457 unless (exists $vars{keepAliveTimer}) { 458 $vars{keepAliveTimer} = BarnOwl::Timer->new({ 459 'after' => 5, 460 'interval' => 5, 461 'cb' => sub { BarnOwl::Module::Jabber::do_keep_alive_and_auto_away(@_) } 462 }); 463 } 452 464 } 453 465 }
Note: See TracChangeset
for help on using the changeset viewer.