logo

scripts

A bunch of scripts, some to be moved to their own repository
commit: e03fff91a9b862842976da2ca21806dbe59f9db6
parent: 7864029cb81fcdbbde51232482a5be90d5c6ae11
Author: lanodan <lanodan.delta@free.fr>
Date:   Sun, 30 Mar 2014 21:25:16 +0200

add irssi files

Diffstat:

A.irssi/config141+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/default.theme224+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/scripts/autorun/notify-send.pl30++++++++++++++++++++++++++++++
A.irssi/scripts/autorun/screen_away.pl202+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/scripts/hilightwin.pl57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.irssi/scripts/notify-send.pl34++++++++++++++++++++++++++++++++++
6 files changed, 688 insertions(+), 0 deletions(-)

diff --git a/.irssi/config b/.irssi/config @@ -0,0 +1,141 @@ +settings = { + core = { + real_name = "Haelwenn MONNIER"; + user_name = "lanodan"; + nick = "lanodan"; + quit_message = "irssi: goodbye guys !"; + timestamp_format = "%H:%M:%S"; + }; + "fe-text" = { actlist_sort = "refnum"; }; + "fe-common/core" = { + theme = "default"; + autolog = "yes"; + autolog_level = "all -MSGS"; + autoclose_windows = "yes"; + reuse_unused_windows = "no"; + }; +}; +servers = ( + { + address = "irc.the-delta.net"; + chatnet = "the-delta"; + port = "6667"; + use_ssl = "no"; + ssl_verify = "no"; + autoconnect = "yes"; + password = "minepqss"; + }, + { + address = "holmes.freenode.net"; + chatnet = "Freenode"; + port = "6667"; + use_ssl = "no"; + ssl_verify = "no"; + autoconnect = "yes"; + password = "minepqss"; + }, + { + address = "irc.inframonde.org"; + chatnet = "inframonde"; + port = "6667"; + use_ssl = "no"; + ssl_verify = "no"; + autoconnect = "yes"; + password = "minepqss"; + }, + { + address = "irc.quakenet.org"; + chatnet = "quakenet"; + port = "6667"; + use_ssl = "no"; + ssl_verify = "no"; + autoconnect = "no"; + password = "minepqss"; + }, + { + address = "irc.deviantart.com"; + chatnet = "deviart"; + port = "6667"; + use_ssl = "no"; + ssl_verify = "no"; + autoconnect = "no"; + user_name = "lanodan53"; + password = "mineg0ld"; + }, + { + address = "irc.swordarmor.fr"; + chatnet = "swordarmor"; + port = "6667"; + use_ssl = "no"; + ssl_verify = "no"; + autoconnect = "yes"; + } +); + +chatnets = { + Freenode = { type = "IRC"; }; + "the-delta" = { type = "IRC"; }; + inframonde = { type = "IRC"; }; + quakenet = { type = "IRC"; }; + deviart = { type = "IRC"; }; + swordarmor = { type = "IRC"; }; +}; + +channels = ( + { name = "#main"; chatnet = "the-delta"; autojoin = "yes"; }, + { name = "#Taverne"; chatnet = "the-delta"; autojoin = "yes"; }, + { name = "#kisune"; chatnet = "Freenode"; autojoin = "yes"; }, + { name = "#leloop"; chatnet = "Freenode"; autojoin = "yes"; }, + { name = "#zsh"; chatnet = "Freenode"; autojoin = "no"; }, + { name = "#vim"; chatnet = "Freenode"; autojoin = "no"; }, + { name = "#debian"; chatnet = "Freenode"; autojoin = "no"; }, + { name = "##javascript"; chatnet = "Freenode"; autojoin = "no"; }, + { name = "#n-pn"; chatnet = "inframonde"; autojoin = "yes"; }, + { name = "#inframonde"; chatnet = "inframonde"; autojoin = "yes"; }, + { name = "#OutOfReality"; chatnet = "quakenet"; autojoin = "yes"; }, + { name = "#breizh-entropy"; chatnet = "freenode"; autojoin = "yes"; }, + { name = "#swordarmor"; chatnet = "swordarmor"; autojoin = "yes"; } +); + +completions = { + em = { value = "lanodan.delta@free.fr"; auto = "no"; }; + lmgtfy = { value = "http://lmgtfy.com/?q="; auto = "yes"; }; + twtr = { value = "@lanodan"; auto = "no"; }; + web = { value = "http://bit.ly/lanodan"; auto = "no"; }; +}; +logs = { }; +statusbar = { + default = { + prompt = { visible = "active"; type = "window"; position = "2"; }; + window = { + visible = "active"; + items = { + barstart = { priority = "100"; }; + user = { }; + window = { }; + window_empty = { }; + lag = { priority = "-1"; }; + act = { priority = "10"; }; + more = { priority = "-1"; alignment = "right"; }; + barend = { priority = "100"; alignment = "right"; }; + }; + }; + }; +}; +ignores = ( + { mask = "EpicOut"; level = "ALL"; }, + { level = "JOINS PARTS QUITS"; channels = ( "#leloop" ); }, + { level = "JOINS PARTS QUITS"; channels = ( "#inframonde" ); } +); +hilights = ( + { text = "lanodan"; nick = "yes"; word = "yes"; color = "%R"; }, + { text = "haelwenn"; nick = "yes"; word = "yes"; color = "%R"; } + { text = "$N"; nick = "yes"; word = "yes"; color = "%R"; } +); +aliases = { + wc = "part"; + op_kisune = "^msg chanserv op #Kisune $N"; + deop_kisune = "^msg chanserv deop #Kisune $N"; + feyris = "^msg feyris-nyannyan"; + identify = "^msg NickServ identify"; +}; diff --git a/.irssi/default.theme b/.irssi/default.theme @@ -0,0 +1,224 @@ +# default foreground color (%N) - -1 is the "default terminal color" +default_color = "-1"; + +# print timestamp/servertag at the end of line, not at beginning +info_eol = "false"; + +# these characters are automatically replaced with specified color +# (dark grey by default) +replaces = { "[]=" = "%K$*%n"; "<>=" = "%K$*%n"; }; + +abstracts = { + # text to insert at the beginning of each non-message line + line_start = "%c*%n"; + + # timestamp styling, nothing by default + timestamp = "$*"; + + # any kind of text that needs hilighting, default is to bold + hilight = "%_$*%_"; + + # any kind of error message, default is bright red + error = "%R$*%n"; + + # channel name is printed + channel = "%_$*%_"; + + # nick is printed + nick = "%_$*%_"; + + # nick host is printed + nickhost = "[$*]"; + + # server name is printed + server = "%_$*%_"; + + # some kind of comment is printed + comment = "[$*]"; + + # reason for something is printed (part, quit, kick, ..) + reason = "{comment $*}"; + + # mode change is printed ([+o nick]) + mode = "{comment $*}"; + + ## + ## channel specific messages + ## + + # highlighted nick/host is printed (joins) + channick_hilight = "%G$*%n"; + chanhost_hilight = "{nickhost %c$*%n}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%Y$* "; + chanhost = "{nickhost $*}"; + + # highlighted channel name is printed + channelhilight = "%c$*%n"; + + # ban/ban exception/invite list mask is printed + ban = "%c$*%n"; + + ## + ## messages + ## + + # the basic styling of how to print message, $0 = nick mode, $1 = nick + msgnick = "<$0$1-> "; + + # $0 = nick mode, $1 = nick + ownmsgnick = "{msgnick $0 $1-}"; + ownnick = "%_$*%n"; + + # public message in channel, $0 = nick mode, $1 = nick + pubmsgnick = "{msgnick $0 $1-}"; + pubnick = "%N$*%n"; + + # public message in channel meant for me, $0 = nick mode, $1 = nick + pubmsgmenick = "{msgnick $0 $1-}"; + menick = "%R$*%n"; + + # public highlighted message in channel + # $0 = highlight color, $1 = nick mode, $2 = nick + pubmsghinick = "{msgnick $1 $0$2-%n}"; + + # channel name is printed with message + msgchannel = "%K:%c$*%n"; + + # private message, $0 = nick, $1 = host + privmsg = "[%R$0%K(%r$1-%K)%n] "; + + # private message from you, $0 = "msg", $1 = target nick + ownprivmsg = "[%r$0%K(%R$1-%K)%n] "; + + # own private message in query + ownprivmsgnick = "{msgnick $*}"; + ownprivnick = "%_$*%n"; + + # private message in query + privmsgnick = "{msgnick %R$*%n}"; + + ## + ## Actions (/ME stuff) + ## + + # used internally by this theme + action_core = "%_ * $*%n "; + + # generic one that's used by most actions + action = "{action_core $*}"; + + # own action, both private/public + ownaction = "{action $*}"; + + # own action with target, both private/public + ownaction_target = "{action_core $0}%K:%c$1%n *"; + + # private action sent by others + pvtaction = "%_ (*) $*%n "; + pvtaction_query = "{action $*}"; + + # public action sent by others + pubaction = "{action $*}"; + + + ## + ## other IRC events + ## + + # whois + whois = "%# $[8]0 : $1-"; + + # notices + ownnotice = "[%r$0%K(%R$1-%K)]%n "; + notice = "%K-%M$*%K-%n "; + pubnotice_channel = "%K:%m$*"; + pvtnotice_host = "%K(%m$*%K)"; + servernotice = "%g!$*%n "; + + # CTCPs + ownctcp = "[%r$0%K(%R$1-%K)] "; + ctcp = "%g$*%n"; + + # wallops + wallop = "%_$*%n: "; + wallop_nick = "%n$*"; + wallop_action = "%_ * $*%n "; + + # netsplits + netsplit = "%R$*%n"; + netjoin = "%G$*%n"; + + # /names list + names_nick = "[%_$0%_$1-] "; + names_nick_op = "%r{names_nick $*}%n"; + names_nick_halfop = "%b{names_nick $*}%n"; + names_nick_voice = "%y{names_nick $*}%n"; + names_users = "[$*]"; + names_channel = "%G$*%n"; + + # DCC + dcc = "%g$*%n"; + dccfile = "%_$*%_"; + + # DCC chat, own msg/action + dccownmsg = "[%r$0%K($1-%K)%n] "; + dccownnick = "%R$*%n"; + dccownquerynick = "%_$*%n"; + dccownaction = "{action $*}"; + dccownaction_target = "{action_core $0}%K:%c$1%n "; + + # DCC chat, others + dccmsg = "[%G$1-%K(%g$0%K)%n] "; + dccquerynick = "%G$*%n"; + dccaction = "%_ (*dcc*) $*%n %|"; + + ## + ## statusbar + ## + + # default background for all statusbars. You can also give + # the default foreground color for statusbar items. + sb_background = "%4"; + + # default backround for "default" statusbar group + #sb_default_bg = "%4"; + # background for prompt / input line + sb_prompt_bg = "%n"; + # background for info statusbar + sb_info_bg = "%b"; + # background for topicbar (same default) + #sb_topic_bg = "%4"; + + # text at the beginning of statusbars. sb-item already puts + # space there,so we don't use anything by default. + sbstart = ""; + # text at the end of statusbars. Use space so that it's never + # used for anything. + sbend = ""; + + topicsbstart = "{sbstart $*}"; + topicsbend = "{sbend $*}"; + + prompt = "%K[%G$*%K] "; + + sb = " %c[%n$*%c]%n"; + sbmode = "(%c+%n$*)"; + sbaway = " (%GzZzZ%n)"; + sbservertag = ":$0"; + sbnickmode = "$0"; + + # activity in statusbar + + # ',' separator + sb_act_sep = "%c$*"; + # normal text + sb_act_text = "%c$*"; + # public message + sb_act_msg = "%W$*"; + # hilight + sb_act_hilight = "%M$*"; + # hilight with specified color, $0 = color, $1 = text + sb_act_hilight_color = "$0$1-%n"; +}; diff --git a/.irssi/scripts/autorun/notify-send.pl b/.irssi/scripts/autorun/notify-send.pl @@ -0,0 +1,30 @@ +use Irssi; +use vars qw($VERSION %IRSSI); + +$VERSION = '0.0.3'; +%IRSSI = ( + authors => 'Chrelad', + name => 'notify', + description => 'Display a pop-up alert for different events.', + url => 'http://google.com', + license => 'GNU General Public License', +); + +$_nick = Client->{nick}; + +sub pub_msg { + my ($server, $msg, $nick, $address, $target) = @_; + + if ($msg =~ $_nick) { + `notify-send -a irssi -t 8000 "${target}: ${nick}" "${msg}"`; + } +} + +sub priv_msg { + my ($server, $msg, $nick, $address) = @_; + + `notify-send -a irssi -t 8000 ${nick} ${msg}`; +} + +Irssi::signal_add_last("message public", "pub_msg"); +Irssi::signal_add_last("message private", "priv_msg"); diff --git a/.irssi/scripts/autorun/screen_away.pl b/.irssi/scripts/autorun/screen_away.pl @@ -0,0 +1,202 @@ +use Irssi; +use strict; +use FileHandle; + +use vars qw($VERSION %IRSSI); + +$VERSION = "0.9.7.1"; +%IRSSI = ( + authors => 'Andreas (ads) Scherbaum <ads@wars-nicht.de>', + name => 'screen_away', + description => 'set (un)away, if screen is attached/detached', + license => 'GPL v2', + url => 'none', +); + +# screen_away irssi module +# +# written by Andreas 'ads' Scherbaum <ads@ufp.de> +# +# changes: +# 07.02.2004 fix error with away mode +# thanks to Michael Schiansky for reporting and fixing this one +# 07.08.2004 new function for changing nick on away +# 24.08.2004 fixing bug where the away nick was not storedcorrectly +# thanks for Harald Wurpts for help debugging this one +# 17.09.2004 rewrote init part to use $ENV{'STY'} +# 05.12.2004 add patch for remember away state +# thanks to Jilles Tjoelker <jilles@stack.nl> +# change "chatnet" to "tag" +# 18.05.2007 fix '-one' for SILC networks +# +# +# usage: +# +# put this script into your autorun directory and/or load it with +# /SCRIPT LOAD <name> +# +# there are 5 settings available: +# +# /set screen_away_active ON/OFF/TOGGLE +# /set screen_away_repeat <integer> +# /set screen_away_message <string> +# /set screen_away_window <string> +# /set screen_away_nick <string> +# +# active means, that you will be only set away/unaway, if this +# flag is set, default is ON +# repeat is the number of seconds, after the script will check the +# screen status again, default is 5 seconds +# message is the away message sent to the server, default: not here ... +# window is a window number or name, if set, the script will switch +# to this window, if it sets you away, default is '1' +# nick is the new nick, if the script goes away +# will only be used it not empty +# +# normal you should be able to rename the script to something other +# than 'screen_away' (as example, if you dont like the name) by simple +# changing the 'name' parameter in the %IRSSI hash at the top of this script + + +# variables +my $timer_name = undef; +my $away_status = 0; +my %away = (); + +# Register formats +Irssi::theme_register([ 'screen_away_crap', '{line_start}{hilight '.$IRSSI{'name'}.':} $0' ]); + +# if we are running +my $screen_away_used = 0; + +# try to find out, if we are running in a screen +# (see, if $ENV{STY} is set +if (!defined($ENV{STY})) { + # just return, we will never be called again + Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'screen_away_crap', "could not open status file for parent process (pid: " . getppid() . "): $!"); + return; +} + +my ($socket_name, $socket_path); + +# search for socket +# normal we could search the socket file, ... if we know the path +# but so we have to call one time the screen executable +# disable locale +# the quotes around C force perl 5.005_03 to use the shell +# thanks to Jilles Tjoelker <jilles@stack.nl> for pointing this out +my $socket = `LC_ALL="C" screen -ls`; + +my $running_in_screen = 0; +# locale doesnt seems to be an problem (yet) +if ($socket !~ /^No Sockets found/s) { + # ok, should have only one socket + $socket_name = $ENV{'STY'}; + $socket_path = $socket; + $socket_path =~ s/^.+\d+ Sockets? in ([^\n]+)\.\n.+$/$1/s; + if (length($socket_path) != length($socket)) { + # only activate, if string length is different + # (to make sure, we really got a dir name) + $screen_away_used = 1; + } else { + Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'screen_away_crap', "error reading screen informations from:"); + Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'screen_away_crap', "$socket"); + return; + } +} + +# last check +if ($screen_away_used == 0) { + # we will never be called again + return; +} + +# build complete socket name +$socket = $socket_path . "/" . $socket_name; + +screen_away(); + +# screen_away() +# +# check, set or reset the away status +# +# parameter: +# none +# return: +# 0 (OK) +sub screen_away { + my ($away, @screen, $screen); + + # only run, if activated + if (Irssi::settings_get_bool($IRSSI{'name'} . '_active') == 1) { + if ($away_status == 0) { + # display init message at first time + Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'screen_away_crap', "activating $IRSSI{'name'} (interval: " . Irssi::settings_get_int($IRSSI{'name'} . '_repeat') . " seconds)"); + } + # get actual screen status + my @screen = stat($socket); + # 00100 is the mode for "user has execute permissions", see stat.h + if (($screen[2] & 00100) == 0) { + # no execute permissions, Detached + $away = 1; + } else { + # execute permissions, Attached + $away = 2; + } + + # check if status has changed + if ($away == 1 and $away_status != 1) { + # set away + if (length(Irssi::settings_get_str($IRSSI{'name'} . '_window')) > 0) { + # if length of window is greater then 0, make this window active + Irssi::command('window goto ' . Irssi::settings_get_str($IRSSI{'name'} . '_window')); + } + Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'screen_away_crap', "Set away"); + my ($server); + foreach $server (Irssi::servers()) { + if (!$server->{usermode_away}) { + # user isnt yet away + $away{$server->{'tag'}} = 0; + $server->command("AWAY " . (($server->{chat_type} ne 'SILC') ? "-one " : "") . "screen detached") if (!$server->{usermode_away}); + } else { + # user is already away, remember this + $away{$server->{'tag'}} = 1; + } + } + $away_status = $away; + } elsif ($away == 2 and $away_status != 2) { + # unset away + Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'screen_away_crap', "Reset away"); + my ($server); + foreach $server (Irssi::servers()) { + if ($away{$server->{'tag'}} == 1) { + # user was already away, dont reset away + $away{$server->{'tag'}} = 0; + next; + } + $server->command("AWAY" . (($server->{chat_type} ne 'SILC') ? " -one" : "")) if ($server->{usermode_away}); + } + $away_status = $away; + } + } + # but everytimes install a new timer + register_screen_away_timer(); + return 0; +} + +# register_screen_away_timer() +# +# remove old timer and install a new one +# +# parameter: +# none +# return: +# none +sub register_screen_away_timer { + if (defined($timer_name)) { + # remove old timer, if defined + Irssi::timeout_remove($timer_name); + } + # add new timer with new timeout (maybe the timeout has been changed) + $timer_name = Irssi::timeout_add(Irssi::settings_get_int($IRSSI{'name'} . '_repeat') * 1000, 'screen_away', ''); +} diff --git a/.irssi/scripts/hilightwin.pl b/.irssi/scripts/hilightwin.pl @@ -0,0 +1,57 @@ +# +# Print hilighted messages & private messages to window named "hilight" for +# irssi 0.7.99 by Timo Sirainen +# +# Modded a tiny bit by znx to stop private messages entering the hilighted +# window (can be toggled) and to put up a timestamp. +# + +use Irssi; +use POSIX; +use vars qw($VERSION %IRSSI); + +$VERSION = "0.02"; +%IRSSI = ( + authors => "Timo \'cras\' Sirainen, Mark \'znx\' Sangster", + contact => "tss\@iki.fi, znxster\@gmail.com", + name => "hilightwin", + description => "Print hilighted messages to window named \"hilight\"", + license => "Public Domain", + url => "http://irssi.org/", + changed => "Sun May 25 18:59:57 BST 2008" +); + +sub sig_printtext { + my ($dest, $text, $stripped) = @_; + + my $opt = MSGLEVEL_HILIGHT; + + if(Irssi::settings_get_bool('hilightwin_showprivmsg')) { + $opt = MSGLEVEL_HILIGHT|MSGLEVEL_MSGS; + } + + if( + ($dest->{level} & ($opt)) && + ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0 + ) { + $window = Irssi::window_find_name('hilight'); + + if ($dest->{level} & MSGLEVEL_PUBLIC) { + $text = $dest->{target}.": ".$text; + } + $text = strftime( + Irssi::settings_get_str('timestamp_format')." ", + localtime + ).$text; + $window->print($text, MSGLEVEL_NEVER) if ($window); + } +} + +$window = Irssi::window_find_name('hilight'); +Irssi::print("Create a window named 'hilight'") if (!$window); + +Irssi::settings_add_bool('hilightwin','hilightwin_showprivmsg',1); + +Irssi::signal_add('print text', 'sig_printtext'); + +# vim:set ts=4 sw=4 et: diff --git a/.irssi/scripts/notify-send.pl b/.irssi/scripts/notify-send.pl @@ -0,0 +1,34 @@ +# irssi-notify.pl +use Irssi; +use Net::DBus; + +$::VERSION='0.0.1'; +%::IRSSI = ( + authors => 'Haelwenn MONNIER', + contact => '@lanodan', + name => 'notify-send', + description => 'Displays a pop-up message for message received', + license => 'CC-BY-SA', + ); + +my $APPNAME = 'irssi'; + +my $bus = Net::DBus->session; +my $notifications = $bus->get_service('org.freedesktop.Notifications'); +my $object = $notifications->get_object('/org/freedesktop/Notifications', 'org.freedesktop.Notifications'); + +sub pub_msg { + my ($server,$msg,$nick,$address,$target) = @_; + + if ($msg =~ $notify_nick) { + $object->Notify("${APPNAME}:${server}", 0, 'info', "Public Message in ${target}", "$nick: $msg", [], { }, 3000); + } +} + +sub priv_msg { + my ($server,$msg,$nick,$address) = @_; + $object->Notify("${APPNAME}:${server}", 0, 'info', 'Private Message', "$nick: $msg", [], { }, 3000); +} + +Irssi::signal_add_last('message public', \&pub_msg); +Irssi::signal_add_last('message private', \&priv_msg);