diff options
author | David Runge <david.runge@frqrec.com> | 2014-05-13 11:48:39 +0200 |
---|---|---|
committer | David Runge <david.runge@frqrec.com> | 2014-05-13 11:48:39 +0200 |
commit | 2f7990484a94692f42b7f334868b207e41392e95 (patch) | |
tree | 4a39cf6da909dc57b19439ae6c43e21f99833819 | |
parent | 23ab67aced45810d625f6701ff8b68a4ebdb24a6 (diff) | |
download | dotfiles-2f7990484a94692f42b7f334868b207e41392e95.tar.gz dotfiles-2f7990484a94692f42b7f334868b207e41392e95.tar.bz2 dotfiles-2f7990484a94692f42b7f334868b207e41392e95.tar.xz dotfiles-2f7990484a94692f42b7f334868b207e41392e95.zip |
Adding notify script for irsss
l--------- | .irssi/scripts/autorun/notify_irssi.pl | 1 | ||||
-rw-r--r-- | .irssi/scripts/notify_irssi.pl | 69 |
2 files changed, 70 insertions, 0 deletions
diff --git a/.irssi/scripts/autorun/notify_irssi.pl b/.irssi/scripts/autorun/notify_irssi.pl new file mode 120000 index 0000000..27e7bff --- /dev/null +++ b/.irssi/scripts/autorun/notify_irssi.pl @@ -0,0 +1 @@ +../notify_irssi.pl
\ No newline at end of file diff --git a/.irssi/scripts/notify_irssi.pl b/.irssi/scripts/notify_irssi.pl new file mode 100644 index 0000000..90a5f31 --- /dev/null +++ b/.irssi/scripts/notify_irssi.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl + +## Put me in ~/.irssi/scripts, and then execute the following in irssi: +## +## /load perl +## /script load notify_irssi.pl +## + +use strict; +use IO::Socket; +use Irssi; +use vars qw($VERSION %IRSSI); + +$VERSION = "0.01"; +%IRSSI = ( + authors => 'konni', + contact => 'konstantin.koslowski@gmail.com', + name => 'notify_irssi.pl', + description => 'TODO', + license => 'GNU General Public License', + url => 'none', +); + +my $divider = ":::"; + +# server, nick, msg, active +sub notify { + my $sock = new IO::Socket::INET ( + PeerAddr => '127.0.0.1', + PeerPort => '7090', + Proto => 'tcp', + ); + + if ($sock) { + my($server, $nick, $msg, $active) = @_; + print $sock $server,$divider,"$nick",$divider,"$msg",$divider,$active; + } +} + +sub notify_message { + my($dest, $msg, $nick, $address, $target) = @_; + my $server = $dest->{server}; + + my $active_win = Irssi::active_win(); + my $active = 0; + if ($active_win->get_active_name() eq $nick) { + $active = 1; + } + # return if ($active); + + notify($server, $nick, $msg, $active); +} + +sub notify_print { + my ($dest, $text, $msg) = @_; + my $server = $dest->{server}; + my $nick = $dest->{target}; + + return if (!$server || !($dest->{level} & MSGLEVEL_HILIGHT)); + + $msg =~ s/[^a-zA-Z0-9 .,!?\@:\>]//g; + + notify($server, $nick, $msg, 0); +} + +Irssi::signal_add("message private", "notify_message"); +Irssi::signal_add("message invite", "notify_message"); +Irssi::signal_add("print text", "notify_print"); +#Irssi::signal_add("dcc request", "notify"); |