Skip to content

Commit

Permalink
joinで既にjoinしているユーザー名と被ってしまっていた場合にhandleを上書きしてしまって、それ以降配信されなくなる問題に対応
Browse files Browse the repository at this point in the history
  • Loading branch information
walf443 committed Apr 21, 2011
1 parent 3fccbf7 commit b8efde9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/Carol/IRCGateway/Wassr.pm
Expand Up @@ -74,9 +74,12 @@ sub register_post_wassr {
daemon_privmsg => sub {
my ($irc, $nick, $chan, $text ) = @_;
if ( $chan eq $channel ) {
my $cv = AnyEvent->condvar;
$cv->begin;
$self->request_wassr(POST => '/statuses/update.json?source=carol_wig&status=' . URI::Escape::uri_escape($text) . '&id=' . $self->account->{login_id},
authorize => 1,
sub {
$cv->end;
});
}
},
Expand Down Expand Up @@ -107,14 +110,16 @@ sub publish_privmsg {
user => $status->{user_login_id},
servername => "wig"
);
$server->event(
join => +{
params => [
"$channel,",
],
},
$dummy_handle,
);
if ( $status->{user_login_id} ne $self->account->{login_id} ) {
$server->event(
join => +{
params => [
"$channel,",
],
},
$dummy_handle,
);
}
$server->daemon_cmd_privmsg($status->{user_login_id}, $channel, $self->status2irc_message($status));
debugf(sprintf("send privmsg: %s %s", $status->{user_login_id}, $status->{text}));
},
Expand Down
2 changes: 2 additions & 0 deletions scripts/carol.pl
@@ -1,6 +1,8 @@
#!perl
use strict;
use warnings;
use AnyEvent;
use AnyEvent::Impl::Event;
use AnyEvent::IRC::Server;
use opts;
use Filesys::Notify::Simple;
Expand Down

0 comments on commit b8efde9

Please sign in to comment.