summaryrefslogtreecommitdiffstats
path: root/scripts/ircops.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
commit03929dac2a29664878d2c971648a4fe1fb698462 (patch)
tree02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/ircops.pl
parentInitial commit. (diff)
downloadirssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.tar.xz
irssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.zip
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--scripts/ircops.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/ircops.pl b/scripts/ircops.pl
new file mode 100644
index 0000000..96e25be
--- /dev/null
+++ b/scripts/ircops.pl
@@ -0,0 +1,44 @@
+use Irssi;
+use strict;
+
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "0.1";
+%IRSSI = (
+ authors => 'BC-bd',
+ contact => 'bd@bc-bd.org',
+ name => 'ircops',
+ description => '/IRCOPS - Display IrcOps in current channel',
+ license => 'GPL v2',
+ url => 'https://bc-bd.org/svn/repos/irssi/trunk/',
+);
+
+sub cmd_ircops {
+ my ($data, $server, $channel) = @_;
+
+ my (@list,$text,$num);
+
+ if (!$channel || $channel->{type} ne 'CHANNEL') {
+ Irssi::print('No active channel in window');
+ return;
+ }
+
+ foreach my $nick ($channel->nicks()) {
+ if ($nick->{serverop}) {
+ push(@list,$nick->{nick});
+ }
+ }
+
+ $num = scalar @list;
+
+ if ($num == 0) {
+ $text = "no IrcOps on this channel";
+ } else {
+ $text = "IrcOps (".$num."): ".join(" ",@list);
+ }
+
+ $channel->print($text);
+}
+
+Irssi::command_bind('ircops', 'cmd_ircops');
+