-
Notifications
You must be signed in to change notification settings - Fork 235
/
ircops.pl
44 lines (33 loc) · 852 Bytes
/
ircops.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use Irssi;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "0.1";
%IRSSI = (
authors => 'BC-bd',
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');