root/irc-yahoo/trunk/lib/Net/YahooMessenger/IRCGW/EventHandler.pm

Revision 537 (checked in by miyagawa, 18 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 package Net::YahooMessenger::IRCGW::EventHandler;
2 use strict;
3
4 use Net::YahooMessenger::EventHandler;
5 use base qw(Net::YahooMessenger::EventHandler);
6
7 use Jcode;
8 use Net::YahooMessenger::IRCGW;
9
10 sub gw { Net::YahooMessenger::IRCGW->instance }
11
12 sub ChangeState {
13     my($self, $event) = @_;
14     $self->gw->conn->me(
15         '#' . $event->from, Jcode->new($event->body, 'sjis')->jis,
16     );
17 }
18
19 sub GoesOnline {
20     my($self, $event) = @_;
21     $self->gw->join_channel($event->from, '[YM] Online');
22 }
23
24 sub GoesOffline {
25     my($self, $event) = @_;
26     $self->gw->part_channel($event->from);
27 }
28
29 sub ReceiveMessage {
30     my($self, $event) = @_;
31     my $msg = Jcode->new($event->body, 'sjis')->jis;
32     $msg =~ s/^<font.*?>//;
33     $self->gw->conn->privmsg('#' . $event->from, $_) for split /\n/, $msg;
34 }
35
36 1;
Note: See TracBrowser for help on using the browser.