summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/slack_complete.pl14
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/^@//;