Changeset bc0d7bc for perl/modules
- Timestamp:
- Jan 10, 2008, 12:32:44 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:
- b10f340
- Parents:
- 2fb58e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r47b6a5f rbc0d7bc 16 16 17 17 use base qw(Net::IRC::Connection Class::Accessor Exporter); 18 __PACKAGE__->mk_accessors(qw(alias channels ));18 __PACKAGE__->mk_accessors(qw(alias channels motd)); 19 19 our @EXPORT_OK = qw(&is_private); 20 20 … … 29 29 $self->alias($alias); 30 30 $self->channels([]); 31 $self->motd(""); 31 32 bless($self, $class); 32 33 … … 34 35 $self->add_global_handler(['msg', 'notice', 'public', 'caction'], 35 36 sub { goto &on_msg }); 37 $self->add_global_handler(['welcome', 'yourhost', 'created', 38 'luserclient', 'luserop', 'luserchannels', 'luserme'], 39 sub { goto &on_admin_msg }); 40 $self->add_global_handler(['myinfo', 'map', 'n_local', 'n_global', 41 'luserconns'], 42 sub { }); 43 $self->add_handler(375 => sub { goto &on_motdstart }); 44 $self->add_handler(372 => sub { goto &on_motd }); 45 $self->add_handler(376 => sub { goto &on_endofmotd }); 36 46 $self->add_global_handler(cping => sub { goto &on_ping }); 37 47 $self->add_global_handler(join => sub { goto &on_join }); … … 69 79 my ($recipient) = $evt->to; 70 80 my $body = strip_irc_formatting([$evt->args]->[0]); 81 my $nick = $self->nick; 82 BarnOwl::beep() if $body =~ /\b\Q$nick\E\b/; 71 83 $body = BarnOwl::Style::boldify($evt->nick.' '.$body) if $evt->type eq 'caction'; 72 84 my $msg = $self->new_message($evt, … … 89 101 my ($self, $evt) = @_; 90 102 $self->ctcp_reply($evt->nick, join (' ', ($evt->args))); 103 } 104 105 sub on_admin_msg { 106 my ($self, $evt) = @_; 107 BarnOwl::admin_message("IRC", 108 BarnOwl::Style::boldify('IRC ' . $evt->type . ' message from ' 109 . $evt->alias) . "\n" 110 . strip_irc_formatting(join '\n', cdr $evt->args)); 111 } 112 113 sub on_motdstart { 114 my ($self, $evt) = @_; 115 $self->motd(join "\n", cdr $evt->args); 116 } 117 118 sub on_motd { 119 my ($self, $evt) = @_; 120 $self->motd(join "\n", $self->motd, cdr $evt->args); 121 } 122 123 sub on_endofmotd { 124 my ($self, $evt) = @_; 125 $self->motd(join "\n", $self->motd, cdr $evt->args); 126 BarnOwl::admin_message("IRC", 127 BarnOwl::Style::boldify('MOTD for ' . $evt->alias) . "\n" 128 . strip_irc_formatting($self->motd)); 91 129 } 92 130 … … 138 176 } 139 177 178 sub cdr { 179 shift; 180 return @_; 181 } 182 140 183 1;
Note: See TracChangeset
for help on using the changeset viewer.