Changeset 2939
- Timestamp:
- 05/10/05 20:44:16 (4 years ago)
- svk:copy_cache_prev:
- 4498
- Files:
-
- 1 modified
-
ext/Net-IRC/lib/Net/IRC.pm (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ext/Net-IRC/lib/Net/IRC.pm
r2918 r2939 68 68 69 69 # Default (passive) handlers 70 # First event we get, indicating a successful login 70 71 %handler<001> = [-> $event { 71 72 $inside++; … … 78 79 debug "Logged in to \"$servername\" as \"$curnick\"."; 79 80 }]; 81 82 # Nick already used, so we permute our nick. 80 83 %handler<433> = [-> $event { 81 84 if $in_login_phase { … … 83 86 } 84 87 }]; 88 89 # /WHO (we /WHO ourselves so we can provide accurate username, hostname, and 90 # ircname information.) 85 91 %handler<352> = [-> $event { 86 92 my %rest; … … 92 98 } 93 99 }]; 100 101 # The topic of a chan. 102 %handler<332> = [-> $event { 103 my ($chan, $topic) = split " ", $event<rest>; 104 $topic = strip_colon($topic); 105 106 # %channels{normalize $chan}<topic> = $topic; 107 }]; 108 %handler<TOPIC> = [-> $event { 109 # %channels{normalize $event<object>}<topic> = $event<rest>; 110 }]; 111 112 # We track our status, especially the channels we've joined. 94 113 %handler<JOIN> = [-> $event { 95 114 if(normalize($event<from_nick>) eq normalize($curnick)) { … … 172 191 channel => -> Str $channel { %channels{normalize $channel} }, 173 192 174 # Handler register methods193 # Main handler register method 175 194 add_handler => -> Str $code, Code $cb { %handler{$code}.push($cb) }, 176 195 … … 196 215 debug "Disconnecting from $host:$port... "; 197 216 try { $hdl.close } 217 # We want to have a sane state when we connect next time. 198 218 $connected = 0; 199 219 $inside = 0; … … 219 239 if($connected) { 220 240 $queue<enqueue>({ 241 # Indicate that we're currently logging in, so our nick_already_used 242 # handler can choose a different nick. $in_login_phase is reset to 0 243 # when we're successfully logged in. 221 244 $in_login_phase++; 222 245 $say("NICK {$nickgen<next>()}"); … … 241 264 $line ~~ s:P5/[\015\012]*$//; # Hack to remove all "\r\n"s 242 265 debug_recv $line if $debug_raw; 266 # We record the time the last traffic from the server was seen, so we can 267 # autoping the server if needed. 243 268 $last_traffic = time; 244 269 … … 287 312 }, 288 313 314 # Handle pseudo events (runloop, loggedin) 289 315 handle_pseudo => -> Str $pseudo, *@args { 290 316 my $event = {
