summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_data/scripts.yaml6
-rw-r--r--scripts/fakectcp.pl4
-rw-r--r--scripts/timer.pl2
-rw-r--r--scripts/urlinfo.pl35
4 files changed, 36 insertions, 11 deletions
diff --git a/_data/scripts.yaml b/_data/scripts.yaml
index 646014b..7d9ba96 100644
--- a/_data/scripts.yaml
+++ b/_data/scripts.yaml
@@ -4225,15 +4225,15 @@
contact: "dgl@dgl.cx"
description: "Print short summaries about URLs from known services that are mentioned on IRC. (Including YouTube, etc.)"
filename: "urlinfo.pl"
- modified: "2014-08-10"
+ modified: "2014-08-22"
license: "WTFPL"
name: "urlinfo"
- version: "1.2"
+ version: "1.3"
- authors: "David Leadbeater"
contact: "dgl@dgl.cx"
description: "Stops those silly mistakes being sent (spaces at start of line, /1/1 for window changes, etc)."
- filename: "urlinfo.pl"
+ filename: "oopsie.pl"
modified: "2014-08-13"
license: "WTFPL"
name: "oopsie"
diff --git a/scripts/fakectcp.pl b/scripts/fakectcp.pl
index 5801430..d86ceab 100644
--- a/scripts/fakectcp.pl
+++ b/scripts/fakectcp.pl
@@ -48,8 +48,8 @@ Usage: (all on one line)
-add: Add a new fake ctcp-reply to the list.
-del: Delete a fake ctcp-reply from the list.
-list: Display the contents of the fake ctcp-reply list.
--help: Display this usefull little helpfile.
--replace: Replace a excisting fake reply with a new one. If the old one doesn't excists, the new one will be added by default.
+-help: Display this useful little helpfile.
+-replace: Replace an existing fake reply with a new one. If the old one doesn't exist, the new one will be added by default.
Examples: (all on one line)
/FCTCP -add CHRISTEL We all love christel, don't we! :)
diff --git a/scripts/timer.pl b/scripts/timer.pl
index 1f5452c..e48f900 100644
--- a/scripts/timer.pl
+++ b/scripts/timer.pl
@@ -75,7 +75,7 @@ sub cmd_timer_help {
print ( <<EOF
TIMER LIST
-TIMER ADD <name> <internal in seconds> [<repeat>] <command>
+TIMER ADD <name> <interval in seconds> [<repeat>] <command>
TIMER STOP <name>
repeat value of 0 means unlimited too
diff --git a/scripts/urlinfo.pl b/scripts/urlinfo.pl
index 0a86fe1..913f201 100644
--- a/scripts/urlinfo.pl
+++ b/scripts/urlinfo.pl
@@ -4,7 +4,7 @@ use Encode;
use Irssi;
use POSIX ();
-our $VERSION = "1.2";
+our $VERSION = "1.3";
our %IRSSI = (
authors => 'David Leadbeater',
contact => 'dgl@dgl.cx',
@@ -44,6 +44,9 @@ BEGIN {
# /SET urlinfo_ignore_domains example\.org example\.com
# Space separated list of regular expressions of domains to ignore
#
+# /SET urlinfo_ignore_targets freenode #something efnet/#example
+# Space separated list of targets to ignore.
+#
# /SET urlinfo_custom_domains my\.domain/thing irssi\.org=description
# A limited way of configuring custom domains, if you need something more
# complex edit SITES below.
@@ -239,7 +242,7 @@ sub msg {
if (my($url) = $text =~ $URL_RE) {
my($site, $uri) = get_site(\@sites, $url);
return unless $site;
- return if ignored($uri);
+ return if ignored($uri, $server, $target);
fork_wrapper(sub { # Child
my($fh) = @_;
@@ -283,10 +286,31 @@ sub msg {
}
sub ignored {
- my($uri) = @_;
- my @ignored = split / /, Irssi::settings_get_str('urlinfo_ignore_domains');
+ my($uri, $server, $target) = @_;
+ my @ignored_domains = split / /, Irssi::settings_get_str('urlinfo_ignore_domains');
my $domain = $uri->host =~ s/^www\.//r;
- return grep $domain =~ /^$_$/, @ignored;
+ return 1 if grep $domain =~ /^$_$/, @ignored_domains;
+
+ my $chans = $server->isupport("chantypes") || '#&';
+ my $chan_match = qr/^[$chans]/;
+
+ for my $ignored_target (split / /, Irssi::settings_get_str('urlinfo_ignore_targets')) {
+ my($mtag, $mtarget) = split m{/}, $ignored_target;
+ if ($mtag =~ $chan_match) {
+ $mtarget = $mtag;
+ $mtag = "*";
+ }
+ return 1 if _match($mtag, $server->{tag}) &&
+ (!$mtarget || _match($mtarget, $target));
+ }
+
+ return 0;
+}
+
+sub _match {
+ my($pattern, $name) = @_;
+ $pattern =~ s/\*/.*/g;
+ $name =~ /^$pattern$/i;
}
sub find_window {
@@ -366,6 +390,7 @@ if (caller) {
Irssi::settings_add_str($IRSSI{name}, "urlinfo_custom_domains", "");
Irssi::settings_add_str($IRSSI{name}, "urlinfo_ignore_domains", "");
+ Irssi::settings_add_str($IRSSI{name}, "urlinfo_ignore_targets", "");
Irssi::settings_add_int($IRSSI{name}, "urlinfo_timeout", $timeout);
Irssi::settings_add_bool($IRSSI{name}, "urlinfo_title_unknown", 0);