antifuck.pl: clean up source
This commit is contained in:
parent
e00dfa8492
commit
8bce1075ba
@ -50,26 +50,23 @@ HELP
|
||||
}
|
||||
}
|
||||
|
||||
sub mynick {
|
||||
sub mynick
|
||||
{
|
||||
my ($buf, $nick) = ($_[0], $_[1]);
|
||||
|
||||
return lc weechat::buffer_get_string($buf, 'localvar_nick') eq lc $nick;
|
||||
# my $hd_serv = weechat::hdata_get('irc_server');
|
||||
# my $hd_servs = weechat::hdata_get_list($hd_serv, 'irc_servers');
|
||||
#
|
||||
# $hd_serv = weechat::hdata_search(
|
||||
# $hd_serv, $hd_servs, '${irc_server.name} == '.
|
||||
# weechat::buffer_get_string($buf, 'localvar_server'), 1);
|
||||
#
|
||||
# return lc weechat::hdata_string($hd_serv, $buf, 'nick') eq lc $nick;
|
||||
}
|
||||
|
||||
sub servchan {
|
||||
sub servchan
|
||||
{
|
||||
my $buf = shift;
|
||||
|
||||
return (lc weechat::buffer_get_string($buf, 'localvar_server'),
|
||||
lc weechat::buffer_get_string($buf, 'localvar_channel'));
|
||||
}
|
||||
|
||||
sub cmd_antifuck {
|
||||
sub cmd_antifuck
|
||||
{
|
||||
my (undef, $buffer, $args) = @_;
|
||||
|
||||
if ($args eq 'part') {
|
||||
@ -81,37 +78,46 @@ sub cmd_antifuck {
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub fuckbuf_input {
|
||||
sub fuckbuf_input
|
||||
{
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub fuckbuf_close {
|
||||
$fuckbuf = '';
|
||||
sub fuckbuf_close
|
||||
{
|
||||
weechat::buffer_close($_) for (keys %partbuf);
|
||||
%partbuf = ();
|
||||
$fuckbuf = '';
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub irc_connect {
|
||||
sub irc_connect
|
||||
{
|
||||
my $server = pop;
|
||||
my ($autojoin) = (weechat::config_string(weechat::config_get(
|
||||
"irc.server.$server.autojoin")) =~ /^([^ ]*)/);
|
||||
|
||||
$channels{$server}{$_} = 1 for (split ',', lc($autojoin));
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub irc_disconnect {
|
||||
sub irc_disconnect
|
||||
{
|
||||
my $server = pop;
|
||||
|
||||
$server = lc $server;
|
||||
delete $channels{$server};
|
||||
delete $part{$server};
|
||||
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub buffer_opened {
|
||||
my $buffer = pop;
|
||||
|
||||
my ($server, $channel) = servchan($buffer);
|
||||
|
||||
return weechat::WEECHAT_RC_OK if exists $channels{$server}{$channel};
|
||||
|
||||
$fuckbuf = weechat::buffer_new(
|
||||
@ -136,7 +142,8 @@ sub buffer_closed {
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub client_join {
|
||||
sub client_join
|
||||
{
|
||||
my (undef, $server, $channel) = (shift,
|
||||
shift =~ /(.+),irc_out1_join/i,
|
||||
shift =~ /^join :?([^ ]*)/i);
|
||||
@ -146,7 +153,8 @@ sub client_join {
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub client_part {
|
||||
sub client_part
|
||||
{
|
||||
my (undef, $server, $channel) = (shift,
|
||||
shift =~ /(.+),irc_out1_part/i,
|
||||
shift =~ /^part ([^ ]*)/i);
|
||||
@ -156,7 +164,8 @@ sub client_part {
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub irc_366 {
|
||||
sub irc_366
|
||||
{
|
||||
my ($server, $message) = ($_[2], $_[3]);
|
||||
my ($nick, $channel) = $message =~ /^:[^ ]* 366 ([^ ]*) ([^ ]*)/i;
|
||||
my $buffer = weechat::buffer_search('irc', "$server.$channel");
|
||||
@ -178,7 +187,8 @@ sub irc_366 {
|
||||
return '';
|
||||
}
|
||||
|
||||
sub irc_join_delay {
|
||||
sub irc_join_delay
|
||||
{
|
||||
my $buffer = shift;
|
||||
|
||||
for my $server (values %part) {
|
||||
@ -206,7 +216,8 @@ sub irc_join_delay {
|
||||
return weechat::WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
sub irc_part {
|
||||
sub irc_part
|
||||
{
|
||||
my ($server, $message) = ($_[2], $_[3]);
|
||||
my ($arj, $arj_delay, $arjd, $arjd_delay) = (
|
||||
weechat::config_get("irc.server.$server.autorejoin"),
|
||||
|
Loading…
Reference in New Issue
Block a user