- Timestamp:
- Jan 10, 2008, 12:12:52 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:
- 2fb58e4
- Parents:
- 6858d2d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r0e52069 r47b6a5f 35 35 sub { goto &on_msg }); 36 36 $self->add_global_handler(cping => sub { goto &on_ping }); 37 $self->add_global_handler(join => sub { goto &on_join }); 38 $self->add_global_handler(part => sub { goto &on_part }); 37 39 $self->add_default_handler(sub { goto &on_event; }); 38 40 … … 49 51 } 50 52 53 sub new_message { 54 my $self = shift; 55 my $evt = shift; 56 return BarnOwl::Message->new( 57 type => 'IRC', 58 server => $self->server, 59 network => $self->alias, 60 sender => $evt->nick, 61 hostname => $evt->host, 62 from => $evt->from, 63 @_ 64 ); 65 } 66 51 67 sub on_msg { 52 68 my ($self, $evt) = @_; … … 54 70 my $body = strip_irc_formatting([$evt->args]->[0]); 55 71 $body = BarnOwl::Style::boldify($evt->nick.' '.$body) if $evt->type eq 'caction'; 56 my $msg = BarnOwl::Message->new( 57 type => 'IRC', 72 my $msg = $self->new_message($evt, 58 73 direction => 'in', 59 server => $self->server,60 network => $self->alias,61 74 recipient => $recipient, 62 body => $body, 63 sender => $evt->nick, 64 hostname => $evt->host, 65 from => $evt->from, 75 body => $body, 66 76 $evt->type eq 'notice' ? 67 77 (notice => 'true') : (), … … 70 80 replycmd => 'irc-msg ' . 71 81 (is_private($recipient) ? $evt->nick : $recipient), 72 replysendercmd => 'irc-msg ' . $evt->nick ,82 replysendercmd => 'irc-msg ' . $evt->nick 73 83 ); 84 74 85 BarnOwl::queue_message($msg); 75 86 } … … 80 91 } 81 92 93 sub on_join { 94 my ($self, $evt) = @_; 95 my $msg = $self->new_message($evt, 96 loginout => 'login', 97 channel => $evt->to, 98 ); 99 BarnOwl::queue_message($msg); 100 } 101 102 sub on_part { 103 my ($self, $evt) = @_; 104 my $msg = $self->new_message($evt, 105 loginout => 'logout', 106 channel => $evt->to, 107 ); 108 BarnOwl::queue_message($msg); 109 } 110 82 111 sub on_event { 83 112 my ($self, $evt) = @_; 84 113 BarnOwl::admin_message("IRC", 85 " Unhandled IRC event of type " . $evt->type . ":\n"114 "[" . $self->alias . "] Unhandled IRC event of type " . $evt->type . ":\n" 86 115 . strip_irc_formatting(join("\n", $evt->args))) 87 116 if BarnOwl::getvar('irc:spew') eq 'on';
Note: See TracChangeset
for help on using the changeset viewer.