diff options
Diffstat (limited to 'bin/notify_irssi_server.pl')
-rwxr-xr-x | bin/notify_irssi_server.pl | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/bin/notify_irssi_server.pl b/bin/notify_irssi_server.pl deleted file mode 100755 index e1c7b80..0000000 --- a/bin/notify_irssi_server.pl +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/perl -# -use IO::Socket; -my $sock = new IO::Socket::INET ( - LocalHost => '127.0.0.1', - LocalPort => '7090', - Proto => 'tcp', - Listen => 1, - Reuse => 1, -); -die "Could not create socket: $!\n" unless $sock; - -while(true) { - my $new_sock = $sock->accept(); - while(<$new_sock>) { - my ($server, $channel, $text, $active) = split(/:::/); - #print "$_\n"; - my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(); - # zero padding - if ($hour < 10) { - $hour = "0$hour"; - } - if ($minute < 10) { - $minute = "0$minute"; - } - if ($channel =~ m/#/ ) { - $timeout = 10; - } - else { - if ($channel =~ m/bitlbee/ ) { - $timeout = 10; - } - else { - $timeout = 5; - } - } - - ## filter invalid chars - # allowed: [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] - $text =~ s/[^\x01-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]//go; - # # restricted:[#x1-#x8][#xB-#xC][#xE-#x1F][#x7F-#x84][#x86-#x9F] - $text =~ s/[\x01-\x08\x0B-\x0C\x0E-\x1F\x7F-\x84\x86-\x9F]//go; - - ## replace otr information - $text =~ s/^03/OTR:\ /; - - ## remove ' - $text =~ s/\'//g; - - ## remove " - $text =~ s/\"//g; - - print "message({action=\"new\", timeout=$timeout, active=$active, title=\"$hour:$minute $channel\", text=\"$text\"})\n"; - ## AWESOME custom function - system("echo 'message({action=\"new\", timeout=$timeout, active=$active, title=\"$hour:$minute $channel\", text=\"$text\"})' | awesome-client"); - ## AWESOME - # system("echo 'notify_irssi=naughty.notify({timeout = $timeout, title = \"$hour:$minute $channel\", text = \"$text\"})' | awesome-client"); - ## NOTIFY-SEND timeout in ms - # system("notify-send -t $timeout*1000 \"$hour:$minute $channel\" \"$text\""); - } -} -close($sock); |