-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
turn wallchops messages into regular channel messages
- Loading branch information
1 parent
34f6c9a
commit e63e66d
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use strict; | ||
use warnings; | ||
use experimental 'signatures'; | ||
use Irssi; | ||
|
||
our $VERSION = '0.1'; # 533b021b83d26b0 | ||
our %IRSSI = ( | ||
authors => 'Nei', | ||
contact => 'Nei @ [email protected]', | ||
url => "http://anti.teamidiot.de/", | ||
name => 'no_opmsg', | ||
description => 'Kill incoming op messages.', | ||
license => 'ISC', | ||
); | ||
|
||
our ($op_message); | ||
sub expando_op_message { | ||
$op_message // '' | ||
} | ||
|
||
sub sig_event_op_public ($server, $recoded, $nick, $addr, $target) { | ||
my $statusmsg = $server->isupport('statusmsg') // '@'; | ||
my $st = "[\Q$statusmsg\E]"; | ||
$target =~ s/^(($st)+)//; | ||
local $op_message = $1; | ||
if ($target =~ /^!/) { | ||
my $ch_obj = $server->channel_find($target); | ||
$target = $ch_obj->{visible_name} if $ch_obj; | ||
} | ||
Irssi::signal_stop; | ||
Irssi::signal_emit('message public', $server, $recoded, $nick, $addr, $target); | ||
} | ||
|
||
Irssi::expando_create('op_message' => \&expando_op_message, { 'event privmsg' => 'none' }); | ||
Irssi::signal_add_first('message irc op_public' => 'sig_event_op_public'); |