Changeset d264c6d for perl/modules/IRC
- Timestamp:
- Jul 24, 2008, 1:55:35 AM (16 years ago)
- Branches:
- master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 4789b17
- Parents:
- 38cfdb5d
- Location:
- perl/modules/IRC/lib/BarnOwl/Module
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r3ad15ff rd264c6d 263 263 my $conn = get_connection(\@_); 264 264 my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n"); 265 $conn->names_tmp([]); 265 266 $conn->conn->names($chan); 266 267 } -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r38cfdb5d rd264c6d 45 45 $self->motd(""); 46 46 $self->connected(0); 47 $self->names_tmp( []);47 $self->names_tmp(0); 48 48 $self->whois_tmp(""); 49 49 … … 71 71 $self->conn->add_handler(namreply => sub { shift; $self->on_namreply(@_) }); 72 72 $self->conn->add_handler(endofnames=> sub { shift; $self->on_endofnames(@_) }); 73 $self->conn->add_handler(endofwhois=> sub { shift; $self->on_endofwhois(@_) }); 73 74 74 75 return $self; … … 132 133 BarnOwl::Style::boldify('IRC ' . $evt->type . ' message from ' 133 134 . $self->alias) . "\n" 134 . strip_irc_formatting(join ' \n', $evt->args));135 . strip_irc_formatting(join ' ', cdr($evt->args))); 135 136 } 136 137 … … 164 165 loginout => 'login', 165 166 channel => $evt->to, 166 replycmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick,167 replycmd => 'irc-msg -a ' . $self->alias . ' ' . join(' ', $evt->to), 167 168 replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick 168 169 ); … … 175 176 loginout => 'logout', 176 177 channel => $evt->to, 177 replycmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick,178 replycmd => 'irc-msg -a ' . $self->alias . ' ' . join(' ', $evt->to), 178 179 replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick 179 180 ); … … 218 219 } 219 220 221 # IRC gives us a bunch of namreply messages, followed by an endofnames. 222 # We need to collect them from the namreply and wait for the endofnames message. 223 # After this happens, the names_tmp variable is cleared. 224 225 sub on_namreply { 226 my ($self, $evt) = @_; 227 return unless $self->names_tmp; 228 $self->names_tmp([@{$self->names_tmp}, split(' ', [$evt->args]->[3])]); 229 } 230 231 sub on_endofnames { 232 my ($self, $evt) = @_; 233 return unless $self->names_tmp; 234 my $names = BarnOwl::Style::boldify("Members of " . [$evt->args]->[1] . ":\n"); 235 for my $name (@{$self->names_tmp}) { 236 $names .= " $name\n"; 237 } 238 BarnOwl::popless_ztext($names); 239 $self->names_tmp(0); 240 } 241 242 sub on_whois { 243 my ($self, $evt) = @_; 244 $self->whois_tmp( 245 $self->whois_tmp . "\n" . $evt->type . ":\n " . 246 join("\n ", cdr(cdr($evt->args))) . "\n" 247 ); 248 } 249 250 sub on_endofwhois { 251 my ($self, $evt) = @_; 252 BarnOwl::popless_ztext( 253 BarnOwl::Style::boldify("/whois for " . [$evt->args]->[1] . ":\n") . 254 $self->whois_tmp 255 ); 256 $self->whois_tmp([]); 257 } 258 220 259 sub on_event { 221 260 my ($self, $evt) = @_; 261 return on_whois(@_) if ($evt->type =~ /^whois/); 222 262 BarnOwl::admin_message("IRC", 223 263 "[" . $self->alias . "] Unhandled IRC event of type " . $evt->type . ":\n" 224 264 . strip_irc_formatting(join("\n", $evt->args))) 225 265 if BarnOwl::getvar('irc:spew') eq 'on'; 226 }227 228 # IRC gives us a bunch of namreply messages, followed by an endofnames.229 # We need to collect them from the namreply and wait for the endofnames message.230 # After this happens, the names_tmp variable is cleared.231 232 sub on_namreply {233 my ($self, $evt) = @_;234 $self->names_tmp([@{$self->names_tmp}, split(' ', [$evt->args]->[3])]);235 }236 237 sub on_endofnames {238 my ($self, $evt) = @_;239 my $names = BarnOwl::Style::boldify("Members of " . [$evt->args]->[1] . ":\n");240 for my $name (@{$self->names_tmp}) {241 $names .= " $name\n";242 }243 BarnOwl::popless_ztext($names);244 $self->names_tmp([]);245 266 } 246 267
Note: See TracChangeset
for help on using the changeset viewer.