aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-04-01 05:36:56 +0000
committerTom Feist <shabble@metavore.org>2011-04-01 05:36:56 +0000
commit67c392b2e5b849a0432f52d376c940c4cf2ae962 (patch)
tree0e1b54f4bd5a7169c90faa9244edc19eb5923bcd
parentuberprompt: added brace-truncation bug to BUGS section in comments. (diff)
downloadirssi-scripts-67c392b2e5b849a0432f52d376c940c4cf2ae962.tar.gz
irssi-scripts-67c392b2e5b849a0432f52d376c940c4cf2ae962.zip
signal_redir: general cleanup, and added attribution block %IRSSI
-rw-r--r--feature-tests/signal_redir.pl38
1 files changed, 28 insertions, 10 deletions
diff --git a/feature-tests/signal_redir.pl b/feature-tests/signal_redir.pl
index 15f9f08..89da34c 100644
--- a/feature-tests/signal_redir.pl
+++ b/feature-tests/signal_redir.pl
@@ -1,23 +1,36 @@
# mangled from cmpusers.pl (unpublished, afaik) by Bazerka <bazerka@quakenet.org>.
+# He is not to blame for any problems, contact me instead.
use strict;
use warnings;
use Irssi;
-use Data::Dumper;
-my $debug = 1;
-my $running = 0; # flag to prevent overlapping requests.
+our $VERSION = "0.1";
+our %IRSSI =
+ (
+ authors => "shabble, Bazerka",
+ contact => 'shabble+irssi@metavore.org, shabble@#irssi/Freenode,'
+ . 'bazerka@quakenet.org',
+ name => "signal_redir",
+ description => "Demonstration showing how to redirect a remote WHOIS"
+ . "command so the results can be captured by a script.",
+ license => "BSD",
+ url => "https://github.com/shabble/irssi-scripts/",
+ changed => "Fri Apr 1 00:05:39 2011"
+ );
+my $running = 0; # flag to prevent overlapping requests.
+my $debug = 1;
sub redir_init {
# set up event to handler mappings
Irssi::signal_add
({
- 'redir test_redir_whois_user' => \&event_whois_user,
- 'redir test_redir_whois_channels' => \&event_whois_channels,
- 'redir test_redir_whois_end' => \&event_whois_end,
- 'redir test_redir_whois_nosuchnick' => \&event_whois_nosuchnick,
- 'redir test_redir_whois_timeout' => \&event_whois_timeout,
+ 'redir test_redir_whois_user' => 'event_whois_user',
+ 'redir test_redir_whois_channels' => 'event_whois_channels',
+ 'redir test_redir_whois_end' => 'event_whois_end',
+ 'redir test_redir_whois_nosuchnick' => 'event_whois_nosuchnick',
+ 'redir test_redir_whois_timeout' => 'event_whois_timeout',
});
}
@@ -36,8 +49,7 @@ sub request_whois {
'' => 'event empty',
}
);
- Irssi::print("Sending Command: WHOIS $nick", MSGLEVEL_CLIENTCRAP)
- if $debug;
+ Irssi::print("Sending Command: WHOIS $nick", MSGLEVEL_CLIENTCRAP) if $debug;
# send the actual command directly to the server, rather than
# with $server->command()
$server->send_raw("WHOIS $nick");
@@ -52,7 +64,13 @@ sub event_whois_user {
sub event_whois_channels {
my ($server, $data) = @_;
my ($nick, $channels) = ( split / +/, $data, 3 )[ 1, 2 ];
+ my $prefix = 'cowu.be'; # server name
+ my $args = "shabble"; # match criteria
+ my $event = 'event 319'; # triggering event
+ my $sig = $server->redirect_get_signal($prefix, $event, $args);
Irssi::print("test_redir whois_channels: $nick, $channels", MSGLEVEL_CLIENTCRAP);
+ Irssi::print("test_redir get_signal: $sig", MSGLEVEL_CLIENTCRAP);
+
}
sub event_whois_end {