-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchannotify.pl
57 lines (47 loc) · 1.17 KB
/
channotify.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
44
45
46
47
48
49
50
51
52
53
54
55
56
use warnings;
use strict;
use Irssi;
use vars qw($VERSION);
our $VERSION = 1.00;
use Data::Dumper;
use vars qw(%IRSSI);
%IRSSI = (
name => 'channotify',
authors => 'Isaac Good',
contact => 'irssi@isaacgood.com',
url => 'https://www.github.com/IsaacG',
license => 'Perl',
description => 'Filter notify list by people in a channel with you',
);
sub filter_notify
{
my @nicks = @_;
my (%on, %care);
for my $nick (@nicks)
{
$on{$nick} = 1
}
for my $notify (map {$_->{mask}} Irssi::Irc::notifies())
{
$care{$notify} = 1 if $on{$notify}
}
return keys %care;
}
sub cmd_channotify
{
my @nicks = filter_notify(map {$_->{nick}} (map {$_->nicks} Irssi::channels()));
Irssi::print("People on your channels: " . join ", ", @nicks);
}
sub cmd_actchan
{
my $active = Irssi::active_win()->{active};
if (ref $active ne 'Irssi::Irc::Channel')
{
Irssi::print("Active item is not a channel");
return;
}
my @nicks = filter_notify(map {$_->{nick}} $active->nicks);
Irssi::print("People on your active channel: " . join ", ", @nicks);
}
Irssi::command_bind("channotify", "cmd_channotify");
Irssi::command_bind("actchan", "cmd_actchan");