parrot.pl: case insensitive buffer matching
This commit is contained in:
parent
603f9df8c3
commit
300b8c1b26
@ -28,6 +28,8 @@ sub servchan
|
|||||||
lc weechat::buffer_get_string($buffer, 'localvar_channel'));
|
lc weechat::buffer_get_string($buffer, 'localvar_channel'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub ircbuf { weechat::buffer_search('irc', "(?i)".(join '.', @_)) }
|
||||||
|
|
||||||
sub getgroup
|
sub getgroup
|
||||||
{
|
{
|
||||||
my ($server, $channel) = @_;
|
my ($server, $channel) = @_;
|
||||||
@ -121,7 +123,7 @@ sub irc_privmsg_notice
|
|||||||
for (getgroup($server, $channel)) {
|
for (getgroup($server, $channel)) {
|
||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
if ($message =~ /^\x01ACTION /i) {
|
if ($message =~ /^\x01ACTION /i) {
|
||||||
$message =~ s/^\x01ACTION |\x01$//g;
|
$message =~ s/^\x01ACTION |\x01$//g;
|
||||||
sendto($to_serv, "/msg $to_chan * \x02$nick\x0f $message");
|
sendto($to_serv, "/msg $to_chan * \x02$nick\x0f $message");
|
||||||
@ -145,7 +147,7 @@ sub ircout_privmsg_notice
|
|||||||
for (getgroup($server, $channel)) {
|
for (getgroup($server, $channel)) {
|
||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
my $prefix = lc $cmd eq 'notice' ? 'notice' : 'msg';
|
my $prefix = lc $cmd eq 'notice' ? 'notice' : 'msg';
|
||||||
if ($message =~ /^\x01ACTION /i) {
|
if ($message =~ /^\x01ACTION /i) {
|
||||||
$message =~ s/^\x01ACTION |\x01$//g;
|
$message =~ s/^\x01ACTION |\x01$//g;
|
||||||
@ -170,7 +172,7 @@ sub irc_join
|
|||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next unless $flags & $STAT;
|
next unless $flags & $STAT;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
sendto($to_serv, "/notice $to_chan \x02$nick\x0f$host joined $server/$channel\x0f");
|
sendto($to_serv, "/notice $to_chan \x02$nick\x0f$host joined $server/$channel\x0f");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +191,7 @@ sub irc_part
|
|||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next unless $flags & $STAT;
|
next unless $flags & $STAT;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
sendto($to_serv, "/notice $to_chan \x02$nick\x0f left $server/$channel\x0f: $message");
|
sendto($to_serv, "/notice $to_chan \x02$nick\x0f left $server/$channel\x0f: $message");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +210,7 @@ sub irc_kick
|
|||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next unless $flags & $STAT;
|
next unless $flags & $STAT;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
sendto($to_serv, "/notice $to_chan \x02$nick\x0f kicked $target\x0f from $server/$channel\x0f: $message");
|
sendto($to_serv, "/notice $to_chan \x02$nick\x0f kicked $target\x0f from $server/$channel\x0f: $message");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +231,7 @@ sub irc_nick
|
|||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next unless $flags & $STAT;
|
next unless $flags & $STAT;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
sendto($to_serv, "/notice $to_chan \x02$nick\x0f is now \x02$newnick\x0f");
|
sendto($to_serv, "/notice $to_chan \x02$nick\x0f is now \x02$newnick\x0f");
|
||||||
} }
|
} }
|
||||||
|
|
||||||
@ -250,7 +252,7 @@ sub irc_quit
|
|||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next unless $flags & $STAT;
|
next unless $flags & $STAT;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
sendto($to_serv, "/notice $to_chan \x02$nick\x0f left $server: $message");
|
sendto($to_serv, "/notice $to_chan \x02$nick\x0f left $server: $message");
|
||||||
} }
|
} }
|
||||||
|
|
||||||
@ -282,7 +284,7 @@ sub irc_topic
|
|||||||
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
my ($to_serv, $to_chan, $flags, undef) = @$_;
|
||||||
next unless $flags & $MODE;
|
next unless $flags & $MODE;
|
||||||
next if $flags & $READ;
|
next if $flags & $READ;
|
||||||
next unless weechat::buffer_search('irc', "$to_serv.$to_chan");
|
next unless ircbuf("$to_serv.$to_chan");
|
||||||
sendto($to_serv, "/topic $to_chan $message");
|
sendto($to_serv, "/topic $to_chan $message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user