summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authortomaw2014-06-15 20:10:56 +0100
committertomaw2014-06-15 20:10:56 +0100
commit245df12b2ea87c3c22e41d54e6652574f122cb41 (patch)
tree2a1ebbb7c5dcc59c14c6d25fa26da4cf22c61285 /scripts
parent1777b5bab4b92f6eebd7269c2657ac824b61b067 (diff)
parente382d976193c20918e8c490db4ae575b7440c75b (diff)
downloadscripts.irssi.org-245df12b2ea87c3c22e41d54e6652574f122cb41.tar.bz2
Merge pull request #10 from dgl/dgl-scripts
Update dgl scripts
Diffstat (limited to 'scripts')
-rw-r--r--scripts/autolimit.pl2
-rw-r--r--scripts/clones.pl2
-rw-r--r--scripts/nickcolor.pl47
-rw-r--r--scripts/on.pl2
-rw-r--r--scripts/remote.pl2
-rw-r--r--scripts/servercomplete.pl2
-rw-r--r--scripts/sping.pl25
-rw-r--r--scripts/sysinfo_dg.pl2
-rw-r--r--scripts/title.pl8
-rw-r--r--scripts/urlgrab.pl2
-rw-r--r--scripts/usercount.pl24
11 files changed, 63 insertions, 55 deletions
diff --git a/scripts/autolimit.pl b/scripts/autolimit.pl
index 8989eed..3864bd1 100644
--- a/scripts/autolimit.pl
+++ b/scripts/autolimit.pl
@@ -6,7 +6,7 @@ $VERSION = "1.00";
name => 'autolimit',
description => 'does an autolimit for a channel, set variables in the script',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
# Change these!
diff --git a/scripts/clones.pl b/scripts/clones.pl
index 9e55a5f..84ba59f 100644
--- a/scripts/clones.pl
+++ b/scripts/clones.pl
@@ -5,7 +5,7 @@ $VERSION = "2.01";
name => 'clones',
description => '/CLONES - Display clones in the active channel (with added options)',
license => 'Same as Irssi',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
use strict;
diff --git a/scripts/nickcolor.pl b/scripts/nickcolor.pl
index 69f2936..54d3e7a 100644
--- a/scripts/nickcolor.pl
+++ b/scripts/nickcolor.pl
@@ -1,39 +1,32 @@
use strict;
use Irssi 20020101.0250 ();
use vars qw($VERSION %IRSSI);
-$VERSION = "1";
+$VERSION = "2";
%IRSSI = (
- authors => "Timo Sirainen, Ian Peters",
+ authors => "Timo Sirainen, Ian Peters, David Leadbeater",
contact => "tss\@iki.fi",
name => "Nick Color",
description => "assign a different color for each nick",
license => "Public Domain",
url => "http://irssi.org/",
- changed => "2002-03-04T22:47+0100"
+ changed => "Sun 15 Jun 19:10:44 BST 2014",
);
-# hm.. i should make it possible to use the existing one..
-Irssi::theme_register([
- 'pubmsg_hilight', '{pubmsghinick $0 $3 $1}$2'
-]);
+# Settings:
+# nickcolor_colors: List of color codes to use.
+# e.g. /set nickcolor_colors 2 3 4 5 6 7 9 10 11 12 13
+# (avoid 8, as used for hilights in the default theme).
my %saved_colors;
my %session_colors = {};
-my @colors = qw/2 3 4 5 6 7 9 10 11 12 13/;
sub load_colors {
- open COLORS, "$ENV{HOME}/.irssi/saved_colors";
-
- while (<COLORS>) {
- # I don't know why this is necessary only inside of irssi
- my @lines = split "\n";
- foreach my $line (@lines) {
- my($nick, $color) = split ":", $line;
- $saved_colors{$nick} = $color;
- }
+ open my $color_fh, "<", "$ENV{HOME}/.irssi/saved_colors";
+ while (<$color_fh>) {
+ chomp;
+ my($nick, $color) = split ":";
+ $saved_colors{$nick} = $color;
}
-
- close COLORS;
}
sub save_colors {
@@ -76,19 +69,14 @@ sub simple_hash {
$counter += ord $char;
}
- $counter = $colors[$counter % 11];
+ my @colors = split / /, Irssi::settings_get_str('nickcolor_colors');
+ $counter = $colors[$counter % @colors];
return $counter;
}
-# FIXME: breaks /HILIGHT etc.
sub sig_public {
my ($server, $msg, $nick, $address, $target) = @_;
- my $chanrec = $server->channel_find($target);
- return if not $chanrec;
- my $nickrec = $chanrec->nick_find($nick);
- return if not $nickrec;
- my $nickmode = $nickrec->{op} ? "@" : $nickrec->{voice} ? "+" : "";
# Has the user assigned this nick a color?
my $color = $saved_colors{$nick};
@@ -104,8 +92,8 @@ sub sig_public {
$session_colors{$nick} = $color;
}
- $color = "0".$color if ($color < 10);
- $server->command('/^format pubmsg {pubmsgnick $2 {pubnick '.chr(3).$color.'$0}}$1');
+ $color = sprintf "\003%02d", $color;
+ $server->command('/^format pubmsg {pubmsgnick $2 {pubnick ' . $color . '$0}}$1');
}
sub cmd_color {
@@ -115,7 +103,7 @@ sub cmd_color {
$op = lc $op;
if (!$op) {
- Irssi::print ("No operation given");
+ Irssi::print ("No operation given (save/set/clear/list/preview)");
} elsif ($op eq "save") {
save_colors;
} elsif ($op eq "set") {
@@ -150,6 +138,7 @@ sub cmd_color {
load_colors;
+Irssi::settings_add_str('misc', 'nickcolor_colors', '2 3 4 5 6 7 9 10 11 12 13');
Irssi::command_bind('color', 'cmd_color');
Irssi::signal_add('message public', 'sig_public');
diff --git a/scripts/on.pl b/scripts/on.pl
index cf37b5f..a66574c 100644
--- a/scripts/on.pl
+++ b/scripts/on.pl
@@ -6,7 +6,7 @@ $VERSION = "1.12";
name => 'on.pl',
description => '/on command - this is very simple and not really designed to be the same as ircII - it tries to fit into Irssi\'s usage style more than emulating ircII.',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
use strict;
diff --git a/scripts/remote.pl b/scripts/remote.pl
index 3557575..0eb794e 100644
--- a/scripts/remote.pl
+++ b/scripts/remote.pl
@@ -7,7 +7,7 @@ $VERSION = "1";
name => 'remote',
description => 'Lets you run commands remotely via /msg and a password',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
diff --git a/scripts/servercomplete.pl b/scripts/servercomplete.pl
index 4d92f96..2fe5b21 100644
--- a/scripts/servercomplete.pl
+++ b/scripts/servercomplete.pl
@@ -6,7 +6,7 @@ $VERSION = "2";
name => 'servercomplete',
description => 'Tab complete servers and userhosts (irc. -> irc server, user@ -> user@host). Useful for lazy ircops for /squit and so on :)',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
use strict;
diff --git a/scripts/sping.pl b/scripts/sping.pl
index 49d8d78..4842454 100644
--- a/scripts/sping.pl
+++ b/scripts/sping.pl
@@ -3,33 +3,38 @@ use Irssi::Irc;
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = "0.9";
+$VERSION = "1.0";
%IRSSI = (
- authors => "Maciek \'fahren\' Freudenheim",
+ authors => "Maciek \'fahren\' Freudenheim, David Leadbeater",
contact => "fahren\@bochnia.pl",
name => "Server Ping",
description => "/SPING [server] - checks latency between current server and [server]",
license => "GNU GPLv2 or later",
- changed => "Fri Mar 15 15:09:42 CET 2002"
+ changed => "Sun 15 Jun 18:56:52 BST 2014",
);
+# us. /SPING [server]
+
+use Time::HiRes qw(gettimeofday);
+
my %askping;
sub cmd_sping {
my ($target, $server, $winit) = @_;
-
+
$target = $server->{address} unless $target;
- $askping{$target} = time();
- $server->send_raw("PING $server->{address} $target");
+ $askping{$target} = gettimeofday();
+ # using nickname rather than server seems to work better here
+ $server->send_raw("PING $server->{nick} $target");
}
sub event_pong {
my ($server, $args, $sname) = @_;
-
- Irssi::signal_stop() if ($askping{$sname});
+ return unless exists $askping{$sname};
- Irssi::print(">> $sname latency: " . (time() - $askping{$sname}) . "s");
- undef $askping{$sname};
+ Irssi::signal_stop();
+ Irssi::print(">> $sname latency: " . sprintf("%0.3f",gettimeofday() - $askping{$sname}) . "s");
+ delete $askping{$sname};
}
Irssi::signal_add("event pong", "event_pong");
diff --git a/scripts/sysinfo_dg.pl b/scripts/sysinfo_dg.pl
index 1510d33..cb1458f 100644
--- a/scripts/sysinfo_dg.pl
+++ b/scripts/sysinfo_dg.pl
@@ -7,7 +7,7 @@ $VERSION = "1.2";
name => 'sysinfo-dg',
description => 'Adds a /sysinfo command which prints system information (linux only).',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
#This script is mostly my own work but some ideas where taken from /sinfo by
diff --git a/scripts/title.pl b/scripts/title.pl
index 6e31ffc..f6fa3de 100644
--- a/scripts/title.pl
+++ b/scripts/title.pl
@@ -1,5 +1,5 @@
use Irssi 20020120.0250 ();
-$VERSION = "3.2";
+$VERSION = "3.2b";
%IRSSI = (
authors => 'Timo Sirainen, David Leadbeater',
contact => 'tss@iki.fi, dgl@dgl.cx',
@@ -9,7 +9,6 @@ $VERSION = "3.2";
url => 'http://irssi.dgl.cx/',
);
-
# Settings:
# title_string: The string used in the title, see below for explaination
# title_topic_length: The length to truncate the topic to (some terminals have
@@ -29,6 +28,11 @@ $VERSION = "3.2";
# Nickname with usermode
# /set title_string $N(+$usermode)
+# To use this with screen you need some lines in your ~/.screenrc
+# termcap xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
+# terminfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
+# This probably only works if you have $TERM set to xterm.
+
my %act;
use IO::Handle;
diff --git a/scripts/urlgrab.pl b/scripts/urlgrab.pl
index ad32655..1fd657f 100644
--- a/scripts/urlgrab.pl
+++ b/scripts/urlgrab.pl
@@ -7,7 +7,7 @@ $VERSION = "0.2";
name => 'urlgrab',
description => 'Captures urls said in channel and private messages and saves them to a file, also adds a /url command which loads the last said url into mozilla.',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
);
use strict;
diff --git a/scripts/usercount.pl b/scripts/usercount.pl
index 8bbc9e0..46dc0b4 100644
--- a/scripts/usercount.pl
+++ b/scripts/usercount.pl
@@ -1,21 +1,23 @@
-use Irssi 20020101.0250 ();
-$VERSION = "1.16";
+use Irssi 20040119.2359 ();
+$VERSION = "1.19";
%IRSSI = (
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
contact => 'dgl@dgl.cx, tss@iki.fi, georg@boerde.de',
name => 'usercount',
description => 'Adds a usercount for a channel as a statusbar item',
license => 'GNU GPLv2 or later',
- url => 'http://irssi.dgl.yi.org/',
+ url => 'http://irssi.dgl.cx/',
+ changes => 'Only show halfops if server supports them',
);
# Once you have loaded this script run the following command:
# /statusbar window add usercount
# You can also add -alignment left|right option
-# /set usercount_show_zero on or off to show users when 0 users of that type
-# /set usercount_show_ircops (default off)
-# /set usercount_show_halfops (default on)
+# Settings:
+# /toggle usercount_show_zero to show item even when there are no users
+# /toggle usercount_show_ircops (default off)
+# /toggle usercount_show_halfops (default on)
# you can customize the look of this item from theme file:
# sb_usercount = "{sb %_$0%_ nicks ($1-)}";
@@ -114,6 +116,7 @@ sub calc_users() {
}
$total = $ops+$halfops+$voices+$normal;
+
if (!Irssi::settings_get_bool('usercount_show_zero')) {
$ircops = undef if ($ircops == 0);
$ops = undef if ($ops == 0);
@@ -121,7 +124,14 @@ sub calc_users() {
$voices = undef if ($voices == 0);
$normal = undef if ($normal == 0);
}
- $halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
+
+ # Server doesn't support halfops?
+ if($server->isupport("PREFIX") !~ /\%/) {
+ $halfops = undef;
+ } else {
+ $halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
+ }
+
$ircops = undef unless Irssi::settings_get_bool('usercount_show_ircops');
}