Changeset 09bd74c for perl/modules/IRC/lib/BarnOwl
- Timestamp:
- Apr 3, 2011, 3:06:01 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- 59425a3
- Parents:
- 249bbbe
- git-author:
- Nelson Elhage <nelhage@mit.edu> (02/26/11 20:32:10)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
r249bbbe r09bd74c 17 17 18 18 use AnyEvent::IRC::Client; 19 use AnyEvent::IRC::Util qw(split_prefix prefix_nick );19 use AnyEvent::IRC::Util qw(split_prefix prefix_nick encode_ctcp); 20 20 21 21 use base qw(Class::Accessor); … … 92 92 irc_403 => on("nosuch"), 93 93 nick_change => on("nick"), 94 ctcp_action => on("ctcp_action"), 94 95 'irc_*' => sub { BarnOwl::debug("IRC: " . $_[1]->{command}) }); 95 96 … … 106 107 my $self = shift; 107 108 return $self->conn->socket; 109 } 110 111 sub me { 112 my ($self, $to, $msg) = @_; 113 $self->conn->send_msg('privmsg', $to, 114 encode_ctcp(['ACTION', $msg])) 108 115 } 109 116 … … 130 137 my ($self, $recipient, $evt) = @_; 131 138 my $body = strip_irc_formatting($evt->{params}->[1]); 132 139 $self->handle_message($recipient, $evt, $body); 140 } 141 142 sub on_ctcp_action { 143 my ($self, $src, $target, $msg) = @_; 144 my $body = strip_irc_formatting($msg); 145 my $evt = { 146 params => [$src], 147 type => 'privmsg', 148 prefix => $src 149 }; 150 $self->handle_message($target, $evt, "* $body"); 151 } 152 153 sub handle_message { 154 my ($self, $recipient, $evt, $body) = @_; 133 155 my $msg = $self->new_message($evt, 134 156 direction => 'in', … … 147 169 } 148 170 171 149 172 sub on_admin_msg { 150 173 my ($self, $evt) = @_;
Note: See TracChangeset
for help on using the changeset viewer.