diff --git a/scripts/antifuck.pl b/scripts/antifuck.pl index f83e853..e95259b 100644 --- a/scripts/antifuck.pl +++ b/scripts/antifuck.pl @@ -106,7 +106,7 @@ sub servchan sub reset_gc { weechat::unhook($gc_cb) if $gc_cb; - $gc_cb = weechat::hook_timer(weechat::config_get_plugin('nobufs'), 0, 1, + $gc_cb = weechat::hook_timer(weechat::config_get_plugin('timeout'), 0, 1, 'run_gc', ''); } @@ -230,16 +230,16 @@ sub irc_001 sub irc_join { my ($server, $message, $msghash) = (lc $_[2], $_[3], ircparse($_[3])); - my ($nick, $channel) = ($msghash->{nick}, $msghash->{channel}); + my ($nick, $channel) = ($msghash->{nick}, lc $msghash->{channel}); my $buffer = ircbuf("$server.$channel"); + return $message if exists $channels{$server}{$channel}; if (exists $zombie{$server}{$channel} || ignored($server)) { delete $zombie{$server}{$channel}; $channels{$server}{$channel} = 1; return $message; } # XXX return $message unless mynick($buffer, $nick); - return $message if exists $channels{$server}{$channel}; $part{$server}{$channel} = 1; $timeout_cb = weechat::hook_timer( @@ -258,8 +258,7 @@ sub irc_join weechat::print($fuckbuf, weechat::prefix('join'). weechat::color('irc.color.message_join'). 'You were forced to join '.weechat::color('chat_channel').$channel. - weechat::color('reset').weechat::color('irc.color.message_join'). - ', leaving'); + weechat::color('irc.color.message_join').', leaving'); return ''; } @@ -329,7 +328,7 @@ sub run_gc sub irc_part { - my ($server, $message) = ($_[2], $_[3]); + my ($server, $message, $msghash) = ($_[2], $_[3], ircparse($_[3])); my ($arj, $arj_delay, $arjd, $arjd_delay) = ( weechat::config_get("irc.server.$server.autorejoin"), weechat::config_get("irc.server.$server.autorejoin_delay"), @@ -342,7 +341,9 @@ sub irc_part weechat::config_boolean($arj) ); - my ($nick, $channel) = ($message =~ /^:([^!]*)[^ ]* part ([^ ]*)/i); + my ($nick, $channel, $reason) = ($msghash->{nick}, $msghash->{channel}, + $msghash->{text}); + my $buffer = ircbuf("$server.$channel"); my ($lserver, $lchannel) = (lc $server, lc $channel); @@ -353,8 +354,9 @@ sub irc_part weechat::print($buffer, weechat::prefix('quit'). weechat::color('irc.color.message_quit'). 'You were forced to part '.weechat::color('chat_channel').$channel. - weechat::color('reset').weechat::color('irc.color.message_quit'). - ', rejoining'); + weechat::color('chat_delimiters').' ('.weechat::color('reset'). + $reason.weechat::color('chat_delimiters').')'. + weechat::color('irc.color.message_quit').', rejoining'); my $delay = ( weechat::config_option_is_null($arj_delay) ? weechat::config_integer($arjd_delay) :