Skip to content

Commit

Permalink
Ignore hilights and messages from own nick, requested by @hilli
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbrixandersen committed May 4, 2012
1 parent 3d66aa1 commit b139dd5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -98,7 +98,8 @@ the ``/prowl`` command, use the following settings:
/format prowl_event_cmd Remember
/save

For the first two, ``$0`` will be replaced with the respective nick or channel.
For the first two, ``$0`` will be replaced with the respective channel
and ``$1`` will be replaced with the nick.

The format of the URLs passed to Prowl for private messages and
hilights can be controlled with the following settings:
Expand Down
27 changes: 18 additions & 9 deletions prowl.pl
Expand Up @@ -69,9 +69,9 @@
# Theme
Irssi::theme_register([
'prowl_event_cmd', 'Manual Message',
# $0 = channel/nick
'prowl_event_msgs', 'Private Message from $0',
'prowl_event_hilight', 'Hilighted in $0',
# $0 = channel, $1 = nick
'prowl_event_msgs', 'Private Message from $1',
'prowl_event_hilight', 'Hilighted in $0 by $1',
# $0 = irc/ircs, $1 = server address, $2 = chatnet, $3 = server port, $4 = channel/nick
'prowl_url_msgs', '$0://$1:$3/',
'prowl_url_hilight', '$0://$1:$3/$4',
Expand Down Expand Up @@ -161,12 +161,21 @@ sub print_text_handler {
my $level = $dest->{level};

if (($level & MSGLEVEL_MSGS) || ($level & MSGLEVEL_HILIGHT && !($level & MSGLEVEL_NOHILIGHT))) {
my $type = ($level & MSGLEVEL_MSGS) ? 'msgs' : 'hilight';
my $url = _create_url($server, $target, "prowl_url_$type");
my $format = Irssi::current_theme()->get_format('Irssi::Script::prowl', "prowl_event_$type");
my $event = Irssi::parse_special($format, $target);

_prowl($event, $stripped, $config{"priority_$type"}, $url);
my $nick = $stripped;
if ($level & MSGLEVEL_ACTIONS) {
$nick =~ s/^\s+.\s+(\S+)\s.*/$1/;
} else {
$nick =~ s/^\<[@\+% ]?([^\>]+)\>.*/$1/;
}

unless ($server->{nick} eq $nick) {
my $type = ($level & MSGLEVEL_MSGS) ? 'msgs' : 'hilight';
my $url = _create_url($server, $target, "prowl_url_$type");
my $format = Irssi::current_theme()->get_format('Irssi::Script::prowl', "prowl_event_$type");
my $event = Irssi::parse_special($format, "$target $nick");

_prowl($event, $stripped, $config{"priority_$type"}, $url);
}
}
}
}
Expand Down

0 comments on commit b139dd5

Please sign in to comment.