aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-06-02 20:41:40 -0400
committerTeddy Wing2015-06-02 20:41:40 -0400
commit0370866db92e1916af5ee98acf948adc3916d545 (patch)
tree0e3c4f27a044d70dad4498d0c4a57ae87a4d3da9
parent4c57303e4653bc332f5506440d40fc4df33b2420 (diff)
downloadirssi-hipchat-stfu-0370866db92e1916af5ee98acf948adc3916d545.tar.bz2
Test listener for `message public` signal
Following this tutorial: http://juerd.nl/site.plp/irssiscripttut Add a test sub that receives a public message signal so I can prove that it works and see what kind of data I'm getting back when my sub is called.
-rw-r--r--hipchat-stfu.pl19
1 files changed, 18 insertions, 1 deletions
diff --git a/hipchat-stfu.pl b/hipchat-stfu.pl
index adee2f4..26f72c9 100644
--- a/hipchat-stfu.pl
+++ b/hipchat-stfu.pl
@@ -1,7 +1,8 @@
use strict;
use vars qw($VERSION %IRSSI);
-use Irssi;
+use Irssi qw(signal_add);
+
$VERSION = '1.00';
%IRSSI = (
authors => 'Teddy Wing',
@@ -10,3 +11,19 @@ $VERSION = '1.00';
description => 'Silences annoying messages originating from HipChat.',
license => 'MIT',
);
+
+sub test {
+ my ($data, $server, $window_item) = @_;
+ return unless $window_item;
+ my $filename = 'hipchat-stfu-output.txt';
+
+ open(my $fh, '>', $filename) or die;
+ print $fh $data;
+ print $fh '-------###-------';
+ print $fh $server;
+ close $fh;
+};
+
+signal_add {
+ 'message public' => \&test,
+};