antifuck.pl: show forcepart reason

This commit is contained in:
wowaname 2017-03-31 04:24:18 +00:00
parent 6506f323ae
commit 68dd36f20e

View File

@ -106,7 +106,7 @@ sub servchan
sub reset_gc sub reset_gc
{ {
weechat::unhook($gc_cb) if $gc_cb; 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', ''); 'run_gc', '');
} }
@ -230,16 +230,16 @@ sub irc_001
sub irc_join sub irc_join
{ {
my ($server, $message, $msghash) = (lc $_[2], $_[3], ircparse($_[3])); 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"); my $buffer = ircbuf("$server.$channel");
return $message if exists $channels{$server}{$channel};
if (exists $zombie{$server}{$channel} || ignored($server)) { if (exists $zombie{$server}{$channel} || ignored($server)) {
delete $zombie{$server}{$channel}; delete $zombie{$server}{$channel};
$channels{$server}{$channel} = 1; $channels{$server}{$channel} = 1;
return $message; return $message;
} }
# XXX return $message unless mynick($buffer, $nick); # XXX return $message unless mynick($buffer, $nick);
return $message if exists $channels{$server}{$channel};
$part{$server}{$channel} = 1; $part{$server}{$channel} = 1;
$timeout_cb = weechat::hook_timer( $timeout_cb = weechat::hook_timer(
@ -258,8 +258,7 @@ sub irc_join
weechat::print($fuckbuf, weechat::prefix('join'). weechat::print($fuckbuf, weechat::prefix('join').
weechat::color('irc.color.message_join'). weechat::color('irc.color.message_join').
'You were forced to join '.weechat::color('chat_channel').$channel. 'You were forced to join '.weechat::color('chat_channel').$channel.
weechat::color('reset').weechat::color('irc.color.message_join'). weechat::color('irc.color.message_join').', leaving');
', leaving');
return ''; return '';
} }
@ -329,7 +328,7 @@ sub run_gc
sub irc_part sub irc_part
{ {
my ($server, $message) = ($_[2], $_[3]); my ($server, $message, $msghash) = ($_[2], $_[3], ircparse($_[3]));
my ($arj, $arj_delay, $arjd, $arjd_delay) = ( my ($arj, $arj_delay, $arjd, $arjd_delay) = (
weechat::config_get("irc.server.$server.autorejoin"), weechat::config_get("irc.server.$server.autorejoin"),
weechat::config_get("irc.server.$server.autorejoin_delay"), weechat::config_get("irc.server.$server.autorejoin_delay"),
@ -342,7 +341,9 @@ sub irc_part
weechat::config_boolean($arj) 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 $buffer = ircbuf("$server.$channel");
my ($lserver, $lchannel) = (lc $server, lc $channel); my ($lserver, $lchannel) = (lc $server, lc $channel);
@ -353,8 +354,9 @@ sub irc_part
weechat::print($buffer, weechat::prefix('quit'). weechat::print($buffer, weechat::prefix('quit').
weechat::color('irc.color.message_quit'). weechat::color('irc.color.message_quit').
'You were forced to part '.weechat::color('chat_channel').$channel. 'You were forced to part '.weechat::color('chat_channel').$channel.
weechat::color('reset').weechat::color('irc.color.message_quit'). weechat::color('chat_delimiters').' ('.weechat::color('reset').
', rejoining'); $reason.weechat::color('chat_delimiters').')'.
weechat::color('irc.color.message_quit').', rejoining');
my $delay = ( my $delay = (
weechat::config_option_is_null($arj_delay) ? weechat::config_option_is_null($arj_delay) ?
weechat::config_integer($arjd_delay) : weechat::config_integer($arjd_delay) :