diff options
| author | ailin-nemui | 2015-11-10 11:41:56 +0100 |
|---|---|---|
| committer | ailin-nemui | 2015-11-10 11:41:56 +0100 |
| commit | 5ce20fdd409ed1e052e33f3612268e3e31dc7778 (patch) | |
| tree | 9e7d9a887d25b0658b6bfc5c9721803554d43e31 | |
| parent | 71f0010c4f11dfe1c3cd074a6ef1aa05e8c763e7 (diff) | |
| parent | c7f3264babc100d0ba819e9daeb4f69cd6183a25 (diff) | |
| download | scripts.irssi.org-5ce20fdd409ed1e052e33f3612268e3e31dc7778.tar.bz2 | |
Merge pull request #171 from xkr47/patch-1
Update slack_complete.pl, fixes #166
| -rw-r--r-- | scripts/slack_complete.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/slack_complete.pl b/scripts/slack_complete.pl index c4b0443..37179fd 100644 --- a/scripts/slack_complete.pl +++ b/scripts/slack_complete.pl @@ -2,6 +2,10 @@ # Copyright (C) 2015 by Morten Lied Johansen <mortenjo@ifi.uio.no> # +# Version history: +# 1.1: - Added support for multiple networks: /set slack_network slack flowdock gitter +# or all networks: /set slack_network * + use strict; use Irssi; @@ -10,13 +14,13 @@ use Irssi::Irc; # ======[ Script Header ]=============================================== use vars qw{$VERSION %IRSSI}; -($VERSION) = '$Revision: 1.0 $' =~ / (\d+\.\d+) /; +($VERSION) = '$Revision: 1.1 $' =~ / (\d+\.\d+) /; %IRSSI = ( name => 'slack_complete', - authors => 'Morten Lied Johansen', + authors => 'Morten Lied Johansen, Jonas Berlin', contact => 'mortenjo@ifi.uio.no', license => 'GPL', - description => 'Convert to slack-mention when completing nicks', + description => 'Prefix nicks with @ when completing nicks to match conventions on networks like Slack, Flowdock, Gitter etc', ); # ======[ Hooks ]======================================================= @@ -28,8 +32,8 @@ my ($complist, $window, $word, $linestart, $want_space) = @_; my $wi = Irssi::active_win()->{active}; return unless ref $wi and $wi->{type} eq 'CHANNEL'; - return unless $wi->{server}->{chatnet} eq - Irssi::settings_get_str('slack_network'); + my %chatnets = map { $_ => 1 } split(/\s+/, Irssi::settings_get_str('slack_network')); + return unless exists $chatnets{'*'} || exists $chatnets{$wi->{server}->{chatnet}}; if ($word =~ /^@/) { $word =~ s/^@//; |
