Skip to content

Commit

Permalink
Merge pull request #860 from ailin-nemui/no_opmsg
Browse files Browse the repository at this point in the history
[no_opmsg] new script
  • Loading branch information
ailin-nemui authored Nov 28, 2023
2 parents 31d3fce + e63e66d commit 50dffed
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions scripts/no_opmsg.pl
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');

0 comments on commit 50dffed

Please sign in to comment.