Changeset 3baf77f for perl/modules
- Timestamp:
- Jan 13, 2008, 6:10:44 PM (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:
- e4db5ae
- Parents:
- 1fd5041b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r9e02bb7 r3baf77f 16 16 17 17 use base qw(Net::IRC::Connection Class::Accessor Exporter); 18 __PACKAGE__->mk_accessors(qw(alias channels motd));18 __PACKAGE__->mk_accessors(qw(alias channels connected _motd)); 19 19 our @EXPORT_OK = qw(&is_private); 20 20 … … 29 29 $self->alias($alias); 30 30 $self->channels([]); 31 $self->motd(""); 31 $self->_motd(""); 32 $self->connected(0); 32 33 bless($self, $class); 33 34 34 35 $self->add_default_handler(sub { goto &on_event; }); 35 $self->add_handler(376 => sub { goto &on_connect });36 36 $self->add_handler(['msg', 'notice', 'public', 'caction'], 37 37 sub { goto &on_msg }); … … 57 57 ############################### IRC callbacks ################################## 58 58 ################################################################################ 59 60 sub on_connect {61 my ($self, $evt) = @_;62 BarnOwl::admin_message("IRC", "Connected to " . $self->server . " (" . $self->alias . ")");63 }64 59 65 60 sub new_message { … … 115 110 sub on_motdstart { 116 111 my ($self, $evt) = @_; 117 $self-> motd(join "\n", cdr $evt->args);112 $self->_motd(join "\n", cdr $evt->args); 118 113 } 119 114 120 115 sub on_motd { 121 116 my ($self, $evt) = @_; 122 $self-> motd(join "\n", $self->motd, cdr $evt->args);117 $self->_motd(join "\n", $self->_motd, cdr $evt->args); 123 118 } 124 119 125 120 sub on_endofmotd { 126 121 my ($self, $evt) = @_; 127 $self->motd(join "\n", $self->motd, cdr $evt->args); 128 BarnOwl::admin_message("IRC", 129 BarnOwl::Style::boldify('MOTD for ' . $evt->alias) . "\n" 130 . strip_irc_formatting($self->motd)); 122 $self->_motd(join "\n", $self->_motd, cdr $evt->args); 123 if(!$self->connected) { 124 BarnOwl::admin_message("IRC", "Connected to " . 125 $self->server . " (" . $self->alias . ")"); 126 $self->connected(1); 127 128 } 129 BarnOwl::admin_message("IRC", 130 BarnOwl::Style::boldify('MOTD for ' . $self->alias) . "\n" 131 . strip_irc_formatting($self->_motd)); 131 132 } 132 133
Note: See TracChangeset
for help on using the changeset viewer.