Skip to content

Commit

Permalink
微調整
Browse files Browse the repository at this point in the history
  • Loading branch information
walf443 committed Apr 3, 2011
1 parent 092c0be commit ea45fb6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/Carol/IRCGateway/Wassr.pm
Expand Up @@ -9,6 +9,9 @@ use Class::Accessor::Lite (
use AnyEvent;
use AnyEvent::HTTP;
use Log::Minimal qw(debugf infof warnf critf );
use Cache::LRU;
use JSON::XS;
use Encode;

sub start {
my ($self, ) = @_;
Expand Down Expand Up @@ -69,7 +72,7 @@ sub publish_privmsg {
},
$dummy_handle,
);
$server->daemon_cmd_privmsg($status->{user_login_id}, "#tig", status2irc_message($status));
$server->daemon_cmd_privmsg($status->{user_login_id}, "#tig", $self->status2irc_message($status));
debugf(sprintf("send privmsg: %s %s", $status->{user_login_id}, $status->{text}));
},
);
Expand All @@ -78,6 +81,14 @@ sub publish_privmsg {
};
}

sub status2irc_message {
my ($self, $status) = @_;

my $msg = "";
$msg .= $status->{text};
return Encode::encode_utf8($msg);
}

1;

__END__
Expand All @@ -90,7 +101,7 @@ Carol -
use AnyEvent;
use AnyEvent::IRC::Server;
use Carol::IRCGateway::Wig;
use Carol::IRCGateway::Wassr;
my $cv = AnyEvent->condvar;
my $server = AnyEvent::IRC::Server->new(port => 16667);
$server->run;
Expand Down

0 comments on commit ea45fb6

Please sign in to comment.