Changeset 38cfdb5d for perl/modules/IRC/lib/BarnOwl
- Timestamp:
- Jul 23, 2008, 9:05:18 PM (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:
- d264c6d
- Parents:
- 3ad15ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r3ad15ff r38cfdb5d 18 18 19 19 use base qw(Class::Accessor Exporter); 20 __PACKAGE__->mk_accessors(qw(conn alias channels connected motd ));20 __PACKAGE__->mk_accessors(qw(conn alias channels connected motd names_tmp whois_tmp)); 21 21 our @EXPORT_OK = qw(&is_private); 22 22 … … 45 45 $self->motd(""); 46 46 $self->connected(0); 47 $self->names_tmp([]); 48 $self->whois_tmp(""); 47 49 48 50 $self->conn->add_handler(376 => sub { shift; $self->on_connect(@_) }); … … 67 69 $self->conn->add_handler(topic => sub { shift; $self->on_topic(@_) }); 68 70 $self->conn->add_handler(topicinfo => sub { shift; $self->on_topicinfo(@_) }); 71 $self->conn->add_handler(namreply => sub { shift; $self->on_namreply(@_) }); 72 $self->conn->add_handler(endofnames=> sub { shift; $self->on_endofnames(@_) }); 69 73 70 74 return $self; … … 222 226 } 223 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 } 224 246 225 247 ################################################################################
Note: See TracChangeset
for help on using the changeset viewer.