Changeset 9c7a701 for perl/modules
- Timestamp:
- Feb 15, 2008, 12:56:49 AM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 18a54ee
- Parents:
- a6a4155
- Location:
- perl/modules
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
rcab045b r9c7a701 69 69 } 70 70 71 sub mainloop_hook { 71 #sub mainloop_hook { 72 # return unless defined $irc; 73 # eval { 74 # $irc->do_one_loop(); 75 # }; 76 # return; 77 #} 78 79 sub OwlProcess { 72 80 return unless defined $irc; 73 81 eval { … … 76 84 return; 77 85 } 86 78 87 79 88 sub register_handlers { … … 109 118 $BarnOwl::Hooks::startup->add(\&startup); 110 119 $BarnOwl::Hooks::shutdown->add(\&shutdown); 111 $BarnOwl::Hooks::mainLoop->add(\&mainloop_hook);120 #$BarnOwl::Hooks::mainLoop->add(\&mainloop_hook); 112 121 113 122 ################################################################################ … … 165 174 BarnOwl::admin_message("IRC", "Connected to $alias as $nick"); 166 175 $ircnets{$alias} = $conn; 176 my $fd = $conn->getSocket()->fileno(); 177 BarnOwl::add_dispatch($fd, \&OwlProcess); 178 $conn->{FD} = $fd; 167 179 } else { 168 180 die("IRC::Connection->connect failed: $!"); -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r5ff830a r9c7a701 69 69 } 70 70 71 sub getSocket 72 { 73 my $self = shift; 74 return $self->conn->socket; 75 } 76 71 77 ################################################################################ 72 78 ############################### IRC callbacks ################################## … … 168 174 my $self = shift; 169 175 delete $BarnOwl::Module::IRC::ircnets{$self->alias}; 170 176 BarnOwl::remove_dispatch($self->{FD}); 171 177 BarnOwl::admin_message('IRC', 172 178 "[" . $self->alias . "] Disconnected from server"); -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
r879e7e94 r9c7a701 116 116 BarnOwl::error("Connection for $jid undefined -- error in reload?"); 117 117 } 118 119 my $status = $client->Process(0);120 if ( !defined($status) ) {121 BarnOwl::error("Jabber account $jid disconnected!");122 do_logout($jid);123 }124 118 if ($::shutdown) { 125 119 do_logout($jid); 126 return;120 next; 127 121 } 128 122 if ($vars{status_changed}) { … … 387 381 $conn->renameConnection($jidStr, $fullJid); 388 382 queue_admin_msg("Connected to jabber as $fullJid"); 383 # The remove_dispatch() method is called from the 384 # ConnectionManager's removeConnection() method. 385 BarnOwl::add_dispatch($client->getSocket()->fileno(), sub { $client->OwlProcess() }); 389 386 } 390 387 } -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm
r892568b r9c7a701 110 110 111 111 112 =head2 getSID 113 114 Returns the StreamID for this connection. 115 116 =cut 117 118 sub getStreamID { 119 my $self = shift; 120 return $self->{SESSION}->{id} || ""; 121 } 122 123 =head2 getSocket 124 125 Returns the IO::Socket for this connection. 126 127 =cut 128 129 sub getSocket { 130 my $self = shift; 131 my $sid = getStreamID($self); 132 return $self->{STREAM}->{SIDS}->{$sid}->{sock} || -1; 133 } 134 135 =head2 OwlProcess 136 137 Non-blocking connection processing. For use in a select loop. 138 139 =cut 140 141 sub OwlProcess { 142 my $self = shift; 143 my $status = $self->Process(0); 144 if ( !defined($status) ) { 145 my $jid = $self->{SESSION}->{FULLJID}; 146 BarnOwl::error("Jabber account $jid disconnected!"); 147 do_logout($jid); 148 } 149 } 150 112 151 =head1 SEE ALSO 113 152 -
perl/modules/Jabber/lib/BarnOwl/Module/Jabber/ConnectionManager.pm
r7f33c18 r9c7a701 37 37 return 0 unless exists $self->{$jidStr}; 38 38 39 BarnOwl::remove_dispatch($self->{$jidStr}->{Client}->getSocket()->fileno()); 39 40 $self->{$jidStr}->{Client}->Disconnect() 40 41 if $self->{$jidStr}->{Client}; … … 51 52 return 0 if $oldJidStr eq $newJidStr; 52 53 53 $self->{$newJidStr} = $self->{$oldJidStr}; 54 $self->{$newJidStr} = $self->{$oldJidStr}; 54 55 delete $self->{$oldJidStr}; 55 56 return 1;
Note: See TracChangeset
for help on using the changeset viewer.