From 8746a69bbb79902b6be5fd205efbb5bfc83feed7 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 13 Jun 2015 22:29:42 -0400 Subject: Checking for empty messages from HipChat (WIP) Some trial and error in selecting the blank empty messages coming from HipChat/JIRA. Had to do the output-to-file thing again, this time a new different one. Was trying to match against an empty string message but it turns out the empty messages that HipChat sends have a single space in them, aggh! --- hipchat-stfu.pl | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'hipchat-stfu.pl') diff --git a/hipchat-stfu.pl b/hipchat-stfu.pl index 1145891..41abb7f 100644 --- a/hipchat-stfu.pl +++ b/hipchat-stfu.pl @@ -16,15 +16,32 @@ $VERSION = '1.00'; sub hipchat_stfu { my ($server, $text, $nick) = @_; - my $filename = 'hipchat-stfu-output.txt'; - open(my $fh, '>>', $filename) or die; - print $fh Dumper($server); - print $fh "\t"; - print $fh $text; - print $fh "\t"; - print $fh $nick; - print $fh "\n"; - close $fh; + # my $filename = 'hipchat-stfu-output.txt'; + # open(my $fh, '>>', $filename) or die; + # print $fh Dumper($server); + # print $fh "\t"; + # print $fh $text; + # print $fh "\t"; + # print $fh $nick; + # print $fh "\n"; + # close $fh; + + if ($server->{'chatnet'} eq 'Bitlbee' && + $nick eq 'root') { + open(my $fh, '>>', 'hipchatyeehaw.txt') or die; + # print $fh 'yeehaw' if ($text eq ''); + # print $fh 'boohoo' if (!defined($text)); + print $fh 'booya' if ($text =~ /^\s*$/); + # print $fh $text . "\n"; + close $fh; + + if ($text eq '') { + signal_stop(); + } + else { + # Modify the text + } + } }; signal_add { -- cgit v1.2.3