-
Notifications
You must be signed in to change notification settings - Fork 1
/
lessact.pl
63 lines (47 loc) · 1.37 KB
/
lessact.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
57
58
59
60
61
62
63
#!/usr/bin/perl -w
# less activity magic
#<scriptinfo>
use vars qw($VERSION %IRSSI);
use Irssi 20020120;
$VERSION = "0.2";
%IRSSI = (
authors => "Rodney Dawes",
contact => "dobey@gnome.org",
name => "Only show high level activity changes",
description => "Ignores low level activity status",
license => "Public Domain",
url => "http://wayofthemonkey.com/lessact.pl",
changed => "Fri Jan 02 14:20:00 EST 2009",
);
#</scriptinfo>
my %line=();
# Doesn't show activity change for certain messages.
# List as many as ya want.
my @ignores = (
'^MSG #channel nick regex_matching_message'
);
sub window_activity() {
my ($item, $oldstatus) = @_;
my $level = $item->{data_level};
my $chan = $item->{active}->{name};
return if ($level <= $oldstatus);
foreach my $ignore (@ignores)
{
if($line->{$chan}=~/($ignore)/)
{
Irssi::signal_emit("window dehilight", $item);
}
}
Irssi::signal_emit("window dehilight", $item) if ($level < 2)
}
sub sig_public {
my ($server, $msg, $nick, $address, $target) = @_;
$line->{$target}="MSG $target $nick $msg";
}
sub sig_public_act {
my ($server, $msg, $nick, $address, $target) = @_;
$line->{$target}="ACT $target $nick $msg";
}
Irssi::signal_add_first("window activity", \&window_activity);
Irssi::signal_add_first("message public", 'sig_public');
Irssi::signal_add_first("message irc action", 'sig_public');