From 365a519192fcc4f60f7f63d47a9a4bf51c822af1 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 30 Oct 2022 15:13:45 -0700 Subject: irssi -> rcirc initial configuration --- .config/i3/config | 8 +- .config/sway/config | 11 +- .emacs.d/init.el | 72 ++++ .gitignore | 1 - .irssi/clean.theme | 264 ------------- .irssi/default.theme | 319 ---------------- .irssi/scripts/autorun/act.pl | 14 - .irssi/scripts/autorun/anotherway.pl | 63 ---- .irssi/scripts/autorun/auto_bleh.pl | 293 -------------- .irssi/scripts/autorun/format_identify.pl | 440 ---------------------- .irssi/scripts/autorun/go.pl | 59 --- .irssi/scripts/autorun/hilightwin.pl | 59 --- .irssi/scripts/autorun/trackbar.pl | 408 -------------------- .irssi/scripts/autorun/winnum.pl | 41 -- .irssi/startup | 3 - archive/.irssi/clean.theme | 264 +++++++++++++ archive/.irssi/default.theme | 319 ++++++++++++++++ archive/.irssi/scripts/autorun/act.pl | 14 + archive/.irssi/scripts/autorun/anotherway.pl | 63 ++++ archive/.irssi/scripts/autorun/auto_bleh.pl | 293 ++++++++++++++ archive/.irssi/scripts/autorun/format_identify.pl | 440 ++++++++++++++++++++++ archive/.irssi/scripts/autorun/go.pl | 59 +++ archive/.irssi/scripts/autorun/hilightwin.pl | 59 +++ archive/.irssi/scripts/autorun/trackbar.pl | 408 ++++++++++++++++++++ archive/.irssi/scripts/autorun/winnum.pl | 41 ++ archive/.irssi/startup | 3 + archive/bin/ii | 30 ++ archive/bin/send-irssi-away-log | 38 ++ bin/ii | 30 -- bin/send-irssi-away-log | 38 -- 30 files changed, 2107 insertions(+), 2047 deletions(-) delete mode 100644 .irssi/clean.theme delete mode 100644 .irssi/default.theme delete mode 100755 .irssi/scripts/autorun/act.pl delete mode 100755 .irssi/scripts/autorun/anotherway.pl delete mode 100644 .irssi/scripts/autorun/auto_bleh.pl delete mode 100644 .irssi/scripts/autorun/format_identify.pl delete mode 100644 .irssi/scripts/autorun/go.pl delete mode 100644 .irssi/scripts/autorun/hilightwin.pl delete mode 100644 .irssi/scripts/autorun/trackbar.pl delete mode 100644 .irssi/scripts/autorun/winnum.pl delete mode 100644 .irssi/startup create mode 100644 archive/.irssi/clean.theme create mode 100644 archive/.irssi/default.theme create mode 100755 archive/.irssi/scripts/autorun/act.pl create mode 100755 archive/.irssi/scripts/autorun/anotherway.pl create mode 100644 archive/.irssi/scripts/autorun/auto_bleh.pl create mode 100644 archive/.irssi/scripts/autorun/format_identify.pl create mode 100644 archive/.irssi/scripts/autorun/go.pl create mode 100644 archive/.irssi/scripts/autorun/hilightwin.pl create mode 100644 archive/.irssi/scripts/autorun/trackbar.pl create mode 100644 archive/.irssi/scripts/autorun/winnum.pl create mode 100644 archive/.irssi/startup create mode 100755 archive/bin/ii create mode 100755 archive/bin/send-irssi-away-log delete mode 100755 bin/ii delete mode 100755 bin/send-irssi-away-log diff --git a/.config/i3/config b/.config/i3/config index c2f442b5..e4b6fae5 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -237,12 +237,8 @@ mode "C-i-" { bindsym g mode "C-i g-" - # chat - bindsym Shift+n exec xfce4-terminal --title="irssi" -x \ - /bin/sh -c "mosh athena /home/spwhitton/src/dotfiles/bin/ii", \ - mode "default" - bindsym n [class="^Xfce4-terminal$" title="^irssi$"] focus, \ - mode "default" + bindsym n exec i3-msg '[title="\[mosh\] tmux default on athena"]' focus \ + || xfce4-terminal -x ssh-and-tmux athena.silentflame.com, mode "default" bindsym space mode "default" bindsym Ctrl+g mode "default" diff --git a/.config/sway/config b/.config/sway/config index 407c3100..9b8e7e21 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -227,15 +227,8 @@ mode "C-i-" { # various reasons, so just having them as regular windows with # shortcuts to get back to them is better. - # chat - # Foot in Debian bullseye doesn't have an option to set a persistent - # title. See regarding - # using the app ID for this purpose. For bookworm, use new --override - # locked-title=yes feature. - bindsym Shift+n exec foot --app-id="foot-irssi" \ - /bin/sh -c "mosh athena /home/spwhitton/src/dotfiles/bin/ii", \ - mode "default" - bindsym n [app_id="foot-irssi"] focus, mode "default" + bindsym n exec swaymsg '[title="\[mosh\] tmux default on athena"]' focus \ + || foot ssh-and-tmux athena.silentflame.com, mode "default" bindsym c [con_mark=caffeinated] inhibit_idle none; \ mark --toggle caffeinated; mode "default" diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d0e065f5..f93c1b1d 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -363,6 +363,17 @@ windows side-by-side in the frame." (spw/project-vc-print-root-log "VC-Log" "L") (transient-cycles-cmd-spw/project-eshell "Eshell"))) '(project-switch-use-entire-map t) + '(rcirc-default-full-name "Sean Whitton [spwhitton@spwhitton.name]") + '(rcirc-default-nick "spwhitton") + '(rcirc-default-user-name "spwhitton") + '(rcirc-display-server-buffer nil) + '(rcirc-log-directory "~/local/irclogs") + '(rcirc-log-filename-function 'spw/rcirc-generate-log-filename) + '(rcirc-log-flag t) + '(rcirc-time-format "%b/%d %H:%M ") + '(rcirc-track-abbrevate-flag nil) + '(rcirc-track-ignore-server-buffer-flag t) + '(rcirc-track-minor-mode t) '(read-mail-command 'gnus) '(read-minibuffer-restore-windows nil) '(remember-data-file "~/local/tmp/emacs-notes") @@ -3468,6 +3479,67 @@ mutt's review view, after exiting EDITOR." (let ((gnus-expert-user t)) (apply orig-fun args))) (advice-add #'gnus-summary-exit-no-update :around #'spw/gnus-with-expert) + +;;;; rcirc + +(defun spw/rcirc-generate-log-filename (process target) + (concat (file-name-concat (format-time-string "%Y/%m") + (process-name process) (or target "server")) + ".log")) + +(defun spw/irc-autoaway () + (dolist (process (rcirc-process-list)) + (rcirc-send-string process "AWAY :This Emacs is idle")) + (spw/add-once-hook 'post-command-hook + (lambda () + (dolist (process (rcirc-process-list)) + (rcirc-send-string process "AWAY :"))))) + +(when (spw/on-host-p "athena.silentflame.com") + (defvar spw/irc-autoaway-timer + (progn (load (expand-file-name "irc-init" user-emacs-directory)) + (irc nil) + (run-with-idle-timer 240 t #'spw/irc-autoaway)))) + +(defun spw/rcirc-log-for-mail (process sender response target text) + (with-rcirc-process-buffer process + (when (and (string= "PRIVMSG" response) + (or (string= sender target) + (string-match-p + (format "\\`\\(?:spwhitton\\|seanw\\|%s\\).? " rcirc-nick) + text))) + (with-temp-buffer + (let ((time (format-time-string rcirc-time-format)) + (name (rcirc-generate-new-buffer-name process target))) + (insert + (if (string= sender target) + (format "\n\n%s\t\t%s\n\n " time name) + (format "\n\n%s\t\t%s\n\n <%s> " time name sender)))) + (insert text) + (fill-region (pos-bol) (point)) + (write-region nil nil "~/local/irclogs/mail.log" t 'silent))))) +(spw/feature-add-hook spw/rcirc-log-for-mail (rcirc rcirc-print-functions)) + +(defun spw/rcirc-mail-hilights () + (when (file-exists-p "~/local/irclogs/mail.log") + (ignore-errors + (rename-file "~/local/irclogs/mail.log" "~/local/irclogs/mail.log.tmp")) + (let (mail-signature + (mail-from-style 'parens) + (user-full-name "Cron Daemon") + (user-mail-address user-login-name)) + (mail 'new user-login-name "IRC messages") + (mail-text) (insert-file "~/local/irclogs/mail.log.tmp") + (mail-text) (delete-blank-lines) (delete-blank-lines) + (let ((inhibit-quit t)) + (mail-send) + (kill-buffer) + (delete-file "~/local/irclogs/mail.log.tmp"))))) + +(when (spw/on-host-p "athena.silentflame.com") + (defvar spw/rcirc-mail-hilights-timer + (run-at-time t 21600 #'spw/rcirc-mail-hilights))) + ;;;; VC diff --git a/.gitignore b/.gitignore index 386b456b..c6db84c1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,5 @@ /.xmonad/xmonad.o /.config/sonata/art_cache /.config/gtk-3.0/bookmarks -/.irssi/config /.zsh/cache *.elc diff --git a/.irssi/clean.theme b/.irssi/clean.theme deleted file mode 100644 index 42566364..00000000 --- a/.irssi/clean.theme +++ /dev/null @@ -1,264 +0,0 @@ -# clean theme for irssi 0.8.4 by sabi -# 1.0.9 of 15 June 2002 -# very loosely based on IamCyan.theme by marmot - -replaces = { }; - -abstracts = { - ## - ## generic - ## - - # text to insert at the beginning of each non-message line - line_start = ""; - - # timestamp styling, nothing by default - # timestamp = "$0"; - timestamp = "%b$0"; - # any kind of text that needs hilighting, default is to bold - hilight = "%m$0%n"; - - # any kind of error message, default is bright red - error = "%R$0-%n"; - - # channel name is printed - channel = "%m$0-%n"; - - # nick is printed - nick = "%_$0-%_"; - - # nick host is printed - nickhost = "%n%9[%_$0-%9]%_"; - - # server name is printed - server = "$0-"; - - # some kind of comment is printed - comment = "[$0-]"; - - # reason for something is printed (part, quit, kick, ..) - reason = "($0-)"; - - # mode change is printed ([+o nick]) - mode = "%r$0-%n"; - - ## - ## channel specific messages - ## - - # highlighted nick/host is printed (joins) - channick_hilight = "%B$0-%n"; - chanhost_hilight = "{nickhost $0-}"; - - # nick/host is printed (parts, quits, etc.) - channick = "%b$0-"; - chanhost = "{nickhost $0-}"; - - # highlighted channel name is printed - channelhilight = "%_$0-%_"; - - # ban/ban exception/invite list mask is printed - ban = "$0-"; - - ## - ## messages - ## - - # the basic styling of how to print message, $0 = nick mode, $1 = nick - msgnick = "$_%b$0%n$1-%9>%n %|"; - - # message from you is printed. "msgownnick" specifies the styling of the - # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the - # whole line. - - # Example1: You want the message text to be green: - # ownmsgnick = "{msgnick $0 $1-}%g"; - # Example2.1: You want < and > chars to be yellow: - # ownmsgnick = "%Y{msgnick $0 $1-%Y}%n"; - # (you'll also have to remove <> from replaces list above) - # Example2.2: But you still want to keep <> grey for other messages: - # pubmsgnick = "%K{msgnick $0 $1-%K}%n"; - # pubmsgmenick = "%K{msgnick $0 $1-%K}%n"; - # pubmsghinick = "%K{msgnick $1 $0$2-%K}%n"; - # ownprivmsgnick = "%K{msgnick $0-%K}%n"; - # privmsgnick = "%K{msgnick %R$0-%K}%n"; - - # $0 = nick mode, $1 = nick - ownmsgnick = "%b$0%n$1%n%R>%n %|"; - ownnick = "$0-"; - - # public message in channel, $0 = nick mode, $1 = nick - pubmsgnick = "{msgnick $0 $1-}"; - pubnick = "$0-"; - - # public message in channel meant for me, $0 = nick mode, $1 = nick - pubmsgmenick = "%b$0%r$1-%b%9>%n %|"; - menick = "$0-"; - - # public highlighted message in channel - # $0 = highlight color, $1 = nick mode, $2 = nick - pubmsghinick = "%b$1$2-> %|"; - - # channel name is printed with message - msgchannel = "%w|%c$0-"; - - # private message, $0 = nick, $1 = host - privmsg = "<-%c$0%n[%C$1%n] "; - - # private message from you, $0 = "msg", $1 = target nick - ownprivmsg = "->[%c$1-%n] $0"; - - # own private message in query - ownprivmsgnick = "{ownmsgnick = %C$0-%n}"; - ownprivnick = "$0-"; - - # private message in query - privmsgnick = "{msgnick = %C$0-%n}"; - - ## - ## Actions (/ME stuff) - ## - - # used internally by this theme - action_core = "%m*%n $0-"; - - # generic one that's used by most actions - action = "{action_core $0-} "; - - # own action, both private/public - ownaction = "{action $0-}"; - - # own action with target, both private/public - ownaction_target = "{action_core $0}{msgchannel $1} "; - - # private action sent by others - pvtaction = " %g(*) $0- "; - pvtaction_query = "{action $0-}"; - - # public action sent by others - pubaction = "{action $0-}"; - - - ## - ## other IRC events - ## - - # notices - ownnotice = "-> %gnotice%n[%G$1%n] "; - notice = "<- %Gnotice%n[%g$0%n] "; - pubnotice_channel = "{msgchannel $0}"; - pvtnotice_host = ""; - servernotice = "{notice $0-}"; - - # CTCPs - ownctcp = "-> %b$0%n[%B$1-%n] "; - ctcp = "%B$0-"; - - # wallops - wallop = "%y$0-: %n"; - wallop_nick = "%y$0-%n"; - wallop_action = "%y * $0-%n "; - - # netsplits - netsplit = "%M%%%r $0-%n"; - netjoin = "%M%%%m $0-%n"; - - # /names list - names_nick = " %b$0%n$1"; - names_users = "%M#%m $0-"; - names_channel = "{channel $0-}"; - - # DCC - dcc = "$0-"; - dccfile = "%_$0-%_"; - - # DCC chat, own msg/action - dccownmsg = "*%c=$1-%n*> %g"; - dccownaction = "{action $0-}"; - dccownaction_target = "{ownaction_target $0-}"; - - # DCC chat, others - dccmsg = "*%c=$1-%n* "; - dccquerynick = "$0-"; - dccaction = " (*dcc*) $0- %|"; - ## - ## statusbar - ## - - # default background for all statusbars. You can also give - # the default foreground color for statusbar items. - sb_background = "%3%k"; - # background for active window - sb_window_bg = "%2%k"; - - # 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 = "%5"; - # background for topicbar (same default) - sb_topic_bg = "%4%W"; - #sb_topic_fg = "%k"; - - # 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 = " "; - - prompt = "{channel $*}%n%9>%_ "; - - sb = " %n$*%w |"; - sbmode = " (%m+%n$*)"; - sbaway = " %nis away"; - sbservertag = ":$0 (change with ^X)"; - - # activity in statusbar - - # ',' separator - sb_act_sep = "%k$*"; - # normal text - sb_act_text = "%k$*"; - # public message - sb_act_msg = "%R$*"; - # hilight - sb_act_hilight = "%M$*"; - # hilight with specified color, $0 = color, $1 = text - sb_act_hilight_color = "$0$1-%n"; - - -}; -formats = { - "fe-common/core" = { - join = "%M+%n {channick_hilight $0} {chanhost_hilight $1} joined {channel $2}"; - part = "%M-%n {channick $0} {chanhost $1} left {channel $2} {reason $3}"; - kick = "%M!%n {channick $0} was kicked from {channel $1} by {nick $2} {reason $3}"; - quit = "%M=%n {channick $0} {chanhost $1} quit {reason $2}"; - pubmsg_me = "{pubmsgmenick $2 {menick $0}}$1"; - pubmsg_me_channel = "{pubmsgmenick $3 {menick $0}{msgchannel $1}}$2"; - pubmsg_hilight = "{pubmsghinick $0 $3 $1}$2"; - pubmsg_hilight_channel = "{pubmsghinick $0 $4 $1{msgchannel $2}$3"; - pubmsg = "{pubmsgnick $2 {pubnick $0}}$1"; - pubmsg_channel = "{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2"; - msg_private = "{privmsg $0 $1 }$2"; - msg_private_query = "{privmsgnick $0}$2"; - }; - "fe-common/irc" = { - chanmode_change = "%M~%n {nick $2} set {mode $1} on {channel $0}"; - whois = "{nick $0} {nickhost $1@$2}%: ircname : $3"; - server_chanmode_change = "{netsplit ServerMode}/{channelhilight $0}: {mode $1} by {nick $2}"; - notice_public = "{notice $0{pubnotice_channel $1}}$2"; - notice_private = "{notice $0{pvtnotice_host $1}}$2"; - action_private = "{pvtaction $0}$2"; - action_private_query = "{pvtaction_query $0}$2"; - action_public = "{pubaction $0}$1"; - action_public_channel = "{pubaction $0{msgchannel $1}}$2"; - ctcp_reply = "CTCP {hilight $0} reply from {nick $1}: $2"; - ctcp_reply_channel = "CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2"; - ctcp_ping_reply = "CTCP {hilight PING} reply from {nick $0}: $1.$[-3.0]2 seconds"; - ctcp_requested = "{ctcp {hilight $0} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3"; - ctcp_requested_unknown = "{ctcp {hilight $0} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3"; - }; -}; diff --git a/.irssi/default.theme b/.irssi/default.theme deleted file mode 100644 index 29d48ba9..00000000 --- a/.irssi/default.theme +++ /dev/null @@ -1,319 +0,0 @@ -# When testing changes, the easiest way to reload the theme is with /RELOAD. -# This reloads the configuration file too, so if you did any changes remember -# to /SAVE it first. Remember also that /SAVE overwrites the theme file with -# old data so keep backups :) - -# TEMPLATES: - -# The real text formats that irssi uses are the ones you can find with -# /FORMAT command. Back in the old days all the colors and texts were mixed -# up in those formats, and it was really hard to change the colors since you -# might have had to change them in tens of different places. So, then came -# this templating system. - -# Now the /FORMATs don't have any colors in them, and they also have very -# little other styling. Most of the stuff you need to change is in this -# theme file. If you can't change something here, you can always go back -# to change the /FORMATs directly, they're also saved in these .theme files. - -# So .. the templates. They're those {blahblah} parts you see all over the -# /FORMATs and here. Their usage is simply {name parameter1 parameter2}. -# When irssi sees this kind of text, it goes to find "name" from abstracts -# block below and sets "parameter1" into $0 and "parameter2" into $1 (you -# can have more parameters of course). Templates can have subtemplates. -# Here's a small example: -# /FORMAT format hello {colorify {underline world}} -# abstracts = { colorify = "%G$0-%n"; underline = "%U$0-%U"; } -# When irssi expands the templates in "format", the final string would be: -# hello %G%Uworld%U%n -# ie. underlined bright green "world" text. -# and why "$0-", why not "$0"? $0 would only mean the first parameter, -# $0- means all the parameters. With {underline hello world} you'd really -# want to underline both of the words, not just the hello (and world would -# actually be removed entirely). - -# COLORS: - -# You can find definitions for the color format codes in docs/formats.txt. - -# There's one difference here though. %n format. Normally it means the -# default color of the terminal (white mostly), but here it means the -# "reset color back to the one it was in higher template". For example -# if there was /FORMAT test %g{foo}bar, and foo = "%Y$0%n", irssi would -# print yellow "foo" (as set with %Y) but "bar" would be green, which was -# set at the beginning before the {foo} template. If there wasn't the %g -# at start, the normal behaviour of %n would occur. If you _really_ want -# to use the terminal's default color, use %N. - -############################################################################# - -# 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"; }; - -abstracts = { - ## - ## generic - ## - - # text to insert at the beginning of each non-message line - line_start = "%B-%n!%B-%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 = "%C$*%n"; - chanhost_hilight = "{nickhost %c$*%n}"; - - # nick/host is printed (parts, quits, etc.) - channick = "%c$*%n"; - 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 = "%K<%n$0$1-%K>%n %|"; - - # message from you is printed. "msgownnick" specifies the styling of the - # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the - # whole line. - - # Example1: You want the message text to be green: - # ownmsgnick = "{msgnick $0 $1-}%g"; - # Example2.1: You want < and > chars to be yellow: - # ownmsgnick = "%Y{msgnick $0 $1-%Y}%n"; - # (you'll also have to remove <> from replaces list above) - # Example2.2: But you still want to keep <> grey for other messages: - # pubmsgnick = "%K{msgnick $0 $1-%K}%n"; - # pubmsgmenick = "%K{msgnick $0 $1-%K}%n"; - # pubmsghinick = "%K{msgnick $1 $0$2-%n%K}%n"; - # ownprivmsgnick = "%K{msgnick $*%K}%n"; - # privmsgnick = "%K{msgnick %R$*%K}%n"; - - # $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 = "%Y$*%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 = "%C$*%n"; - - # /names list - names_prefix = ""; - names_nick = "[%_$0%_$1-] "; - names_nick_op = "{names_nick $*}"; - names_nick_halfop = "{names_nick $*}"; - names_nick_voice = "{names_nick $*}"; - names_users = "[%g$*%n]"; - 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%w"; - - # 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 = "%8"; - # 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 = "[$*] "; - - sb = " %c[%n$*%c]%n"; - sbmode = "(%c+%n$*)"; - sbaway = " (%GzZzZ%n)"; - sbservertag = ":$0 (change with ^X)"; - 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"; -}; -formats = { - "fe-common/core" = { - pubmsg_me = "{pubmsgmenick $2 {menick $0}}$1"; - pubmsg_me_channel = "{pubmsgmenick $3 {menick $0}{msgchannel $1}}$2"; - pubmsg_hilight = "{pubmsghinick $0 $3 $1}$2"; - pubmsg_hilight_channel = "{pubmsghinick $0 $4 $1{msgchannel $2}$3"; - pubmsg = "{pubmsgnick $2 {pubnick $0}}$1"; - pubmsg_channel = "{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2"; - msg_private = "{privmsg $0 $1 }$2"; - msg_private_query = "{privmsgnick $0}$2"; - }; - "fe-common/irc" = { - notice_public = "{notice $0{pubnotice_channel $1}}$2"; - notice_private = "{notice $0{pvtnotice_host $1}}$2"; - action_private = "{pvtaction $0}$2"; - action_private_query = "{pvtaction_query $0}$2"; - action_public = "{pubaction $0}$1"; - action_public_channel = "{pubaction $0{msgchannel $1}}$2"; - ctcp_reply = "CTCP {hilight $0} reply from {nick $1}: $2"; - ctcp_reply_channel = "CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2"; - ctcp_ping_reply = "CTCP {hilight PING} reply from {nick $0}: $1.$[-3.0]2 seconds"; - ctcp_requested = "{ctcp {hilight $0} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3"; - ctcp_requested_unknown = "{ctcp {hilight $0} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3"; - }; -}; diff --git a/.irssi/scripts/autorun/act.pl b/.irssi/scripts/autorun/act.pl deleted file mode 100755 index 252a6d38..00000000 --- a/.irssi/scripts/autorun/act.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -w -# resets window activity status -# based on act.pl from http://scripts.irssi.org by c0ffee - -use strict; -use Irssi 20020120; - -Irssi::command_bind('ac', sub { _act(); }); - -sub _act { - for (Irssi::windows()) { - Irssi::signal_emit("window dehilight", $_); - } -} diff --git a/.irssi/scripts/autorun/anotherway.pl b/.irssi/scripts/autorun/anotherway.pl deleted file mode 100755 index ba360f25..00000000 --- a/.irssi/scripts/autorun/anotherway.pl +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -# -# by Stefan Tomanek - -use strict; -use vars qw($VERSION %IRSSI); -$VERSION = "2003010201"; -%IRSSI = ( - authors => "Stefan 'tommie' Tomanek", - contact => "stefan\@pico.ruhr.de", - name => "anotherway", - description => "Another auto away script", - license => "GPLv2", - changed => "$VERSION", -); -use Irssi 20020324; -use vars qw($timer @signals); - -@signals = ('message own_public', 'message own_private'); - -sub go_away { - #Irssi::print "%R>>%n Going away...$timer"; - Irssi::timeout_remove($timer); - my $reason = Irssi::settings_get_str("anotherway_reason"); - my @servers = Irssi::servers(); - return unless @servers; - Irssi::signal_remove($_ , "reset_timer") foreach (@signals); - $servers[0]->command('AWAY '.$reason); - Irssi::signal_add($_ , "reset_timer") foreach (@signals); - - # # return to the status window so that messages received clearly - # # visible in Act bar -- spw - # Irssi::command('window goto 1'); - # ^ annoying and no longer needed now away log gets mailed to me - - # set the trackbar so we can see where we were - # -- spw - Irssi::command('tb mark'); -} - -sub reset_timer { - #Irssi::print "%R>>%n RESET"; - Irssi::signal_remove($_ , "reset_timer") foreach (@signals); - foreach (Irssi::servers()) { - $_->command('AWAY') if $_->{usermode_away}; - last; - } - #Irssi::signal_add('nd', "reset_timer"); - Irssi::timeout_remove($timer); - my $timeout = Irssi::settings_get_int("anotherway_timeout"); - $timer = Irssi::timeout_add($timeout*1000, "go_away", undef); - Irssi::signal_add($_, "reset_timer") foreach (@signals); -} - -Irssi::settings_add_str($IRSSI{name}, 'anotherway_reason', 'a-nother-way'); -Irssi::settings_add_int($IRSSI{name}, 'anotherway_timeout', 300); - -{ - Irssi::signal_add($_, "reset_timer") foreach (@signals); - reset_timer(); -} - -print CLIENTCRAP '%B>>%n '.$IRSSI{name}.' '.$VERSION.' loaded'; diff --git a/.irssi/scripts/autorun/auto_bleh.pl b/.irssi/scripts/autorun/auto_bleh.pl deleted file mode 100644 index 9c00b2fa..00000000 --- a/.irssi/scripts/autorun/auto_bleh.pl +++ /dev/null @@ -1,293 +0,0 @@ -use Irssi; -use Irssi::Irc; -use strict; -use vars qw($VERSION %IRSSI $DEBUG); - -$VERSION = q$Revision: 1.1 $; -%IRSSI = (authors => 'tomaw, based on auto_bleh.pl by Don Armstrong', - name => 'auto_bleh', - description => 'Provides /ak /aq /ab /abr /abrn /arn /amb /amr /at', - license => 'GPL', - changed => q$Id: auto_bleh.pl,v 1.1 2005/03/17 08:19:53 don Exp $, -); - -#$DEBUG = 1 unless defined $DEBUG; - -my ($actions, %defaults); - -%defaults = (GET_OP => 1, # Should we try to get opped when we auto_bleh? - USE_CHANSERV => 1, # Should we use chanserv to get opped? - EXPIRE => 6000, # Do not try to do anything if the action is more than 6000 seconds old. - TIMEOUT => 10, # Timeout /at bans after 10 minutes -); - -my %command_bindings = (ak => 'cmd_ak', - ab => 'cmd_ab', - aq => 'cmd_aq', - ar => 'cmd_ar', - abr => 'cmd_abr', - abk => 'cmd_abk', - abrn => 'cmd_abrn', - abk => 'cmd_abkn', - arn => 'cmd_arn', - amb => 'cmd_amb', - amr => 'cmd_amr', - at => 'cmd_at', -); - -my %bans_to_remove; - -sub cmd_at { - my ($data, $server, $witem) = @_; - return do_auto_bleh('timeout',$data,$server,$witem); -} - -sub cmd_ak { - my ($data, $server, $witem) = @_; - return do_auto_bleh('kick',$data,$server,$witem); -} - -sub cmd_abk { - my ($data, $server, $witem) = @_; - return do_auto_bleh('kick,ban',$data,$server,$witem); -} -sub cmd_abkn { - my ($data, $server, $witem) = @_; - return do_auto_bleh('kick,ban,notice',$data,$server,$witem); -} - -sub cmd_amb{ - my ($data, $server, $witem) = @_; - my @nicks = split /\s+/, $data; - for (@nicks) { - next unless /\w/; - do_auto_bleh('ban',$_,$server,$witem); - } -} - -sub cmd_ab { - my ($data, $server, $witem) = @_; - return do_auto_bleh('ban',$data,$server,$witem); -} - -sub cmd_aq { - my ($data, $server, $witem) = @_; - return do_auto_bleh('quiet',$data,$server,$witem); -} - - -sub cmd_amr{ - my ($data, $server, $witem) = @_; - my @nicks = split /\s+/, $data; - for (@nicks) { - next unless /\w/; - do_auto_bleh('remove',$_,$server,$witem); - } -} - -sub cmd_ar { - my ($data, $server, $witem) = @_; - return do_auto_bleh('remove',$data,$server,$witem); -} -sub cmd_abr{ - my ($data, $server, $witem) =@_; - return do_auto_bleh('remove,ban',$data,$server,$witem); -} -sub cmd_abrn{ - my ($data, $server, $witem) =@_; - return do_auto_bleh('remove,ban,notice',$data,$server,$witem); -} -sub cmd_arn{ - my ($data, $server, $witem) =@_; - return do_auto_bleh('remove,notice',$data,$server,$witem); -} - - -sub do_auto_bleh { - my ($cmd, $data, $server, $witem, $duration) = @_; - - if (!$server || !$server->{connected}) { - Irssi::print("Not connected to server"); - return; - } - - if ($witem->{type} ne 'CHANNEL') { - Irssi::print("Can't autokick on a non-channel. [$witem->{type}]"); - return; - } - - # set the network that we're on, the channel and the nick to kick - # once we've been opped - - $data =~ /^\s*([^\s]+)\s*(\d+)?\s*(.+?|)\s*$/; - my $nick = $1; - my $timeout = $2; - my $reason = $3; - $timeout = $defaults{TIMEOUT} if not defined $timeout or $timeout eq ''; - $reason = 'you should know better' if not defined $reason or $reason eq ''; - - my $nick_rec = $witem->nick_find($nick); - if (not defined $nick_rec) { - Irssi::print("Unable to find nick: $nick"); - return; - } - - my $hostname = $nick_rec->{host} if defined $nick_rec; - Irssi::print("Unable to find hostname for $nick") if not defined $hostname or $hostname eq ''; - $hostname =~ s/.+\@//; - - Irssi::print("Nick set to '$nick' from '$data', reason set to '$reason'.") if $DEBUG; - my $action = {type => $cmd, - nick => $nick, - nick_rec => $nick_rec, - network => $witem->{server}->{chatnet}, - server => $witem->{server}, - completed => 0, - inserted => time, - channel => $witem->{name}, - reason => $reason, - hostname => $hostname, - timeout => $timeout, - }; - Irssi::print(i_want($action)) if $DEBUG; - if ($witem->{chanop}) { - take_action($action,$server,$witem); - } - else { - $actions->{$data.$action->{inserted}}=$action; - get_op($server, $action->{channel}) if $defaults{GET_OP}; - } -} - -sub get_op { - my ($server,$channel) = @_; - - Irssi::print("QUOTE CS op $channel") if $DEBUG; - $server->command("QUOTE CS op $channel") if $defaults{USE_CHANSERV}; -} - -sub i_want { - my $action = shift; - return "I've wanted to $action->{type} $action->{nick} off $action->{channel} on $action->{network} since $action->{inserted}"; -} - -sub take_action { - my ($action,$server,$channel) = @_; - - local $_ = $action->{type}; - # Now support multiple actions against a single nick (to FE, kick ban, or remove ban). See /abr foo - if (/timeout/) { - Irssi::print("Quieting $action->{nick} on $action->{channel} with hostname $action->{hostname} for $action->{timeout} minutes") if $DEBUG; - $channel->command("/quote MODE $action->{channel} +q *!*@".$action->{hostname}) if $action->{hostname} ne ''; #quiet hostname - $bans_to_remove{"$action->{nick}$action->{inserted}"} = $action; - } - if (/quiet/) { - Irssi::print("Quieting $action->{nick} on $action->{channel} with hostname $action->{hostname}") if $DEBUG; - # Find hostname - $channel->command("/quote MODE $action->{channel} +q *!*@".$action->{hostname}) if $action->{hostname} ne ''; #quiet hostname - } - if (/ban/) { - Irssi::print("Banning $action->{nick} from $action->{channel} with hostname $action->{hostname}") if $DEBUG; - $channel->command("/quote MODE $action->{channel} +b *!*@".$action->{hostname}) if $action->{hostname} ne ''; # ban hostname - } - if (/kick/) { - Irssi::print("Kicking $action->{nick} from $action->{channel}") if $DEBUG; - if ($action->{reason} =~ /\s/) { - $channel->command("/quote KICK $action->{channel} $action->{nick} :$action->{reason}"); - } - else { - $channel->command("/quote REMOVE $action->{channel} $action->{nick} $action->{reason}"); - } - } - if (/remove/) { - Irssi::print("Removing $action->{nick} from $action->{channel}") if $DEBUG; - if ($action->{reason} =~ /\s/) { - $channel->command("/quote REMOVE $action->{channel} $action->{nick} :$action->{reason}"); - } else { - $channel->command("/quote REMOVE $action->{channel} $action->{nick} $action->{reason}"); - } - } - if (/notice/) { - Irssi::print("Noticing $action->{nick} with $action->{reason}") if $DEBUG; - $channel->command("/NOTICE $action->{nick} $action->{reason}"); - } - if (/teiuq/) { - Irssi::print("Unquieting $action->{nick} on $action->{channel} with hostname $action->{hostname}") if $DEBUG; - $channel->command("/quote MODE $action->{channel} -q *!*@".$action->{hostname}); - } - return; #for now. -} - -sub deop_us { - my ($rec) = @_; - my $channel = $rec->{channel}; - my $server = $rec->{server}; - - Irssi::print("MODE $channel->{name} -o $channel->{ownnick}->{nick}") if $DEBUG; - $channel->command("/deop $channel->{ownnick}->{nick}"); -} - -sub sig_mode_change { - my ($channel,$nick) = @_; - - # Are there any actions to process? - # See if we got opped. - return if scalar(keys %$actions) eq 0; - - my @deop_array; - if ($channel->{server}->{nick} eq $nick->{nick} and $nick->{op}) { - Irssi::print("We've been opped") if $DEBUG; - foreach (keys %$actions) { - # See if this action is too old - if (time - $actions->{$_}->{inserted} > $defaults{EXPIRE}) { - Irssi::print("Expiring action: \"".i_want($actions->{$_})."\" because of time") if $DEBUG; - delete $actions->{$_}; - next; - } - Irssi::print(i_want($actions->{$_})) if $DEBUG; - # Find the server to take action on - my $server = $actions->{$_}->{server}; - Irssi::print("Unable to find server for chatnet: $actions->{$_}->{network}") and return if not defined $server; - Irssi::print("Found server for chatnet: $actions->{$_}->{network}") if $DEBUG; - # Find the channel to take action on - my $channel = $server->channel_find($actions->{$_}->{channel}); - Irssi::print("Unable to find channel for channel: $actions->{$_}->{channel}") and return if not defined $channel; - Irssi::print("Found channel for channel: $actions->{$_}->{channel}") if $DEBUG; - Irssi::print("We are opped on the channel!") if $DEBUG; - take_action($actions->{$_},$server,$channel); - push @deop_array,{server=>$server,channel=>$channel} if Irssi::settings_get_bool('auto_bleh_deop_after_action'); - delete $actions->{$_}; # Do not repeat this action. - } - foreach (@deop_array) { - deop_us($_); - } - } else { - Irssi::print("Fooey. Not opped.") if $DEBUG; - } -} - -sub try_to_remove_bans { - return unless keys %bans_to_remove; - for my $key (keys %bans_to_remove) { - if (($bans_to_remove{$key}{inserted} + $bans_to_remove{$key}{timeout}*60) < time) { - $bans_to_remove{$key}{type} = 'teiuq'; #unquiet - $actions->{$key} = $bans_to_remove{$key}; - delete $bans_to_remove{$key}; - get_op($actions->{$key}{server}, $actions->{$key}{channel}) if $defaults{GET_OP}; - } - } -} - -# call the try to remove bans function every minute -Irssi::timeout_add(1000*60,'try_to_remove_bans',undef); -Irssi::signal_add_last('nick mode changed','sig_mode_change'); -my ($command,$function); - -while (($command,$function) = each %command_bindings) { - Irssi::command_bind($command,$function, 'auto_bleh'); -} - -Irssi::settings_add_bool($IRSSI{name}, 'auto_bleh_deop_after_action', 1); - -1; - diff --git a/.irssi/scripts/autorun/format_identify.pl b/.irssi/scripts/autorun/format_identify.pl deleted file mode 100644 index 0b19c445..00000000 --- a/.irssi/scripts/autorun/format_identify.pl +++ /dev/null @@ -1,440 +0,0 @@ - -#!/usr/bin/perl -# ^ to make vim know this is a perl script so I get syntax hilighting. - -##################################################################### -### WARNING: This version was restored from google cache ### -### by Wouter Coekaerts . ### -### Syntax might not be exactly the same as the original ### -##################################################################### - -# $Id$ -use strict; -use vars qw($VERSION %IRSSI); -use Irssi qw(signal_stop signal_emit signal_remove - signal_add signal_add_first - settings_add_str settings_get_str settings_add_bool - settings_get_bool - print ); -$VERSION = '1.5-dev-coekie'; -%IRSSI = ( - authors => 'ResDev (Ben Reser)', - contact => 'ben@reser.org', - name => 'format_identify', - description => 'Formats msgs and notices when the identify-msg and/or ' . - 'identify-ctcp capability is available.', - license => 'GPL2', - url => 'http://ben.reser.org/irssi/', -); - -# Additional credit to ch for his wash-imsg script which was a starting place -# for this; coekie for pointing me towards the nickcolor script and its -# technique for doing this; Timo Sirainen and Ian Peters for writing nickcolor. - -# This script takes advantage of the identify-msg and identify-ctcp -# capabilities of the new dancer ircd. The identify-msg capability causes the -# first character of a msg or notice to be set to a + if the user is identified -# with nickserve and a - if not. identify-ctcp does similar for CTCP messages. -# This script removes the tagging and then allows you to configure a -# modification to the formating of the nickname. - -# Installation instructions: Drop this in ~/.irssi/scripts and run -# /script load format_identify. To make it autorun on startup place it in -# ~/.irssi/scripts/autorun. This script will detect if the IRC server has -# the identify-msg and identify-ctcp capability. If it is available it will -# use it. Messages on servers without support for these capabilities will -# be tagged as unknown. -# -# While you can unload this script. Any servers that you are connected to -# with identify-msg/identify-ctcp turned on will continue to send data -# encoded that way. This means messages and notices will have a + or - -# appended to the front of them. CTCPs will be broken. Unfortunately, there -# is no way to turn off a capability once it is turned on. You will have to -# disconnect and reconnect to these servers. This script will warn you when -# unloading the script of this situation. - -# -# Configuration: You can control the formating of the nickname with the -# format_identified_nick, format_unidentified_nick, and format_unknown_nick -# variables. The default is to do nothing to identified nicks and unknown -# nicks. while unidentified nicks have a ~ to the beginning of nick. An -# unknown nick means anytime a message or notice doesn't start with a + or -, -# which will occur when identify-msg isn't enabled. The format_unknown_nick -# can be really handy to alert you that you don't have identify-msg or -# identify-ctcp set, but is set by default to do nothing since most servers do -# not have identify-msg yet. In these variables $0 stands for the nick. You -# can use the standard formating codes or just text in it. See formats.txt for -# more information on the codes you can use. Warning about colors. Using -# colors in this formating will likely break other formating scripts and -# features, in particular the hilight feature of irssi or vice versa. Remember -# that %n has a different meaning here as explamined in the default.theme file -# that comes with irssi. -# -# Some examples: -# -# Make unidentified nicks have a ? after the nick: /set -# format_unidentified_nick $0? -# -# Make unidentified nicks red and identified nicks green: /set -# format_identified_nick %G$0 /set format_unidentified_nick %R$0 Note that the -# above will not do the tagging if a message gets hilighted. Since a hilight -# (line or nick) will override the colors. -# -# So I recommend doing something like this: /set format_identified_nick %G$0 -# /set format_unidentified_nick %R~$0 -# -# Make unidentified nicks be unmodified but add a * before identified nicks: -# /set format_identified_nick *$0 /set format_unidentified_nick $0 -# -# This script works by modifying the formats irssi uses to display various -# things. Therefore it is highly recommended that you do not change any of the -# following format variables except through this script: pubmsg pubmsg_channel -# msg_private msg_private_query pubmsg_hilight pubmsg_hilight_channel pubmsg_me -# pubmsg_me_channel action_private action_private_query action_public -# action_public_channel ctcp_requested ctcp_requested_unknown notice_public -# notice_private ctcp_reply ctcp_reply_channel ctcp_ping_reply - -# -# To change these formats you need to set the variable (with the set command -# not the format command as usual) of the same name as the format but with -# _identify on the end. This format has an additional special purpose -# "abstract" that is only used by this script and is parsed and replaced before -# setting the format and giving it to irssi. It is called format_identify. -# Any format you use with this script should have a {format_identify $0} in it -# to replace where the $0 usually is in the format. Sometimes it will be $1 -# for the nick in the format, in which case you should replace the $1 with -# {format_identify $1}. For more examples take a look at the defaults at the -# bottom of this script. -# -# -# If you wish to disable the module from applying a change to the nickname in a -# particular place the best way to do it is to simply remove the -# {format_identify $0} from the format that applies. E.G. to disable the -# format change for a CTCP reply one would do: /set ctcp_reply_identify CTCP -# {hilight $0} reply from {nick $1}: $2 -# - -# TODO -# * Implement DCC formats, which means figuring out which ones are appropriate -# to try and format. -# * Allow different formating on the nick for different types of messages. I'm -# not sure if this is useful... -# -# It should not be necessary to modify anything in this script. Everything -# should be able to be modified via the variables it exports as described -# above. -# - -my(@format_identify_message_formats) = qw(pubmsg pubmsg_channel msg_private - msg_private_query pubmsg_hilight - pubmsg_hilight_channel action_private - action_private_query action_public - action_public_channel ctcp_requested - ctcp_requested_unknown pubmsg_me - pubmsg_me_channel - ); - -my(@format_identify_notice_formats) = qw(notice_public notice_private ctcp_reply - ctcp_reply_channel ctcp_ping_reply); - - -my %servers; - -# Replace the {format_identify $0} place holder with -# whatever the user has setup for their nick formats... -sub replace_format_identify { - my ($format, $entry) = @_; - - my ($nickarg) = $format =~ /{\s*format_identify\s+?([^\s]+?)\s*}/; - $entry =~ s/\$0/$nickarg/; - $format =~ s/{\s*format_identify\s+?[^\s]+?\s*}/$entry/g; - return $format; -} - -# rewrite the message now that we've updated the formats -sub format_identify_rewrite { - my $signal = shift; - my $proc = shift; - - signal_stop(); - signal_remove($signal,$proc); - signal_emit($signal, @_); - signal_add($signal,$proc); -} - - -# Issue the format update after generating the new format. -sub update_format_identify { - my ($server,$entry,$nick) = @_; - - my $identify_format = settings_get_str("${entry}_identify"); - my $replaced_format = replace_format_identify($identify_format,$nick); - $server->command("^format $entry " . $replaced_format); -} - -my %saved_colors; -my %session_colors = {}; -my @colors = qw/2 3 4 5 6 7 9 10 11 12 13/; - -sub simple_hash { - my ($string) = @_; - chomp $string; - my @chars = split //, $string; - my $counter; - - foreach my $char (@chars) { - $counter += ord $char; - } - - $counter = $colors[($counter % @colors)]; - return $counter; -} - -sub colourise { - return if(!settings_get_bool('format_colour')); - my ($nick) = @_; - my $color = $saved_colors{$nick}; - if (!$color) { - $color = $session_colors{$nick}; - } - if (!$color) { - $color = simple_hash $nick; - $session_colors{$nick} = $color; - } - $color = "0".$color if ($color < 10); - return chr(3).$color; -} - - -# catches the signal for a message removes the + or -, updates the -# formats and then resends the message event. -sub format_identify_message { - my ($server, $data, $nick, $address) = @_; - my ($channel, $msg) = split(/ :/, $data,2); - - if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'} && - !$servers{$server->{'real_address'}}->{'IDENTIFY-MSG'}) { - my $unknown_nick = settings_get_str('format_unknown_nick'); - foreach my $format (@format_identify_message_formats) { - update_format_identify($server,$format,colourise($nick).$unknown_nick); - } - } elsif(($msg =~ /^\+(.*)/)){ - my $newdata = "$channel :$1"; - my $identified_nick = settings_get_str('format_identified_nick'); - foreach my $format (@format_identify_message_formats) { - update_format_identify($server,$format,colourise($nick).$identified_nick); - } - format_identify_rewrite('event privmsg','format_identify_message', $server,$newdata,$nick,$address); - } elsif(($msg =~ /^-(.*)/)){ - my $newdata = "$channel :$1"; - my $unidentified_nick = settings_get_str('format_unidentified_nick'); - foreach my $format (@format_identify_message_formats) { - update_format_identify($server,$format,colourise($nick).$unidentified_nick); - } - format_identify_rewrite('event privmsg','format_identify_message', $server,$newdata,$nick,$address); - } else { - my $unknown_nick = settings_get_str('format_unknown_nick'); - foreach my $format (@format_identify_message_formats) { - update_format_identify($server,$format,colourise($nick).$unknown_nick); - } - } -} - -# catches the signal for a notice removes the + or -, updates the -# formats and resends the notice event. -sub format_identify_notice { - my ($server, $data, $nick, $address) = @_; - my ($channel, $msg) = split(/ :/, $data,2); - - if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'} && - !$servers{$server->{'real_address'}}->{'IDENTIFY-MSG'}) { - my $unknown_nick = settings_get_str('format_unknown_nick'); - foreach my $format (@format_identify_notice_formats) { - update_format_identify($server,$format,colourise($nick).$unknown_nick); - } - } elsif(($msg =~ /^\+(.*)/)){ - my $newdata = "$channel :$1"; - my $identified_nick = settings_get_str('format_identified_nick'); - foreach my $format (@format_identify_notice_formats) { - update_format_identify($server,$format,colourise($nick).$identified_nick); - } - format_identify_rewrite('event notice','format_identify_notice', $server,$newdata,$nick,$address); - } elsif(($msg =~ /^-(.*)/)){ - my $newdata = "$channel :$1"; - my $unidentified_nick = settings_get_str('format_unidentified_nick'); - foreach my $format (@format_identify_notice_formats) { - update_format_identify($server,$format,colourise($nick).$unidentified_nick); - } - format_identify_rewrite('event notice','format_identify_notice', $server,$newdata,$nick,$address); - } else { - my $unknown_nick = settings_get_str('format_unknown_nick'); - foreach my $format (@format_identify_notice_formats) { - update_format_identify($server,$format,colourise($nick).$unknown_nick); - } - } -} - -# Handle CTCP messages. Note that messages tagged with identify-ctcp will -# not be seen as CTCPs and will go through event privmsg first. This script -# will generate new events and send them on through to here. However CTCPs -# that are not tagged at all will go here first. So we need to test here -# to see if the message is from a server that does not support identify-ctcp -# and update the format accordingly. -sub format_identify_ctcp_msg { - my ($server) = @_; - - if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'}) { - my $unknown_nick = settings_get_str('format_unknown_nick'); - foreach my $format (@format_identify_message_formats) { - update_format_identify($server,$format,$unknown_nick); - } - } -} - -# Handle CTCP replies. Note that messages tagged with identify-ctcp will -# not be seen as CTCPs and will go through event notice first. This script -# will generate new events and send them on through to here. However CTCPs -# that are not tagged at all will go here first. So we need to test here -# to see if the message is from a server that does not support identify-ctcp -# and update the format accordingly. -sub format_identify_ctcp_reply { - my ($server) = @_; - - if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'}) { - my $unknown_nick = settings_get_str('format_unknown_nick'); - foreach my $format (@format_identify_notice_formats) { - update_format_identify($server,$format,$unknown_nick); - } - } -} - -# If we're getting unloaded reset the formats back to their defaults -# so that it doesn't wrongly show people being unidentifed or vice versa. -# Also issue a warning about CTCPs etc being broken. -sub format_identify_unload { - my ($script,$server,$witem) = @_; - my @warning_servers = (); - - if ($script =~ /^format_identify(?:\.pl|\.perl)?$/) { - foreach my $format (@format_identify_message_formats, - @format_identify_notice_formats) { - $server->command("^format -reset $format"); - } - foreach my $server_name (keys %servers) { - if ( $servers{$server_name}->{'IDENTIFY-MSG'} - || $servers{$server_name}->{'IDENTIFY-CTCP'}) - { - if($servers{$server_name}->{'USES-CAP'}) { - $server->command("^quote cap req :-identify-msg"); - } else { - push @warning_servers, $server_name; - } - } - } - print('Warning: Unloading format_identify will leave your messages '. - 'and notices modified and will break CTCPs on the following '. - 'servers: ' . join (',',@warning_servers)); - } -} - -# Server responded to capab request. We want to capture the reply -# and mark it in a hash so we can keep track of which servers have -# the capabilities. This style of reply will come from dancer or -# hyperion. -sub format_identify_capab_reply { - my ($server, $data, $server_name) = @_; - unless (ref($servers{$server_name}) eq 'HASH') { - $servers{$server_name} = {}; - $servers{$server_name}->{'IDENTIFY-MSG'} = 0; - $servers{$server_name}->{'IDENTIFY-CTCP'} = 0; - $servers{$server_name}->{'USES-CAP'} = 0; - } - if ($data =~ /:IDENTIFY-MSG$/) { - $servers{$server_name}->{'IDENTIFY-MSG'} = 1; - $servers{$server_name}->{'USES-CAP'} = 0; - Irssi::signal_stop(); - return; - } - if ($data =~ /:IDENTIFY-CTCP$/) { - $servers{$server_name}->{'IDENTIFY-CTCP'} = 1; - $servers{$server_name}->{'USES-CAP'} = 0; - Irssi::signal_stop(); - return; - } -} - -# The same as above. This style of reply comes from ircd-seven. -sub format_identify_cap_reply { - my ($server, $data, $server_name) = @_; - unless (ref($servers{$server_name}) eq 'HASH') { - $servers{$server_name} = {}; - $servers{$server_name}->{'IDENTIFY-MSG'} = 0; - $servers{$server_name}->{'IDENTIFY-CTCP'} = 0; - $servers{$server_name}->{'USES-CAP'} = 0; - } - if ($data =~ /ACK :.*identify-msg/) { - $servers{$server_name}->{'IDENTIFY-MSG'} = 1; - $servers{$server_name}->{'IDENTIFY-CTCP'} = 1; - $servers{$server_name}->{'USES-CAP'} = 1; - return; - } -} - -# Handles connections to new (to this script) servers and -# attempts to turn on the capabilities it supports. -# We send the request in both formats, for hyperion and ircd-seven. -sub format_identify_connected { - my $server = shift; - $server->command("^quote capab IDENTIFY-MSG"); - $server->command("^quote capab IDENTIFY-CTCP"); - $server->command("^quote cap req :identify-msg"); -} - -# signals to handle the events we need to intercept. -signal_add('event privmsg', 'format_identify_message'); -signal_add('event notice', 'format_identify_notice'); -signal_add('ctcp msg', 'format_identify_ctcp_msg'); -signal_add('ctcp reply', 'format_identify_ctcp_reply'); -signal_add('event 290', 'format_identify_capab_reply'); -signal_add('event cap', 'format_identify_cap_reply'); -signal_add('event connected', 'format_identify_connected'); - -# On load enumerate the servers and try to turn on -# IDENTIFY-MSG and IDENTIFY-CTCP -foreach my $server (Irssi::servers()) { - %servers = (); - format_identify_connected($server); -} - -# signal needed to catch the unload... Be sure to be the first to -# get it too... -signal_add_first('command script unload', 'format_identify_unload'); - -settings_add_bool('format_identify', 'format_colour', 1); - -# How we format the nick. $0 is the nick we'll be formating. -settings_add_str('format_identify','format_identified_nick','$0'); -settings_add_str('format_identify','format_unidentified_nick','~$0'); -settings_add_str('format_identify','format_unknown_nick','$0'); - -# What we use for the formats... -# Don't modify here, use the /set command or modify in the ~/.irssi/config file. -settings_add_str('format_identify','pubmsg_identify','{pubmsgnick $2 {pubnick {format_identify $0}}}$1'); -settings_add_str('format_identify','pubmsg_channel_identify','{pubmsgnick $3 {pubnick {format_identify $0}}{msgchannel $1}}$2'); -settings_add_str('format_identify','msg_private_identify','{privmsg {format_identify $0} $1 }$2'); -settings_add_str('format_identify','msg_private_query_identify','{privmsgnick {format_identify $0}}$2'); -settings_add_str('format_identify','pubmsg_hilight_identify','{pubmsghinick {format_identify $0} $3 $1}$2'); -settings_add_str('format_identify','pubmsg_hilight_channel_identify','{pubmsghinick {format_identify $0} $4 $1{msgchannel $2}$3'); -settings_add_str('format_identify','action_private_identify','{pvtaction {format_identify $0}}$2'); -settings_add_str('format_identify','action_private_query_identify','{pvtaction_query {format_identify $0}}$2'); -settings_add_str('format_identify','action_public_identify','{pubaction {format_identify $0}}$1'); -settings_add_str('format_identify','action_public_channel_identify', '{pubaction {format_identify $0}{msgchannel $1}}$2'); -settings_add_str('format_identify','ctcp_requested_identify','{ctcp {hilight {format_identify $0}} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3'); -settings_add_str('format_identify','ctcp_requested_unknown_identify','{ctcp {hilight {format_identify $0}} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3'); -settings_add_str('format_identify','pubmsg_me_identify','{pubmsgmenick $2 {menick {format_identify $0}}}$1'); -settings_add_str('format_identify','pubmsg_me_channel_identify','{pubmsgmenick $3 {menick {format_identify $0}}{msgchannel $1}}$2'); -settings_add_str('format_identify','notice_public_identify','{notice {format_identify $0}{pubnotice_channel $1}}$2'); -settings_add_str('format_identify','notice_private_identify','{notice {format_identify $0}{pvtnotice_host $1}}$2'); -settings_add_str('format_identify','ctcp_reply_identify','CTCP {hilight $0} reply from {nick {format_identify $1}}: $2'); -settings_add_str('format_identify','ctcp_reply_channel_identify','CTCP {hilight $0} reply from {nick {format_identify $1}} in channel {channel $3}: $2'); -settings_add_str('format_identify','ctcp_ping_reply_identify','CTCP {hilight PING} reply from {nick {format_identify $0}}: $1.$[-3.0]2 seconds'); diff --git a/.irssi/scripts/autorun/go.pl b/.irssi/scripts/autorun/go.pl deleted file mode 100644 index b656a0fc..00000000 --- a/.irssi/scripts/autorun/go.pl +++ /dev/null @@ -1,59 +0,0 @@ -use strict; -use vars qw($VERSION %IRSSI); -use Irssi; -use Irssi::Irc; - -# Usage: -# /script load go.pl -# If you are in #irssi you can type /go #irssi or /go irssi or even /go ir ... -# also try /go ir and /go (that's two spaces) - -$VERSION = '1.01'; - -%IRSSI = ( - authors => 'nohar', - contact => 'nohar@freenode', - name => 'go to window', - description => 'Implements /go command that activates a window given a name/partial name. It features a nice completion.', - license => 'GPLv2 or later', - changed => '2014-10-19' -); - -sub signal_complete_go { - my ($complist, $window, $word, $linestart, $want_space) = @_; - my $channel = $window->get_active_name(); - my $k = Irssi::parse_special('$k'); - - return unless ($linestart =~ /^\Q${k}\Ego\b/i); - - @$complist = (); - foreach my $w (Irssi::windows) { - my $name = $w->get_active_name(); - if ($word ne "") { - if ($name =~ /\Q${word}\E/i) { - push(@$complist, $name) - } - } else { - push(@$complist, $name); - } - } - Irssi::signal_stop(); -}; - -sub cmd_go -{ - my($chan,$server,$witem) = @_; - - $chan =~ s/ *//g; - foreach my $w (Irssi::windows) { - my $name = $w->get_active_name(); - if ($name =~ /^#?\Q${chan}\E/) { - $w->set_active(); - return; - } - } -} - -Irssi::command_bind("go", "cmd_go"); -Irssi::signal_add_first('complete word', 'signal_complete_go'); - diff --git a/.irssi/scripts/autorun/hilightwin.pl b/.irssi/scripts/autorun/hilightwin.pl deleted file mode 100644 index d735e1b7..00000000 --- a/.irssi/scripts/autorun/hilightwin.pl +++ /dev/null @@ -1,59 +0,0 @@ -# -# 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 strict; -use Irssi; -use POSIX; -use vars qw($VERSION %IRSSI); - -$VERSION = "0.03"; -%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 - ) { - my $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; - $text =~ s/%/%%/g; - $window->print($text, MSGLEVEL_NEVER) if ($window); - } -} - -my $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/autorun/trackbar.pl b/.irssi/scripts/autorun/trackbar.pl deleted file mode 100644 index ee660910..00000000 --- a/.irssi/scripts/autorun/trackbar.pl +++ /dev/null @@ -1,408 +0,0 @@ -# trackbar.pl -# -# Track what you read last when switching to a window. -# -# Copyright (C) 2003 Peter Leurs -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# This little script will do just one thing: it will draw a line each time you -# switch away from a window. This way, you always know just upto where you've -# been reading that window :) It also removes the previous drawn line, so you -# don't see double lines. -# -# Usage: -# -# The script works right out of the box, but if you want you can change -# the working by /set'ing the following variables: -# -# trackbar_string The characters to repeat to draw the bar -# "---" => U+2500 => a line -# "===" => U+2550 => a double line -# "___" => U+2501 => a wide line -# "# #" => U+25ad.U+0020 => a white rectangle and a space -# trackbar_style The style for the bar, %r is red for example -# See formats.txt that came with irssi -# trackbar_hide_windows Comma seperated list of window names where the -# trackbar should not be drawn. -# trackbar_timestamp Prints a timestamp at the start of the bar -# trackbar_timestamp_styled When enabled, the timestamp respects -# trackbar_style -# -# /tb or /tb scroll is a command that will scroll to trackbar. -# -# /tb mark is a command that will redraw the line at the bottom. However! -# This requires irssi version after 20021228. otherwise you'll get the -# error redraw: unknown command, and your screen is all goofed up :) -# -# /upgrade & buf.pl notice: This version tries to remove the trackbars -# before the upgrade is done, so buf.pl does not restore them, as they are -# not removeable afterwards by trackbar. Unfortunately, to make this work, -# trackbar and buf.pl need to be loaded in a specific order. Please -# experiment to see which order works for you (strangely, it differs from -# configuration to configuration, something I will try to fix in a next -# version) -# -# Authors: -# - Main maintainer & author: Peter 'kinlo' Leurs -# - Many thanks to Timo 'cras' Sirainen for placing me on my way -# - on-upgrade-remove-line patch by Uwe Dudenhoeffer -# - trackbar resizing by Michiel Holtkamp (02 Jul 2012) -# - scroll to trackbar, window excludes, and timestamp options by Nico R. -# Wohlgemuth (22 Sep 2012) -# -# Version history: -# 1.9: - add version guard -# 1.8: - sub draw_bar -# 1.7: - Added /tb scroll, trackbar_hide_windows, trackbar_timestamp_timestamp -# and trackbar_timestamp_styled -# 1.6: - Work around Irssi resize bug, please do /upgrade! (see below) -# 1.5: - Resize trackbars in all windows when terminal is resized -# 1.4: - Changed our's by my's so the irssi script header is valid -# - Removed utf-8 support. In theory, the script should work w/o any -# problems for utf-8, just set trackbar_string to a valid utf-8 character -# and everything *should* work. However, this script is being plagued by -# irssi internal bugs. The function Irssi::settings_get_str does NOT handle -# unicode strings properly, hence you will notice problems when setting the bar -# to a unicode char. For changing your bar to utf-8 symbols, read the line sub. -# 1.3: - Upgrade now removes the trackbars. -# - Some code cleanups, other defaults -# - /mark sets the line to the bottom -# 1.2: - Support for utf-8 -# - How the bar looks can now be configured with trackbar_string -# and trackbar_style -# 1.1: - Fixed bug when closing window -# 1.0: - Initial release -# -# Contacts -# https://github.com/mjholtkamp/irssi-trackbar -# -# Known bugs: -# - if you /clear a window, it will be uncleared when returning to the window -# - changing the trackbar style is only visible after returning to a window -# however, changing style/resize takes in effect after you left the window. -# -# Whishlist/todo: -# - instead of drawing a line, just invert timestamp or something, -# to save a line (but I don't think this is possible with current irssi) -# - <@coekie> kinlo: if i switch to another window, in another split window, i -# want the trackbar to go down in the previouswindow in that splitwindow :) -# - < bob_2> anyway to clear the line once the window is read? -# -# BTW: when you have feature requests, mailing a patch that works is the fastest way -# to get it added :p - -# IRSSI RESIZE BUG: -# when resizing from a larger window to a smaller one, the width of the -# trackbar causes some lines at the bottom not to be shown. This only happens -# if the trackbar was not the last line. This glitch can be 'fixed' by -# resetting the trackbar to the last line (e.g. by switching to another window -# and back) and then resize twice (e.g. to a bigger size and back). Of course, -# this is not convenient for the user. -# This script works around this problem by printing not one, but two lines and -# then removing the second line. My guess is that irssi does something to the -# previous line (or the line cache) whenever a line is 'completed' (i.e. the -# EOL is sent). When only one line is printed, it is not 'completed', but when -# printing the second line, the first line is 'completed'. The second line is -# still not completed, but since we delete it straight away, it doesn't matter. -# -# Some effects from older versions (<1.6) of trackbar.pl can still screw up your -# buffer so we recommend to restart your irssi, or do an "/upgrade". After -# installing this version of trackbar.pl - -use strict; -use 5.6.1; -use Irssi 20140701; -use Irssi::TextUI; -use POSIX qw(strftime); -use utf8; - -our $VERSION = "1.9"; - -our %IRSSI = ( - authors => "Peter 'kinlo' Leurs, Uwe Dudenhoeffer, " . - "Michiel Holtkamp, Nico R. Wohlgemuth", - contact => "irssi-trackbar\@supermind.nl", - name => "trackbar", - description => "Shows a bar where you've last read a window", - license => "GPLv2", - url => "http://github.com/mjholtkamp/irssi-trackbar/", - changed => "2015-01-15 08:00", -); - -my %config; - -my $screen_resizing = 0; # terminal is being resized - -# This could be '(status)' if you want to hide the status window -Irssi::settings_add_str('trackbar', 'trackbar_hide_windows' => ''); -$config{'trackbar_hide_windows'} = Irssi::settings_get_str('trackbar_hide_windows'); - -Irssi::settings_add_str('trackbar', 'trackbar_string' => '-'); -$config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string'); - -Irssi::settings_add_str('trackbar', 'trackbar_style' => '%K'); -$config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style'); - -Irssi::settings_add_bool('trackbar', 'trackbar_timestamp' => 0); -$config{'trackbar_timestamp'} = Irssi::settings_get_bool('trackbar_timestamp'); - -Irssi::settings_add_bool('trackbar', 'trackbar_timestamp_styled' => 1); -$config{'trackbar_timestamp_styled'} = Irssi::settings_get_bool('trackbar_timestamp_styled'); - -$config{'timestamp_format'} = Irssi::settings_get_str('timestamp_format'); - -Irssi::signal_add( - 'setup changed' => sub { - $config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string'); - $config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style'); - $config{'trackbar_hide_windows'} = Irssi::settings_get_str('trackbar_hide_windows'); - $config{'trackbar_timestamp'} = Irssi::settings_get_bool('trackbar_timestamp'); - $config{'trackbar_timestamp_styled'} = Irssi::settings_get_bool('trackbar_timestamp_styled'); - $config{'timestamp_format'} = Irssi::settings_get_str('timestamp_format'); - if ($config{'trackbar_style'} =~ /(? sub { - my (undef, $oldwindow) = @_; - - draw_bar($oldwindow); - } -); - -# handel the line creation and the removing of the old lines -sub draw_bar ($) { - (my $window) = @_; - if ($window) { - my $line = $window->view()->get_bookmark('trackbar'); - - if (defined $line) { - $window->view()->remove_line($line); - $window->view()->redraw(); - } - - my $hidden =$config{'trackbar_hide_windows'}; - my $wname =$window->{'name'}; - - if ($wname eq "" || $hidden !~ $wname) { - $window->print(line($window->{'width'}), MSGLEVEL_NEVER); - $window->view()->set_bookmark_bottom('trackbar'); - } - } -} - -# terminal resize code inspired on nicklist.pl -sub sig_terminal_resized { - if ($screen_resizing) { - # prevent multiple resize_trackbars from running - return; - } - $screen_resizing = 1; - Irssi::timeout_add_once(10,\&resize_trackbars,[]); -} - -sub resize_trackbars { - my $active_win = Irssi::active_win(); - for my $window (Irssi::windows) { - next unless defined $window; - my $line = $window->view()->get_bookmark('trackbar'); - next unless defined $line; - - # first add new trackbar line, then remove the old one. For some reason - # this works better than removing the old one, then adding a new one - $window->print_after($line, MSGLEVEL_NEVER, line($window->{'width'})); - my $next = $line->next(); - $window->view()->set_bookmark('trackbar', $next); - $window->view()->remove_line($line); - - # This hack exists to work around a bug: see IRSSI RESIZE BUG above. - # Add a line after the trackbar and delete it immediately - $window->print_after($next, MSGLEVEL_NEVER, line(1)); - $window->view()->remove_line($next->next); - } - $active_win->view()->redraw(); - $screen_resizing = 0; -} - -Irssi::signal_add('terminal resized' => \&sig_terminal_resized); - -sub line { - my $width = shift; - my $string = $config{'trackbar_string'}; - - my $tslen = 0; - - if ($config{'trackbar_timestamp'}) { - $tslen = int(1 + length $config{'timestamp_format'}); - } - - if (!defined($string) || $string eq '') { - $string = '-'; - } - - # There is a bug in (irssi's) utf-8 handling on config file settings, as you - # can reproduce/see yourself by the following code sniplet: - # - # my $quake = pack 'U*', 8364; # EUR symbol - # Irssi::settings_add_str 'temp', 'temp_foo' => $quake; - # $a= length($quake); - # # $a => 1 - # $a= length(Irssi::settings_get_str 'temp_foo'); - # # $a => 3 - # $a= utf8::is_utf8(Irssi::settings_get_str 'temp_foo'); - # # $a => false - - utf8::decode($string); - - if ($string =~ m/---/) { - $string = pack('U*', 0x2500); - } - - if ($string =~ m/===/) { - $string = pack('U*', 0x2550); - } - - if ($string =~ m/___/) { - $string = pack('U*', 0x2501); - } - - if ($string =~ m/# #/) { - $string = pack('U*', 0x25ad)." "; - } - - my $length = length $string; - - my $times = $width / $length - $tslen; - $times = int(1 + $times) if $times != int($times); - $string =~ s/%/%%/g; - - if ($tslen) { - # why $config{'timestamp_format'} won't work here? - my $ts = strftime(Irssi::settings_get_str('timestamp_format')." ", localtime); - - if ($config{'trackbar_timestamp_styled'}) { - return $config{'trackbar_style'} . $ts . substr($string x $times, 0, $width); - } else { - return $ts . $config{'trackbar_style'} . substr($string x $times, 0, $width); - } - } else { - return $config{'trackbar_style'} . substr($string x $times, 0, $width); - } -} - -# Remove trackbars on upgrade - but this doesn't really work if the scripts are not loaded in the correct order... watch out! - -Irssi::signal_add_first('session save' => sub { - for my $window (Irssi::windows) { - next unless defined $window; - my $line = $window->view()->get_bookmark('trackbar'); - $window->view()->remove_line($line) if defined $line; - } -} -); - -sub cmd_mark { - my $window = Irssi::active_win(); - - draw_bar($window); -} - - -# mark all visible windows with a line -sub cmd_mark_visual { - my $w= Irssi::active_win(); - my $refs =$w->{refnum}; - my $refa; - - cmd_mark(); - - do { - Irssi::command('window down'); - $w= Irssi::active_win(); - $refa =$w->{refnum}; - - if ($refs != $refa) { - cmd_mark(); - } - - } while ($refs != $refa) -} - -# /tb or /trackbar -sub cmd_tb { - if ($#_ >=0 ) { - my $sc = shift @_; - $sc =~ s/\s+$//; - - if ($sc eq "mark") { - cmd_mark(); - } elsif ($sc eq "help") { - cmd_help("trackbar"); - } elsif ($sc eq "vmark") { - cmd_mark_visual(); - } else { - cmd_scroll(); - } - } -} - -sub cmd_scroll { - my $window = Irssi::active_win(); - my $line = $window->view()->get_bookmark('trackbar'); - $window->view()->scroll_line($line) if defined $line; -} - -sub cmd_help { - my $help = < Go to window -# - -use strict; -use vars qw($VERSION %IRSSI); - -$VERSION = '1.0.0'; -%IRSSI = ( - authors => 'Trevor "tee" Slocum', - contact => 'tslocum@gmail.com', - name => 'WinNum', - description => 'Goto a window by its reference number with /##', - license => 'GPLv3', - url => 'https://github.com/tslocum/irssi-scripts', - changed => '2014-05-01' -); - -sub winnum_default_command { - my ($command, $server) = @_; - - $command =~ s/^\s+//; - $command =~ s/\s+$//; - my $winnum = ($command =~ /(\w+)/)[0]; - - if ($winnum =~ /^\d+$/) { - my $window = Irssi::window_find_refnum($winnum); - $window->set_active if $window; - - Irssi::signal_stop(); - } -} - -Irssi::signal_add_first("default command", "winnum_default_command"); - -print $IRSSI{name} . ': v' . $VERSION . ' loaded. Enter %9/%9 to goto a window.'; diff --git a/.irssi/startup b/.irssi/startup deleted file mode 100644 index 67a2a3c4..00000000 --- a/.irssi/startup +++ /dev/null @@ -1,3 +0,0 @@ -load perl -script exec $ENV{'TZ'}='MST'; -window goto 1 diff --git a/archive/.irssi/clean.theme b/archive/.irssi/clean.theme new file mode 100644 index 00000000..42566364 --- /dev/null +++ b/archive/.irssi/clean.theme @@ -0,0 +1,264 @@ +# clean theme for irssi 0.8.4 by sabi +# 1.0.9 of 15 June 2002 +# very loosely based on IamCyan.theme by marmot + +replaces = { }; + +abstracts = { + ## + ## generic + ## + + # text to insert at the beginning of each non-message line + line_start = ""; + + # timestamp styling, nothing by default + # timestamp = "$0"; + timestamp = "%b$0"; + # any kind of text that needs hilighting, default is to bold + hilight = "%m$0%n"; + + # any kind of error message, default is bright red + error = "%R$0-%n"; + + # channel name is printed + channel = "%m$0-%n"; + + # nick is printed + nick = "%_$0-%_"; + + # nick host is printed + nickhost = "%n%9[%_$0-%9]%_"; + + # server name is printed + server = "$0-"; + + # some kind of comment is printed + comment = "[$0-]"; + + # reason for something is printed (part, quit, kick, ..) + reason = "($0-)"; + + # mode change is printed ([+o nick]) + mode = "%r$0-%n"; + + ## + ## channel specific messages + ## + + # highlighted nick/host is printed (joins) + channick_hilight = "%B$0-%n"; + chanhost_hilight = "{nickhost $0-}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%b$0-"; + chanhost = "{nickhost $0-}"; + + # highlighted channel name is printed + channelhilight = "%_$0-%_"; + + # ban/ban exception/invite list mask is printed + ban = "$0-"; + + ## + ## messages + ## + + # the basic styling of how to print message, $0 = nick mode, $1 = nick + msgnick = "$_%b$0%n$1-%9>%n %|"; + + # message from you is printed. "msgownnick" specifies the styling of the + # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the + # whole line. + + # Example1: You want the message text to be green: + # ownmsgnick = "{msgnick $0 $1-}%g"; + # Example2.1: You want < and > chars to be yellow: + # ownmsgnick = "%Y{msgnick $0 $1-%Y}%n"; + # (you'll also have to remove <> from replaces list above) + # Example2.2: But you still want to keep <> grey for other messages: + # pubmsgnick = "%K{msgnick $0 $1-%K}%n"; + # pubmsgmenick = "%K{msgnick $0 $1-%K}%n"; + # pubmsghinick = "%K{msgnick $1 $0$2-%K}%n"; + # ownprivmsgnick = "%K{msgnick $0-%K}%n"; + # privmsgnick = "%K{msgnick %R$0-%K}%n"; + + # $0 = nick mode, $1 = nick + ownmsgnick = "%b$0%n$1%n%R>%n %|"; + ownnick = "$0-"; + + # public message in channel, $0 = nick mode, $1 = nick + pubmsgnick = "{msgnick $0 $1-}"; + pubnick = "$0-"; + + # public message in channel meant for me, $0 = nick mode, $1 = nick + pubmsgmenick = "%b$0%r$1-%b%9>%n %|"; + menick = "$0-"; + + # public highlighted message in channel + # $0 = highlight color, $1 = nick mode, $2 = nick + pubmsghinick = "%b$1$2-> %|"; + + # channel name is printed with message + msgchannel = "%w|%c$0-"; + + # private message, $0 = nick, $1 = host + privmsg = "<-%c$0%n[%C$1%n] "; + + # private message from you, $0 = "msg", $1 = target nick + ownprivmsg = "->[%c$1-%n] $0"; + + # own private message in query + ownprivmsgnick = "{ownmsgnick = %C$0-%n}"; + ownprivnick = "$0-"; + + # private message in query + privmsgnick = "{msgnick = %C$0-%n}"; + + ## + ## Actions (/ME stuff) + ## + + # used internally by this theme + action_core = "%m*%n $0-"; + + # generic one that's used by most actions + action = "{action_core $0-} "; + + # own action, both private/public + ownaction = "{action $0-}"; + + # own action with target, both private/public + ownaction_target = "{action_core $0}{msgchannel $1} "; + + # private action sent by others + pvtaction = " %g(*) $0- "; + pvtaction_query = "{action $0-}"; + + # public action sent by others + pubaction = "{action $0-}"; + + + ## + ## other IRC events + ## + + # notices + ownnotice = "-> %gnotice%n[%G$1%n] "; + notice = "<- %Gnotice%n[%g$0%n] "; + pubnotice_channel = "{msgchannel $0}"; + pvtnotice_host = ""; + servernotice = "{notice $0-}"; + + # CTCPs + ownctcp = "-> %b$0%n[%B$1-%n] "; + ctcp = "%B$0-"; + + # wallops + wallop = "%y$0-: %n"; + wallop_nick = "%y$0-%n"; + wallop_action = "%y * $0-%n "; + + # netsplits + netsplit = "%M%%%r $0-%n"; + netjoin = "%M%%%m $0-%n"; + + # /names list + names_nick = " %b$0%n$1"; + names_users = "%M#%m $0-"; + names_channel = "{channel $0-}"; + + # DCC + dcc = "$0-"; + dccfile = "%_$0-%_"; + + # DCC chat, own msg/action + dccownmsg = "*%c=$1-%n*> %g"; + dccownaction = "{action $0-}"; + dccownaction_target = "{ownaction_target $0-}"; + + # DCC chat, others + dccmsg = "*%c=$1-%n* "; + dccquerynick = "$0-"; + dccaction = " (*dcc*) $0- %|"; + ## + ## statusbar + ## + + # default background for all statusbars. You can also give + # the default foreground color for statusbar items. + sb_background = "%3%k"; + # background for active window + sb_window_bg = "%2%k"; + + # 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 = "%5"; + # background for topicbar (same default) + sb_topic_bg = "%4%W"; + #sb_topic_fg = "%k"; + + # 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 = " "; + + prompt = "{channel $*}%n%9>%_ "; + + sb = " %n$*%w |"; + sbmode = " (%m+%n$*)"; + sbaway = " %nis away"; + sbservertag = ":$0 (change with ^X)"; + + # activity in statusbar + + # ',' separator + sb_act_sep = "%k$*"; + # normal text + sb_act_text = "%k$*"; + # public message + sb_act_msg = "%R$*"; + # hilight + sb_act_hilight = "%M$*"; + # hilight with specified color, $0 = color, $1 = text + sb_act_hilight_color = "$0$1-%n"; + + +}; +formats = { + "fe-common/core" = { + join = "%M+%n {channick_hilight $0} {chanhost_hilight $1} joined {channel $2}"; + part = "%M-%n {channick $0} {chanhost $1} left {channel $2} {reason $3}"; + kick = "%M!%n {channick $0} was kicked from {channel $1} by {nick $2} {reason $3}"; + quit = "%M=%n {channick $0} {chanhost $1} quit {reason $2}"; + pubmsg_me = "{pubmsgmenick $2 {menick $0}}$1"; + pubmsg_me_channel = "{pubmsgmenick $3 {menick $0}{msgchannel $1}}$2"; + pubmsg_hilight = "{pubmsghinick $0 $3 $1}$2"; + pubmsg_hilight_channel = "{pubmsghinick $0 $4 $1{msgchannel $2}$3"; + pubmsg = "{pubmsgnick $2 {pubnick $0}}$1"; + pubmsg_channel = "{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2"; + msg_private = "{privmsg $0 $1 }$2"; + msg_private_query = "{privmsgnick $0}$2"; + }; + "fe-common/irc" = { + chanmode_change = "%M~%n {nick $2} set {mode $1} on {channel $0}"; + whois = "{nick $0} {nickhost $1@$2}%: ircname : $3"; + server_chanmode_change = "{netsplit ServerMode}/{channelhilight $0}: {mode $1} by {nick $2}"; + notice_public = "{notice $0{pubnotice_channel $1}}$2"; + notice_private = "{notice $0{pvtnotice_host $1}}$2"; + action_private = "{pvtaction $0}$2"; + action_private_query = "{pvtaction_query $0}$2"; + action_public = "{pubaction $0}$1"; + action_public_channel = "{pubaction $0{msgchannel $1}}$2"; + ctcp_reply = "CTCP {hilight $0} reply from {nick $1}: $2"; + ctcp_reply_channel = "CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2"; + ctcp_ping_reply = "CTCP {hilight PING} reply from {nick $0}: $1.$[-3.0]2 seconds"; + ctcp_requested = "{ctcp {hilight $0} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3"; + ctcp_requested_unknown = "{ctcp {hilight $0} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3"; + }; +}; diff --git a/archive/.irssi/default.theme b/archive/.irssi/default.theme new file mode 100644 index 00000000..29d48ba9 --- /dev/null +++ b/archive/.irssi/default.theme @@ -0,0 +1,319 @@ +# When testing changes, the easiest way to reload the theme is with /RELOAD. +# This reloads the configuration file too, so if you did any changes remember +# to /SAVE it first. Remember also that /SAVE overwrites the theme file with +# old data so keep backups :) + +# TEMPLATES: + +# The real text formats that irssi uses are the ones you can find with +# /FORMAT command. Back in the old days all the colors and texts were mixed +# up in those formats, and it was really hard to change the colors since you +# might have had to change them in tens of different places. So, then came +# this templating system. + +# Now the /FORMATs don't have any colors in them, and they also have very +# little other styling. Most of the stuff you need to change is in this +# theme file. If you can't change something here, you can always go back +# to change the /FORMATs directly, they're also saved in these .theme files. + +# So .. the templates. They're those {blahblah} parts you see all over the +# /FORMATs and here. Their usage is simply {name parameter1 parameter2}. +# When irssi sees this kind of text, it goes to find "name" from abstracts +# block below and sets "parameter1" into $0 and "parameter2" into $1 (you +# can have more parameters of course). Templates can have subtemplates. +# Here's a small example: +# /FORMAT format hello {colorify {underline world}} +# abstracts = { colorify = "%G$0-%n"; underline = "%U$0-%U"; } +# When irssi expands the templates in "format", the final string would be: +# hello %G%Uworld%U%n +# ie. underlined bright green "world" text. +# and why "$0-", why not "$0"? $0 would only mean the first parameter, +# $0- means all the parameters. With {underline hello world} you'd really +# want to underline both of the words, not just the hello (and world would +# actually be removed entirely). + +# COLORS: + +# You can find definitions for the color format codes in docs/formats.txt. + +# There's one difference here though. %n format. Normally it means the +# default color of the terminal (white mostly), but here it means the +# "reset color back to the one it was in higher template". For example +# if there was /FORMAT test %g{foo}bar, and foo = "%Y$0%n", irssi would +# print yellow "foo" (as set with %Y) but "bar" would be green, which was +# set at the beginning before the {foo} template. If there wasn't the %g +# at start, the normal behaviour of %n would occur. If you _really_ want +# to use the terminal's default color, use %N. + +############################################################################# + +# 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"; }; + +abstracts = { + ## + ## generic + ## + + # text to insert at the beginning of each non-message line + line_start = "%B-%n!%B-%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 = "%C$*%n"; + chanhost_hilight = "{nickhost %c$*%n}"; + + # nick/host is printed (parts, quits, etc.) + channick = "%c$*%n"; + 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 = "%K<%n$0$1-%K>%n %|"; + + # message from you is printed. "msgownnick" specifies the styling of the + # nick ($0 part in msgnick) and "ownmsgnick" specifies the styling of the + # whole line. + + # Example1: You want the message text to be green: + # ownmsgnick = "{msgnick $0 $1-}%g"; + # Example2.1: You want < and > chars to be yellow: + # ownmsgnick = "%Y{msgnick $0 $1-%Y}%n"; + # (you'll also have to remove <> from replaces list above) + # Example2.2: But you still want to keep <> grey for other messages: + # pubmsgnick = "%K{msgnick $0 $1-%K}%n"; + # pubmsgmenick = "%K{msgnick $0 $1-%K}%n"; + # pubmsghinick = "%K{msgnick $1 $0$2-%n%K}%n"; + # ownprivmsgnick = "%K{msgnick $*%K}%n"; + # privmsgnick = "%K{msgnick %R$*%K}%n"; + + # $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 = "%Y$*%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 = "%C$*%n"; + + # /names list + names_prefix = ""; + names_nick = "[%_$0%_$1-] "; + names_nick_op = "{names_nick $*}"; + names_nick_halfop = "{names_nick $*}"; + names_nick_voice = "{names_nick $*}"; + names_users = "[%g$*%n]"; + 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%w"; + + # 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 = "%8"; + # 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 = "[$*] "; + + sb = " %c[%n$*%c]%n"; + sbmode = "(%c+%n$*)"; + sbaway = " (%GzZzZ%n)"; + sbservertag = ":$0 (change with ^X)"; + 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"; +}; +formats = { + "fe-common/core" = { + pubmsg_me = "{pubmsgmenick $2 {menick $0}}$1"; + pubmsg_me_channel = "{pubmsgmenick $3 {menick $0}{msgchannel $1}}$2"; + pubmsg_hilight = "{pubmsghinick $0 $3 $1}$2"; + pubmsg_hilight_channel = "{pubmsghinick $0 $4 $1{msgchannel $2}$3"; + pubmsg = "{pubmsgnick $2 {pubnick $0}}$1"; + pubmsg_channel = "{pubmsgnick $3 {pubnick $0}{msgchannel $1}}$2"; + msg_private = "{privmsg $0 $1 }$2"; + msg_private_query = "{privmsgnick $0}$2"; + }; + "fe-common/irc" = { + notice_public = "{notice $0{pubnotice_channel $1}}$2"; + notice_private = "{notice $0{pvtnotice_host $1}}$2"; + action_private = "{pvtaction $0}$2"; + action_private_query = "{pvtaction_query $0}$2"; + action_public = "{pubaction $0}$1"; + action_public_channel = "{pubaction $0{msgchannel $1}}$2"; + ctcp_reply = "CTCP {hilight $0} reply from {nick $1}: $2"; + ctcp_reply_channel = "CTCP {hilight $0} reply from {nick $1} in channel {channel $3}: $2"; + ctcp_ping_reply = "CTCP {hilight PING} reply from {nick $0}: $1.$[-3.0]2 seconds"; + ctcp_requested = "{ctcp {hilight $0} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3"; + ctcp_requested_unknown = "{ctcp {hilight $0} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3"; + }; +}; diff --git a/archive/.irssi/scripts/autorun/act.pl b/archive/.irssi/scripts/autorun/act.pl new file mode 100755 index 00000000..252a6d38 --- /dev/null +++ b/archive/.irssi/scripts/autorun/act.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w +# resets window activity status +# based on act.pl from http://scripts.irssi.org by c0ffee + +use strict; +use Irssi 20020120; + +Irssi::command_bind('ac', sub { _act(); }); + +sub _act { + for (Irssi::windows()) { + Irssi::signal_emit("window dehilight", $_); + } +} diff --git a/archive/.irssi/scripts/autorun/anotherway.pl b/archive/.irssi/scripts/autorun/anotherway.pl new file mode 100755 index 00000000..ba360f25 --- /dev/null +++ b/archive/.irssi/scripts/autorun/anotherway.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl +# +# by Stefan Tomanek + +use strict; +use vars qw($VERSION %IRSSI); +$VERSION = "2003010201"; +%IRSSI = ( + authors => "Stefan 'tommie' Tomanek", + contact => "stefan\@pico.ruhr.de", + name => "anotherway", + description => "Another auto away script", + license => "GPLv2", + changed => "$VERSION", +); +use Irssi 20020324; +use vars qw($timer @signals); + +@signals = ('message own_public', 'message own_private'); + +sub go_away { + #Irssi::print "%R>>%n Going away...$timer"; + Irssi::timeout_remove($timer); + my $reason = Irssi::settings_get_str("anotherway_reason"); + my @servers = Irssi::servers(); + return unless @servers; + Irssi::signal_remove($_ , "reset_timer") foreach (@signals); + $servers[0]->command('AWAY '.$reason); + Irssi::signal_add($_ , "reset_timer") foreach (@signals); + + # # return to the status window so that messages received clearly + # # visible in Act bar -- spw + # Irssi::command('window goto 1'); + # ^ annoying and no longer needed now away log gets mailed to me + + # set the trackbar so we can see where we were + # -- spw + Irssi::command('tb mark'); +} + +sub reset_timer { + #Irssi::print "%R>>%n RESET"; + Irssi::signal_remove($_ , "reset_timer") foreach (@signals); + foreach (Irssi::servers()) { + $_->command('AWAY') if $_->{usermode_away}; + last; + } + #Irssi::signal_add('nd', "reset_timer"); + Irssi::timeout_remove($timer); + my $timeout = Irssi::settings_get_int("anotherway_timeout"); + $timer = Irssi::timeout_add($timeout*1000, "go_away", undef); + Irssi::signal_add($_, "reset_timer") foreach (@signals); +} + +Irssi::settings_add_str($IRSSI{name}, 'anotherway_reason', 'a-nother-way'); +Irssi::settings_add_int($IRSSI{name}, 'anotherway_timeout', 300); + +{ + Irssi::signal_add($_, "reset_timer") foreach (@signals); + reset_timer(); +} + +print CLIENTCRAP '%B>>%n '.$IRSSI{name}.' '.$VERSION.' loaded'; diff --git a/archive/.irssi/scripts/autorun/auto_bleh.pl b/archive/.irssi/scripts/autorun/auto_bleh.pl new file mode 100644 index 00000000..9c00b2fa --- /dev/null +++ b/archive/.irssi/scripts/autorun/auto_bleh.pl @@ -0,0 +1,293 @@ +use Irssi; +use Irssi::Irc; +use strict; +use vars qw($VERSION %IRSSI $DEBUG); + +$VERSION = q$Revision: 1.1 $; +%IRSSI = (authors => 'tomaw, based on auto_bleh.pl by Don Armstrong', + name => 'auto_bleh', + description => 'Provides /ak /aq /ab /abr /abrn /arn /amb /amr /at', + license => 'GPL', + changed => q$Id: auto_bleh.pl,v 1.1 2005/03/17 08:19:53 don Exp $, +); + +#$DEBUG = 1 unless defined $DEBUG; + +my ($actions, %defaults); + +%defaults = (GET_OP => 1, # Should we try to get opped when we auto_bleh? + USE_CHANSERV => 1, # Should we use chanserv to get opped? + EXPIRE => 6000, # Do not try to do anything if the action is more than 6000 seconds old. + TIMEOUT => 10, # Timeout /at bans after 10 minutes +); + +my %command_bindings = (ak => 'cmd_ak', + ab => 'cmd_ab', + aq => 'cmd_aq', + ar => 'cmd_ar', + abr => 'cmd_abr', + abk => 'cmd_abk', + abrn => 'cmd_abrn', + abk => 'cmd_abkn', + arn => 'cmd_arn', + amb => 'cmd_amb', + amr => 'cmd_amr', + at => 'cmd_at', +); + +my %bans_to_remove; + +sub cmd_at { + my ($data, $server, $witem) = @_; + return do_auto_bleh('timeout',$data,$server,$witem); +} + +sub cmd_ak { + my ($data, $server, $witem) = @_; + return do_auto_bleh('kick',$data,$server,$witem); +} + +sub cmd_abk { + my ($data, $server, $witem) = @_; + return do_auto_bleh('kick,ban',$data,$server,$witem); +} +sub cmd_abkn { + my ($data, $server, $witem) = @_; + return do_auto_bleh('kick,ban,notice',$data,$server,$witem); +} + +sub cmd_amb{ + my ($data, $server, $witem) = @_; + my @nicks = split /\s+/, $data; + for (@nicks) { + next unless /\w/; + do_auto_bleh('ban',$_,$server,$witem); + } +} + +sub cmd_ab { + my ($data, $server, $witem) = @_; + return do_auto_bleh('ban',$data,$server,$witem); +} + +sub cmd_aq { + my ($data, $server, $witem) = @_; + return do_auto_bleh('quiet',$data,$server,$witem); +} + + +sub cmd_amr{ + my ($data, $server, $witem) = @_; + my @nicks = split /\s+/, $data; + for (@nicks) { + next unless /\w/; + do_auto_bleh('remove',$_,$server,$witem); + } +} + +sub cmd_ar { + my ($data, $server, $witem) = @_; + return do_auto_bleh('remove',$data,$server,$witem); +} +sub cmd_abr{ + my ($data, $server, $witem) =@_; + return do_auto_bleh('remove,ban',$data,$server,$witem); +} +sub cmd_abrn{ + my ($data, $server, $witem) =@_; + return do_auto_bleh('remove,ban,notice',$data,$server,$witem); +} +sub cmd_arn{ + my ($data, $server, $witem) =@_; + return do_auto_bleh('remove,notice',$data,$server,$witem); +} + + +sub do_auto_bleh { + my ($cmd, $data, $server, $witem, $duration) = @_; + + if (!$server || !$server->{connected}) { + Irssi::print("Not connected to server"); + return; + } + + if ($witem->{type} ne 'CHANNEL') { + Irssi::print("Can't autokick on a non-channel. [$witem->{type}]"); + return; + } + + # set the network that we're on, the channel and the nick to kick + # once we've been opped + + $data =~ /^\s*([^\s]+)\s*(\d+)?\s*(.+?|)\s*$/; + my $nick = $1; + my $timeout = $2; + my $reason = $3; + $timeout = $defaults{TIMEOUT} if not defined $timeout or $timeout eq ''; + $reason = 'you should know better' if not defined $reason or $reason eq ''; + + my $nick_rec = $witem->nick_find($nick); + if (not defined $nick_rec) { + Irssi::print("Unable to find nick: $nick"); + return; + } + + my $hostname = $nick_rec->{host} if defined $nick_rec; + Irssi::print("Unable to find hostname for $nick") if not defined $hostname or $hostname eq ''; + $hostname =~ s/.+\@//; + + Irssi::print("Nick set to '$nick' from '$data', reason set to '$reason'.") if $DEBUG; + my $action = {type => $cmd, + nick => $nick, + nick_rec => $nick_rec, + network => $witem->{server}->{chatnet}, + server => $witem->{server}, + completed => 0, + inserted => time, + channel => $witem->{name}, + reason => $reason, + hostname => $hostname, + timeout => $timeout, + }; + Irssi::print(i_want($action)) if $DEBUG; + if ($witem->{chanop}) { + take_action($action,$server,$witem); + } + else { + $actions->{$data.$action->{inserted}}=$action; + get_op($server, $action->{channel}) if $defaults{GET_OP}; + } +} + +sub get_op { + my ($server,$channel) = @_; + + Irssi::print("QUOTE CS op $channel") if $DEBUG; + $server->command("QUOTE CS op $channel") if $defaults{USE_CHANSERV}; +} + +sub i_want { + my $action = shift; + return "I've wanted to $action->{type} $action->{nick} off $action->{channel} on $action->{network} since $action->{inserted}"; +} + +sub take_action { + my ($action,$server,$channel) = @_; + + local $_ = $action->{type}; + # Now support multiple actions against a single nick (to FE, kick ban, or remove ban). See /abr foo + if (/timeout/) { + Irssi::print("Quieting $action->{nick} on $action->{channel} with hostname $action->{hostname} for $action->{timeout} minutes") if $DEBUG; + $channel->command("/quote MODE $action->{channel} +q *!*@".$action->{hostname}) if $action->{hostname} ne ''; #quiet hostname + $bans_to_remove{"$action->{nick}$action->{inserted}"} = $action; + } + if (/quiet/) { + Irssi::print("Quieting $action->{nick} on $action->{channel} with hostname $action->{hostname}") if $DEBUG; + # Find hostname + $channel->command("/quote MODE $action->{channel} +q *!*@".$action->{hostname}) if $action->{hostname} ne ''; #quiet hostname + } + if (/ban/) { + Irssi::print("Banning $action->{nick} from $action->{channel} with hostname $action->{hostname}") if $DEBUG; + $channel->command("/quote MODE $action->{channel} +b *!*@".$action->{hostname}) if $action->{hostname} ne ''; # ban hostname + } + if (/kick/) { + Irssi::print("Kicking $action->{nick} from $action->{channel}") if $DEBUG; + if ($action->{reason} =~ /\s/) { + $channel->command("/quote KICK $action->{channel} $action->{nick} :$action->{reason}"); + } + else { + $channel->command("/quote REMOVE $action->{channel} $action->{nick} $action->{reason}"); + } + } + if (/remove/) { + Irssi::print("Removing $action->{nick} from $action->{channel}") if $DEBUG; + if ($action->{reason} =~ /\s/) { + $channel->command("/quote REMOVE $action->{channel} $action->{nick} :$action->{reason}"); + } else { + $channel->command("/quote REMOVE $action->{channel} $action->{nick} $action->{reason}"); + } + } + if (/notice/) { + Irssi::print("Noticing $action->{nick} with $action->{reason}") if $DEBUG; + $channel->command("/NOTICE $action->{nick} $action->{reason}"); + } + if (/teiuq/) { + Irssi::print("Unquieting $action->{nick} on $action->{channel} with hostname $action->{hostname}") if $DEBUG; + $channel->command("/quote MODE $action->{channel} -q *!*@".$action->{hostname}); + } + return; #for now. +} + +sub deop_us { + my ($rec) = @_; + my $channel = $rec->{channel}; + my $server = $rec->{server}; + + Irssi::print("MODE $channel->{name} -o $channel->{ownnick}->{nick}") if $DEBUG; + $channel->command("/deop $channel->{ownnick}->{nick}"); +} + +sub sig_mode_change { + my ($channel,$nick) = @_; + + # Are there any actions to process? + # See if we got opped. + return if scalar(keys %$actions) eq 0; + + my @deop_array; + if ($channel->{server}->{nick} eq $nick->{nick} and $nick->{op}) { + Irssi::print("We've been opped") if $DEBUG; + foreach (keys %$actions) { + # See if this action is too old + if (time - $actions->{$_}->{inserted} > $defaults{EXPIRE}) { + Irssi::print("Expiring action: \"".i_want($actions->{$_})."\" because of time") if $DEBUG; + delete $actions->{$_}; + next; + } + Irssi::print(i_want($actions->{$_})) if $DEBUG; + # Find the server to take action on + my $server = $actions->{$_}->{server}; + Irssi::print("Unable to find server for chatnet: $actions->{$_}->{network}") and return if not defined $server; + Irssi::print("Found server for chatnet: $actions->{$_}->{network}") if $DEBUG; + # Find the channel to take action on + my $channel = $server->channel_find($actions->{$_}->{channel}); + Irssi::print("Unable to find channel for channel: $actions->{$_}->{channel}") and return if not defined $channel; + Irssi::print("Found channel for channel: $actions->{$_}->{channel}") if $DEBUG; + Irssi::print("We are opped on the channel!") if $DEBUG; + take_action($actions->{$_},$server,$channel); + push @deop_array,{server=>$server,channel=>$channel} if Irssi::settings_get_bool('auto_bleh_deop_after_action'); + delete $actions->{$_}; # Do not repeat this action. + } + foreach (@deop_array) { + deop_us($_); + } + } else { + Irssi::print("Fooey. Not opped.") if $DEBUG; + } +} + +sub try_to_remove_bans { + return unless keys %bans_to_remove; + for my $key (keys %bans_to_remove) { + if (($bans_to_remove{$key}{inserted} + $bans_to_remove{$key}{timeout}*60) < time) { + $bans_to_remove{$key}{type} = 'teiuq'; #unquiet + $actions->{$key} = $bans_to_remove{$key}; + delete $bans_to_remove{$key}; + get_op($actions->{$key}{server}, $actions->{$key}{channel}) if $defaults{GET_OP}; + } + } +} + +# call the try to remove bans function every minute +Irssi::timeout_add(1000*60,'try_to_remove_bans',undef); +Irssi::signal_add_last('nick mode changed','sig_mode_change'); +my ($command,$function); + +while (($command,$function) = each %command_bindings) { + Irssi::command_bind($command,$function, 'auto_bleh'); +} + +Irssi::settings_add_bool($IRSSI{name}, 'auto_bleh_deop_after_action', 1); + +1; + diff --git a/archive/.irssi/scripts/autorun/format_identify.pl b/archive/.irssi/scripts/autorun/format_identify.pl new file mode 100644 index 00000000..0b19c445 --- /dev/null +++ b/archive/.irssi/scripts/autorun/format_identify.pl @@ -0,0 +1,440 @@ + +#!/usr/bin/perl +# ^ to make vim know this is a perl script so I get syntax hilighting. + +##################################################################### +### WARNING: This version was restored from google cache ### +### by Wouter Coekaerts . ### +### Syntax might not be exactly the same as the original ### +##################################################################### + +# $Id$ +use strict; +use vars qw($VERSION %IRSSI); +use Irssi qw(signal_stop signal_emit signal_remove + signal_add signal_add_first + settings_add_str settings_get_str settings_add_bool + settings_get_bool + print ); +$VERSION = '1.5-dev-coekie'; +%IRSSI = ( + authors => 'ResDev (Ben Reser)', + contact => 'ben@reser.org', + name => 'format_identify', + description => 'Formats msgs and notices when the identify-msg and/or ' . + 'identify-ctcp capability is available.', + license => 'GPL2', + url => 'http://ben.reser.org/irssi/', +); + +# Additional credit to ch for his wash-imsg script which was a starting place +# for this; coekie for pointing me towards the nickcolor script and its +# technique for doing this; Timo Sirainen and Ian Peters for writing nickcolor. + +# This script takes advantage of the identify-msg and identify-ctcp +# capabilities of the new dancer ircd. The identify-msg capability causes the +# first character of a msg or notice to be set to a + if the user is identified +# with nickserve and a - if not. identify-ctcp does similar for CTCP messages. +# This script removes the tagging and then allows you to configure a +# modification to the formating of the nickname. + +# Installation instructions: Drop this in ~/.irssi/scripts and run +# /script load format_identify. To make it autorun on startup place it in +# ~/.irssi/scripts/autorun. This script will detect if the IRC server has +# the identify-msg and identify-ctcp capability. If it is available it will +# use it. Messages on servers without support for these capabilities will +# be tagged as unknown. +# +# While you can unload this script. Any servers that you are connected to +# with identify-msg/identify-ctcp turned on will continue to send data +# encoded that way. This means messages and notices will have a + or - +# appended to the front of them. CTCPs will be broken. Unfortunately, there +# is no way to turn off a capability once it is turned on. You will have to +# disconnect and reconnect to these servers. This script will warn you when +# unloading the script of this situation. + +# +# Configuration: You can control the formating of the nickname with the +# format_identified_nick, format_unidentified_nick, and format_unknown_nick +# variables. The default is to do nothing to identified nicks and unknown +# nicks. while unidentified nicks have a ~ to the beginning of nick. An +# unknown nick means anytime a message or notice doesn't start with a + or -, +# which will occur when identify-msg isn't enabled. The format_unknown_nick +# can be really handy to alert you that you don't have identify-msg or +# identify-ctcp set, but is set by default to do nothing since most servers do +# not have identify-msg yet. In these variables $0 stands for the nick. You +# can use the standard formating codes or just text in it. See formats.txt for +# more information on the codes you can use. Warning about colors. Using +# colors in this formating will likely break other formating scripts and +# features, in particular the hilight feature of irssi or vice versa. Remember +# that %n has a different meaning here as explamined in the default.theme file +# that comes with irssi. +# +# Some examples: +# +# Make unidentified nicks have a ? after the nick: /set +# format_unidentified_nick $0? +# +# Make unidentified nicks red and identified nicks green: /set +# format_identified_nick %G$0 /set format_unidentified_nick %R$0 Note that the +# above will not do the tagging if a message gets hilighted. Since a hilight +# (line or nick) will override the colors. +# +# So I recommend doing something like this: /set format_identified_nick %G$0 +# /set format_unidentified_nick %R~$0 +# +# Make unidentified nicks be unmodified but add a * before identified nicks: +# /set format_identified_nick *$0 /set format_unidentified_nick $0 +# +# This script works by modifying the formats irssi uses to display various +# things. Therefore it is highly recommended that you do not change any of the +# following format variables except through this script: pubmsg pubmsg_channel +# msg_private msg_private_query pubmsg_hilight pubmsg_hilight_channel pubmsg_me +# pubmsg_me_channel action_private action_private_query action_public +# action_public_channel ctcp_requested ctcp_requested_unknown notice_public +# notice_private ctcp_reply ctcp_reply_channel ctcp_ping_reply + +# +# To change these formats you need to set the variable (with the set command +# not the format command as usual) of the same name as the format but with +# _identify on the end. This format has an additional special purpose +# "abstract" that is only used by this script and is parsed and replaced before +# setting the format and giving it to irssi. It is called format_identify. +# Any format you use with this script should have a {format_identify $0} in it +# to replace where the $0 usually is in the format. Sometimes it will be $1 +# for the nick in the format, in which case you should replace the $1 with +# {format_identify $1}. For more examples take a look at the defaults at the +# bottom of this script. +# +# +# If you wish to disable the module from applying a change to the nickname in a +# particular place the best way to do it is to simply remove the +# {format_identify $0} from the format that applies. E.G. to disable the +# format change for a CTCP reply one would do: /set ctcp_reply_identify CTCP +# {hilight $0} reply from {nick $1}: $2 +# + +# TODO +# * Implement DCC formats, which means figuring out which ones are appropriate +# to try and format. +# * Allow different formating on the nick for different types of messages. I'm +# not sure if this is useful... +# +# It should not be necessary to modify anything in this script. Everything +# should be able to be modified via the variables it exports as described +# above. +# + +my(@format_identify_message_formats) = qw(pubmsg pubmsg_channel msg_private + msg_private_query pubmsg_hilight + pubmsg_hilight_channel action_private + action_private_query action_public + action_public_channel ctcp_requested + ctcp_requested_unknown pubmsg_me + pubmsg_me_channel + ); + +my(@format_identify_notice_formats) = qw(notice_public notice_private ctcp_reply + ctcp_reply_channel ctcp_ping_reply); + + +my %servers; + +# Replace the {format_identify $0} place holder with +# whatever the user has setup for their nick formats... +sub replace_format_identify { + my ($format, $entry) = @_; + + my ($nickarg) = $format =~ /{\s*format_identify\s+?([^\s]+?)\s*}/; + $entry =~ s/\$0/$nickarg/; + $format =~ s/{\s*format_identify\s+?[^\s]+?\s*}/$entry/g; + return $format; +} + +# rewrite the message now that we've updated the formats +sub format_identify_rewrite { + my $signal = shift; + my $proc = shift; + + signal_stop(); + signal_remove($signal,$proc); + signal_emit($signal, @_); + signal_add($signal,$proc); +} + + +# Issue the format update after generating the new format. +sub update_format_identify { + my ($server,$entry,$nick) = @_; + + my $identify_format = settings_get_str("${entry}_identify"); + my $replaced_format = replace_format_identify($identify_format,$nick); + $server->command("^format $entry " . $replaced_format); +} + +my %saved_colors; +my %session_colors = {}; +my @colors = qw/2 3 4 5 6 7 9 10 11 12 13/; + +sub simple_hash { + my ($string) = @_; + chomp $string; + my @chars = split //, $string; + my $counter; + + foreach my $char (@chars) { + $counter += ord $char; + } + + $counter = $colors[($counter % @colors)]; + return $counter; +} + +sub colourise { + return if(!settings_get_bool('format_colour')); + my ($nick) = @_; + my $color = $saved_colors{$nick}; + if (!$color) { + $color = $session_colors{$nick}; + } + if (!$color) { + $color = simple_hash $nick; + $session_colors{$nick} = $color; + } + $color = "0".$color if ($color < 10); + return chr(3).$color; +} + + +# catches the signal for a message removes the + or -, updates the +# formats and then resends the message event. +sub format_identify_message { + my ($server, $data, $nick, $address) = @_; + my ($channel, $msg) = split(/ :/, $data,2); + + if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'} && + !$servers{$server->{'real_address'}}->{'IDENTIFY-MSG'}) { + my $unknown_nick = settings_get_str('format_unknown_nick'); + foreach my $format (@format_identify_message_formats) { + update_format_identify($server,$format,colourise($nick).$unknown_nick); + } + } elsif(($msg =~ /^\+(.*)/)){ + my $newdata = "$channel :$1"; + my $identified_nick = settings_get_str('format_identified_nick'); + foreach my $format (@format_identify_message_formats) { + update_format_identify($server,$format,colourise($nick).$identified_nick); + } + format_identify_rewrite('event privmsg','format_identify_message', $server,$newdata,$nick,$address); + } elsif(($msg =~ /^-(.*)/)){ + my $newdata = "$channel :$1"; + my $unidentified_nick = settings_get_str('format_unidentified_nick'); + foreach my $format (@format_identify_message_formats) { + update_format_identify($server,$format,colourise($nick).$unidentified_nick); + } + format_identify_rewrite('event privmsg','format_identify_message', $server,$newdata,$nick,$address); + } else { + my $unknown_nick = settings_get_str('format_unknown_nick'); + foreach my $format (@format_identify_message_formats) { + update_format_identify($server,$format,colourise($nick).$unknown_nick); + } + } +} + +# catches the signal for a notice removes the + or -, updates the +# formats and resends the notice event. +sub format_identify_notice { + my ($server, $data, $nick, $address) = @_; + my ($channel, $msg) = split(/ :/, $data,2); + + if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'} && + !$servers{$server->{'real_address'}}->{'IDENTIFY-MSG'}) { + my $unknown_nick = settings_get_str('format_unknown_nick'); + foreach my $format (@format_identify_notice_formats) { + update_format_identify($server,$format,colourise($nick).$unknown_nick); + } + } elsif(($msg =~ /^\+(.*)/)){ + my $newdata = "$channel :$1"; + my $identified_nick = settings_get_str('format_identified_nick'); + foreach my $format (@format_identify_notice_formats) { + update_format_identify($server,$format,colourise($nick).$identified_nick); + } + format_identify_rewrite('event notice','format_identify_notice', $server,$newdata,$nick,$address); + } elsif(($msg =~ /^-(.*)/)){ + my $newdata = "$channel :$1"; + my $unidentified_nick = settings_get_str('format_unidentified_nick'); + foreach my $format (@format_identify_notice_formats) { + update_format_identify($server,$format,colourise($nick).$unidentified_nick); + } + format_identify_rewrite('event notice','format_identify_notice', $server,$newdata,$nick,$address); + } else { + my $unknown_nick = settings_get_str('format_unknown_nick'); + foreach my $format (@format_identify_notice_formats) { + update_format_identify($server,$format,colourise($nick).$unknown_nick); + } + } +} + +# Handle CTCP messages. Note that messages tagged with identify-ctcp will +# not be seen as CTCPs and will go through event privmsg first. This script +# will generate new events and send them on through to here. However CTCPs +# that are not tagged at all will go here first. So we need to test here +# to see if the message is from a server that does not support identify-ctcp +# and update the format accordingly. +sub format_identify_ctcp_msg { + my ($server) = @_; + + if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'}) { + my $unknown_nick = settings_get_str('format_unknown_nick'); + foreach my $format (@format_identify_message_formats) { + update_format_identify($server,$format,$unknown_nick); + } + } +} + +# Handle CTCP replies. Note that messages tagged with identify-ctcp will +# not be seen as CTCPs and will go through event notice first. This script +# will generate new events and send them on through to here. However CTCPs +# that are not tagged at all will go here first. So we need to test here +# to see if the message is from a server that does not support identify-ctcp +# and update the format accordingly. +sub format_identify_ctcp_reply { + my ($server) = @_; + + if (!$servers{$server->{'real_address'}}->{'IDENTIFY-CTCP'}) { + my $unknown_nick = settings_get_str('format_unknown_nick'); + foreach my $format (@format_identify_notice_formats) { + update_format_identify($server,$format,$unknown_nick); + } + } +} + +# If we're getting unloaded reset the formats back to their defaults +# so that it doesn't wrongly show people being unidentifed or vice versa. +# Also issue a warning about CTCPs etc being broken. +sub format_identify_unload { + my ($script,$server,$witem) = @_; + my @warning_servers = (); + + if ($script =~ /^format_identify(?:\.pl|\.perl)?$/) { + foreach my $format (@format_identify_message_formats, + @format_identify_notice_formats) { + $server->command("^format -reset $format"); + } + foreach my $server_name (keys %servers) { + if ( $servers{$server_name}->{'IDENTIFY-MSG'} + || $servers{$server_name}->{'IDENTIFY-CTCP'}) + { + if($servers{$server_name}->{'USES-CAP'}) { + $server->command("^quote cap req :-identify-msg"); + } else { + push @warning_servers, $server_name; + } + } + } + print('Warning: Unloading format_identify will leave your messages '. + 'and notices modified and will break CTCPs on the following '. + 'servers: ' . join (',',@warning_servers)); + } +} + +# Server responded to capab request. We want to capture the reply +# and mark it in a hash so we can keep track of which servers have +# the capabilities. This style of reply will come from dancer or +# hyperion. +sub format_identify_capab_reply { + my ($server, $data, $server_name) = @_; + unless (ref($servers{$server_name}) eq 'HASH') { + $servers{$server_name} = {}; + $servers{$server_name}->{'IDENTIFY-MSG'} = 0; + $servers{$server_name}->{'IDENTIFY-CTCP'} = 0; + $servers{$server_name}->{'USES-CAP'} = 0; + } + if ($data =~ /:IDENTIFY-MSG$/) { + $servers{$server_name}->{'IDENTIFY-MSG'} = 1; + $servers{$server_name}->{'USES-CAP'} = 0; + Irssi::signal_stop(); + return; + } + if ($data =~ /:IDENTIFY-CTCP$/) { + $servers{$server_name}->{'IDENTIFY-CTCP'} = 1; + $servers{$server_name}->{'USES-CAP'} = 0; + Irssi::signal_stop(); + return; + } +} + +# The same as above. This style of reply comes from ircd-seven. +sub format_identify_cap_reply { + my ($server, $data, $server_name) = @_; + unless (ref($servers{$server_name}) eq 'HASH') { + $servers{$server_name} = {}; + $servers{$server_name}->{'IDENTIFY-MSG'} = 0; + $servers{$server_name}->{'IDENTIFY-CTCP'} = 0; + $servers{$server_name}->{'USES-CAP'} = 0; + } + if ($data =~ /ACK :.*identify-msg/) { + $servers{$server_name}->{'IDENTIFY-MSG'} = 1; + $servers{$server_name}->{'IDENTIFY-CTCP'} = 1; + $servers{$server_name}->{'USES-CAP'} = 1; + return; + } +} + +# Handles connections to new (to this script) servers and +# attempts to turn on the capabilities it supports. +# We send the request in both formats, for hyperion and ircd-seven. +sub format_identify_connected { + my $server = shift; + $server->command("^quote capab IDENTIFY-MSG"); + $server->command("^quote capab IDENTIFY-CTCP"); + $server->command("^quote cap req :identify-msg"); +} + +# signals to handle the events we need to intercept. +signal_add('event privmsg', 'format_identify_message'); +signal_add('event notice', 'format_identify_notice'); +signal_add('ctcp msg', 'format_identify_ctcp_msg'); +signal_add('ctcp reply', 'format_identify_ctcp_reply'); +signal_add('event 290', 'format_identify_capab_reply'); +signal_add('event cap', 'format_identify_cap_reply'); +signal_add('event connected', 'format_identify_connected'); + +# On load enumerate the servers and try to turn on +# IDENTIFY-MSG and IDENTIFY-CTCP +foreach my $server (Irssi::servers()) { + %servers = (); + format_identify_connected($server); +} + +# signal needed to catch the unload... Be sure to be the first to +# get it too... +signal_add_first('command script unload', 'format_identify_unload'); + +settings_add_bool('format_identify', 'format_colour', 1); + +# How we format the nick. $0 is the nick we'll be formating. +settings_add_str('format_identify','format_identified_nick','$0'); +settings_add_str('format_identify','format_unidentified_nick','~$0'); +settings_add_str('format_identify','format_unknown_nick','$0'); + +# What we use for the formats... +# Don't modify here, use the /set command or modify in the ~/.irssi/config file. +settings_add_str('format_identify','pubmsg_identify','{pubmsgnick $2 {pubnick {format_identify $0}}}$1'); +settings_add_str('format_identify','pubmsg_channel_identify','{pubmsgnick $3 {pubnick {format_identify $0}}{msgchannel $1}}$2'); +settings_add_str('format_identify','msg_private_identify','{privmsg {format_identify $0} $1 }$2'); +settings_add_str('format_identify','msg_private_query_identify','{privmsgnick {format_identify $0}}$2'); +settings_add_str('format_identify','pubmsg_hilight_identify','{pubmsghinick {format_identify $0} $3 $1}$2'); +settings_add_str('format_identify','pubmsg_hilight_channel_identify','{pubmsghinick {format_identify $0} $4 $1{msgchannel $2}$3'); +settings_add_str('format_identify','action_private_identify','{pvtaction {format_identify $0}}$2'); +settings_add_str('format_identify','action_private_query_identify','{pvtaction_query {format_identify $0}}$2'); +settings_add_str('format_identify','action_public_identify','{pubaction {format_identify $0}}$1'); +settings_add_str('format_identify','action_public_channel_identify', '{pubaction {format_identify $0}{msgchannel $1}}$2'); +settings_add_str('format_identify','ctcp_requested_identify','{ctcp {hilight {format_identify $0}} {comment $1} requested CTCP {hilight $2} from {nick $4}}: $3'); +settings_add_str('format_identify','ctcp_requested_unknown_identify','{ctcp {hilight {format_identify $0}} {comment $1} requested unknown CTCP {hilight $2} from {nick $4}}: $3'); +settings_add_str('format_identify','pubmsg_me_identify','{pubmsgmenick $2 {menick {format_identify $0}}}$1'); +settings_add_str('format_identify','pubmsg_me_channel_identify','{pubmsgmenick $3 {menick {format_identify $0}}{msgchannel $1}}$2'); +settings_add_str('format_identify','notice_public_identify','{notice {format_identify $0}{pubnotice_channel $1}}$2'); +settings_add_str('format_identify','notice_private_identify','{notice {format_identify $0}{pvtnotice_host $1}}$2'); +settings_add_str('format_identify','ctcp_reply_identify','CTCP {hilight $0} reply from {nick {format_identify $1}}: $2'); +settings_add_str('format_identify','ctcp_reply_channel_identify','CTCP {hilight $0} reply from {nick {format_identify $1}} in channel {channel $3}: $2'); +settings_add_str('format_identify','ctcp_ping_reply_identify','CTCP {hilight PING} reply from {nick {format_identify $0}}: $1.$[-3.0]2 seconds'); diff --git a/archive/.irssi/scripts/autorun/go.pl b/archive/.irssi/scripts/autorun/go.pl new file mode 100644 index 00000000..b656a0fc --- /dev/null +++ b/archive/.irssi/scripts/autorun/go.pl @@ -0,0 +1,59 @@ +use strict; +use vars qw($VERSION %IRSSI); +use Irssi; +use Irssi::Irc; + +# Usage: +# /script load go.pl +# If you are in #irssi you can type /go #irssi or /go irssi or even /go ir ... +# also try /go ir and /go (that's two spaces) + +$VERSION = '1.01'; + +%IRSSI = ( + authors => 'nohar', + contact => 'nohar@freenode', + name => 'go to window', + description => 'Implements /go command that activates a window given a name/partial name. It features a nice completion.', + license => 'GPLv2 or later', + changed => '2014-10-19' +); + +sub signal_complete_go { + my ($complist, $window, $word, $linestart, $want_space) = @_; + my $channel = $window->get_active_name(); + my $k = Irssi::parse_special('$k'); + + return unless ($linestart =~ /^\Q${k}\Ego\b/i); + + @$complist = (); + foreach my $w (Irssi::windows) { + my $name = $w->get_active_name(); + if ($word ne "") { + if ($name =~ /\Q${word}\E/i) { + push(@$complist, $name) + } + } else { + push(@$complist, $name); + } + } + Irssi::signal_stop(); +}; + +sub cmd_go +{ + my($chan,$server,$witem) = @_; + + $chan =~ s/ *//g; + foreach my $w (Irssi::windows) { + my $name = $w->get_active_name(); + if ($name =~ /^#?\Q${chan}\E/) { + $w->set_active(); + return; + } + } +} + +Irssi::command_bind("go", "cmd_go"); +Irssi::signal_add_first('complete word', 'signal_complete_go'); + diff --git a/archive/.irssi/scripts/autorun/hilightwin.pl b/archive/.irssi/scripts/autorun/hilightwin.pl new file mode 100644 index 00000000..d735e1b7 --- /dev/null +++ b/archive/.irssi/scripts/autorun/hilightwin.pl @@ -0,0 +1,59 @@ +# +# 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 strict; +use Irssi; +use POSIX; +use vars qw($VERSION %IRSSI); + +$VERSION = "0.03"; +%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 + ) { + my $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; + $text =~ s/%/%%/g; + $window->print($text, MSGLEVEL_NEVER) if ($window); + } +} + +my $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/archive/.irssi/scripts/autorun/trackbar.pl b/archive/.irssi/scripts/autorun/trackbar.pl new file mode 100644 index 00000000..ee660910 --- /dev/null +++ b/archive/.irssi/scripts/autorun/trackbar.pl @@ -0,0 +1,408 @@ +# trackbar.pl +# +# Track what you read last when switching to a window. +# +# Copyright (C) 2003 Peter Leurs +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# This little script will do just one thing: it will draw a line each time you +# switch away from a window. This way, you always know just upto where you've +# been reading that window :) It also removes the previous drawn line, so you +# don't see double lines. +# +# Usage: +# +# The script works right out of the box, but if you want you can change +# the working by /set'ing the following variables: +# +# trackbar_string The characters to repeat to draw the bar +# "---" => U+2500 => a line +# "===" => U+2550 => a double line +# "___" => U+2501 => a wide line +# "# #" => U+25ad.U+0020 => a white rectangle and a space +# trackbar_style The style for the bar, %r is red for example +# See formats.txt that came with irssi +# trackbar_hide_windows Comma seperated list of window names where the +# trackbar should not be drawn. +# trackbar_timestamp Prints a timestamp at the start of the bar +# trackbar_timestamp_styled When enabled, the timestamp respects +# trackbar_style +# +# /tb or /tb scroll is a command that will scroll to trackbar. +# +# /tb mark is a command that will redraw the line at the bottom. However! +# This requires irssi version after 20021228. otherwise you'll get the +# error redraw: unknown command, and your screen is all goofed up :) +# +# /upgrade & buf.pl notice: This version tries to remove the trackbars +# before the upgrade is done, so buf.pl does not restore them, as they are +# not removeable afterwards by trackbar. Unfortunately, to make this work, +# trackbar and buf.pl need to be loaded in a specific order. Please +# experiment to see which order works for you (strangely, it differs from +# configuration to configuration, something I will try to fix in a next +# version) +# +# Authors: +# - Main maintainer & author: Peter 'kinlo' Leurs +# - Many thanks to Timo 'cras' Sirainen for placing me on my way +# - on-upgrade-remove-line patch by Uwe Dudenhoeffer +# - trackbar resizing by Michiel Holtkamp (02 Jul 2012) +# - scroll to trackbar, window excludes, and timestamp options by Nico R. +# Wohlgemuth (22 Sep 2012) +# +# Version history: +# 1.9: - add version guard +# 1.8: - sub draw_bar +# 1.7: - Added /tb scroll, trackbar_hide_windows, trackbar_timestamp_timestamp +# and trackbar_timestamp_styled +# 1.6: - Work around Irssi resize bug, please do /upgrade! (see below) +# 1.5: - Resize trackbars in all windows when terminal is resized +# 1.4: - Changed our's by my's so the irssi script header is valid +# - Removed utf-8 support. In theory, the script should work w/o any +# problems for utf-8, just set trackbar_string to a valid utf-8 character +# and everything *should* work. However, this script is being plagued by +# irssi internal bugs. The function Irssi::settings_get_str does NOT handle +# unicode strings properly, hence you will notice problems when setting the bar +# to a unicode char. For changing your bar to utf-8 symbols, read the line sub. +# 1.3: - Upgrade now removes the trackbars. +# - Some code cleanups, other defaults +# - /mark sets the line to the bottom +# 1.2: - Support for utf-8 +# - How the bar looks can now be configured with trackbar_string +# and trackbar_style +# 1.1: - Fixed bug when closing window +# 1.0: - Initial release +# +# Contacts +# https://github.com/mjholtkamp/irssi-trackbar +# +# Known bugs: +# - if you /clear a window, it will be uncleared when returning to the window +# - changing the trackbar style is only visible after returning to a window +# however, changing style/resize takes in effect after you left the window. +# +# Whishlist/todo: +# - instead of drawing a line, just invert timestamp or something, +# to save a line (but I don't think this is possible with current irssi) +# - <@coekie> kinlo: if i switch to another window, in another split window, i +# want the trackbar to go down in the previouswindow in that splitwindow :) +# - < bob_2> anyway to clear the line once the window is read? +# +# BTW: when you have feature requests, mailing a patch that works is the fastest way +# to get it added :p + +# IRSSI RESIZE BUG: +# when resizing from a larger window to a smaller one, the width of the +# trackbar causes some lines at the bottom not to be shown. This only happens +# if the trackbar was not the last line. This glitch can be 'fixed' by +# resetting the trackbar to the last line (e.g. by switching to another window +# and back) and then resize twice (e.g. to a bigger size and back). Of course, +# this is not convenient for the user. +# This script works around this problem by printing not one, but two lines and +# then removing the second line. My guess is that irssi does something to the +# previous line (or the line cache) whenever a line is 'completed' (i.e. the +# EOL is sent). When only one line is printed, it is not 'completed', but when +# printing the second line, the first line is 'completed'. The second line is +# still not completed, but since we delete it straight away, it doesn't matter. +# +# Some effects from older versions (<1.6) of trackbar.pl can still screw up your +# buffer so we recommend to restart your irssi, or do an "/upgrade". After +# installing this version of trackbar.pl + +use strict; +use 5.6.1; +use Irssi 20140701; +use Irssi::TextUI; +use POSIX qw(strftime); +use utf8; + +our $VERSION = "1.9"; + +our %IRSSI = ( + authors => "Peter 'kinlo' Leurs, Uwe Dudenhoeffer, " . + "Michiel Holtkamp, Nico R. Wohlgemuth", + contact => "irssi-trackbar\@supermind.nl", + name => "trackbar", + description => "Shows a bar where you've last read a window", + license => "GPLv2", + url => "http://github.com/mjholtkamp/irssi-trackbar/", + changed => "2015-01-15 08:00", +); + +my %config; + +my $screen_resizing = 0; # terminal is being resized + +# This could be '(status)' if you want to hide the status window +Irssi::settings_add_str('trackbar', 'trackbar_hide_windows' => ''); +$config{'trackbar_hide_windows'} = Irssi::settings_get_str('trackbar_hide_windows'); + +Irssi::settings_add_str('trackbar', 'trackbar_string' => '-'); +$config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string'); + +Irssi::settings_add_str('trackbar', 'trackbar_style' => '%K'); +$config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style'); + +Irssi::settings_add_bool('trackbar', 'trackbar_timestamp' => 0); +$config{'trackbar_timestamp'} = Irssi::settings_get_bool('trackbar_timestamp'); + +Irssi::settings_add_bool('trackbar', 'trackbar_timestamp_styled' => 1); +$config{'trackbar_timestamp_styled'} = Irssi::settings_get_bool('trackbar_timestamp_styled'); + +$config{'timestamp_format'} = Irssi::settings_get_str('timestamp_format'); + +Irssi::signal_add( + 'setup changed' => sub { + $config{'trackbar_string'} = Irssi::settings_get_str('trackbar_string'); + $config{'trackbar_style'} = Irssi::settings_get_str('trackbar_style'); + $config{'trackbar_hide_windows'} = Irssi::settings_get_str('trackbar_hide_windows'); + $config{'trackbar_timestamp'} = Irssi::settings_get_bool('trackbar_timestamp'); + $config{'trackbar_timestamp_styled'} = Irssi::settings_get_bool('trackbar_timestamp_styled'); + $config{'timestamp_format'} = Irssi::settings_get_str('timestamp_format'); + if ($config{'trackbar_style'} =~ /(? sub { + my (undef, $oldwindow) = @_; + + draw_bar($oldwindow); + } +); + +# handel the line creation and the removing of the old lines +sub draw_bar ($) { + (my $window) = @_; + if ($window) { + my $line = $window->view()->get_bookmark('trackbar'); + + if (defined $line) { + $window->view()->remove_line($line); + $window->view()->redraw(); + } + + my $hidden =$config{'trackbar_hide_windows'}; + my $wname =$window->{'name'}; + + if ($wname eq "" || $hidden !~ $wname) { + $window->print(line($window->{'width'}), MSGLEVEL_NEVER); + $window->view()->set_bookmark_bottom('trackbar'); + } + } +} + +# terminal resize code inspired on nicklist.pl +sub sig_terminal_resized { + if ($screen_resizing) { + # prevent multiple resize_trackbars from running + return; + } + $screen_resizing = 1; + Irssi::timeout_add_once(10,\&resize_trackbars,[]); +} + +sub resize_trackbars { + my $active_win = Irssi::active_win(); + for my $window (Irssi::windows) { + next unless defined $window; + my $line = $window->view()->get_bookmark('trackbar'); + next unless defined $line; + + # first add new trackbar line, then remove the old one. For some reason + # this works better than removing the old one, then adding a new one + $window->print_after($line, MSGLEVEL_NEVER, line($window->{'width'})); + my $next = $line->next(); + $window->view()->set_bookmark('trackbar', $next); + $window->view()->remove_line($line); + + # This hack exists to work around a bug: see IRSSI RESIZE BUG above. + # Add a line after the trackbar and delete it immediately + $window->print_after($next, MSGLEVEL_NEVER, line(1)); + $window->view()->remove_line($next->next); + } + $active_win->view()->redraw(); + $screen_resizing = 0; +} + +Irssi::signal_add('terminal resized' => \&sig_terminal_resized); + +sub line { + my $width = shift; + my $string = $config{'trackbar_string'}; + + my $tslen = 0; + + if ($config{'trackbar_timestamp'}) { + $tslen = int(1 + length $config{'timestamp_format'}); + } + + if (!defined($string) || $string eq '') { + $string = '-'; + } + + # There is a bug in (irssi's) utf-8 handling on config file settings, as you + # can reproduce/see yourself by the following code sniplet: + # + # my $quake = pack 'U*', 8364; # EUR symbol + # Irssi::settings_add_str 'temp', 'temp_foo' => $quake; + # $a= length($quake); + # # $a => 1 + # $a= length(Irssi::settings_get_str 'temp_foo'); + # # $a => 3 + # $a= utf8::is_utf8(Irssi::settings_get_str 'temp_foo'); + # # $a => false + + utf8::decode($string); + + if ($string =~ m/---/) { + $string = pack('U*', 0x2500); + } + + if ($string =~ m/===/) { + $string = pack('U*', 0x2550); + } + + if ($string =~ m/___/) { + $string = pack('U*', 0x2501); + } + + if ($string =~ m/# #/) { + $string = pack('U*', 0x25ad)." "; + } + + my $length = length $string; + + my $times = $width / $length - $tslen; + $times = int(1 + $times) if $times != int($times); + $string =~ s/%/%%/g; + + if ($tslen) { + # why $config{'timestamp_format'} won't work here? + my $ts = strftime(Irssi::settings_get_str('timestamp_format')." ", localtime); + + if ($config{'trackbar_timestamp_styled'}) { + return $config{'trackbar_style'} . $ts . substr($string x $times, 0, $width); + } else { + return $ts . $config{'trackbar_style'} . substr($string x $times, 0, $width); + } + } else { + return $config{'trackbar_style'} . substr($string x $times, 0, $width); + } +} + +# Remove trackbars on upgrade - but this doesn't really work if the scripts are not loaded in the correct order... watch out! + +Irssi::signal_add_first('session save' => sub { + for my $window (Irssi::windows) { + next unless defined $window; + my $line = $window->view()->get_bookmark('trackbar'); + $window->view()->remove_line($line) if defined $line; + } +} +); + +sub cmd_mark { + my $window = Irssi::active_win(); + + draw_bar($window); +} + + +# mark all visible windows with a line +sub cmd_mark_visual { + my $w= Irssi::active_win(); + my $refs =$w->{refnum}; + my $refa; + + cmd_mark(); + + do { + Irssi::command('window down'); + $w= Irssi::active_win(); + $refa =$w->{refnum}; + + if ($refs != $refa) { + cmd_mark(); + } + + } while ($refs != $refa) +} + +# /tb or /trackbar +sub cmd_tb { + if ($#_ >=0 ) { + my $sc = shift @_; + $sc =~ s/\s+$//; + + if ($sc eq "mark") { + cmd_mark(); + } elsif ($sc eq "help") { + cmd_help("trackbar"); + } elsif ($sc eq "vmark") { + cmd_mark_visual(); + } else { + cmd_scroll(); + } + } +} + +sub cmd_scroll { + my $window = Irssi::active_win(); + my $line = $window->view()->get_bookmark('trackbar'); + $window->view()->scroll_line($line) if defined $line; +} + +sub cmd_help { + my $help = < Go to window +# + +use strict; +use vars qw($VERSION %IRSSI); + +$VERSION = '1.0.0'; +%IRSSI = ( + authors => 'Trevor "tee" Slocum', + contact => 'tslocum@gmail.com', + name => 'WinNum', + description => 'Goto a window by its reference number with /##', + license => 'GPLv3', + url => 'https://github.com/tslocum/irssi-scripts', + changed => '2014-05-01' +); + +sub winnum_default_command { + my ($command, $server) = @_; + + $command =~ s/^\s+//; + $command =~ s/\s+$//; + my $winnum = ($command =~ /(\w+)/)[0]; + + if ($winnum =~ /^\d+$/) { + my $window = Irssi::window_find_refnum($winnum); + $window->set_active if $window; + + Irssi::signal_stop(); + } +} + +Irssi::signal_add_first("default command", "winnum_default_command"); + +print $IRSSI{name} . ': v' . $VERSION . ' loaded. Enter %9/%9 to goto a window.'; diff --git a/archive/.irssi/startup b/archive/.irssi/startup new file mode 100644 index 00000000..67a2a3c4 --- /dev/null +++ b/archive/.irssi/startup @@ -0,0 +1,3 @@ +load perl +script exec $ENV{'TZ'}='MST'; +window goto 1 diff --git a/archive/bin/ii b/archive/bin/ii new file mode 100755 index 00000000..d3176ad8 --- /dev/null +++ b/archive/bin/ii @@ -0,0 +1,30 @@ +#!/bin/bash + +if [ "$(hostname -f)" = "athena.silentflame.com" ]; then + # start irssi under tmux if it's not running + # we used to use dtach, but then dtach+mosh started to mispaint irssi + if ! tmux list-sessions | grep -Eq "^irssi:"; then + # If there's no root tmux daemon yet, ensure it has a normal PATH. + if ! tmux info >/dev/null 2>&1; then + source /etc/profile + source $HOME/.shenv + fi + # if I change timezone, patch the following line on 'athena' + # branch of dotfiles repo; e.g. `TZ=Asia/Taipei`. Then in + # running session, do e.g. /script exec $ENV{'TZ'}='Asia/Taipei'; + SHELL=/bin/bash TZ=MST tmux new-session -d -s irssi irssi + fi + + # disable the status bar + tmux set -t irssi status off + + # if we're not at a dumb terminal (so this script can be shoved in a + # crontab), try to attach what we (maybe) just made. + # following line is a bashism + if [ -t 1 ]; then + tmux attach-session -t irssi + fi +else + # on a workstation, get connected to athena + mosh athena /home/spwhitton/src/dotfiles/bin/ii +fi diff --git a/archive/bin/send-irssi-away-log b/archive/bin/send-irssi-away-log new file mode 100755 index 00000000..b7df1dcc --- /dev/null +++ b/archive/bin/send-irssi-away-log @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +use 5.028; +use strict; +use warnings; + +use Text::Wrap; + +our $away_log = "$ENV{HOME}/local/irclogs/away.log"; +exit unless -r $away_log; + +my $pos = 1; +if (-r "$away_log.pos") { + open my $pos_fh, "<", "$away_log.pos"; + chomp($pos = <$pos_fh>); +} + +my @lines; +open my $fh, "<", $away_log; +while (<$fh>) { + $. > $pos or next; + chomp; + s{./?}{}g; + /^[0-9]{2}:[0-9]{2}:[0-9]{2}\S+ \S+> / + and push @lines, wrap $&, " " x length $&, $'; +} + +exit unless @lines; + +open my $mail, "|-", "/usr/sbin/sendmail -t"; +say $mail "To: spwhitton"; +say $mail "From: spwhitton (Cron Daemon)"; +say $mail "Subject: Irssi away.log new messages"; +print $mail "\n"; +print $mail "$_\n\n" for @lines; + +open my $pos_fh, ">", "$away_log.pos"; +say $pos_fh $fh->input_line_number; diff --git a/bin/ii b/bin/ii deleted file mode 100755 index d3176ad8..00000000 --- a/bin/ii +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -if [ "$(hostname -f)" = "athena.silentflame.com" ]; then - # start irssi under tmux if it's not running - # we used to use dtach, but then dtach+mosh started to mispaint irssi - if ! tmux list-sessions | grep -Eq "^irssi:"; then - # If there's no root tmux daemon yet, ensure it has a normal PATH. - if ! tmux info >/dev/null 2>&1; then - source /etc/profile - source $HOME/.shenv - fi - # if I change timezone, patch the following line on 'athena' - # branch of dotfiles repo; e.g. `TZ=Asia/Taipei`. Then in - # running session, do e.g. /script exec $ENV{'TZ'}='Asia/Taipei'; - SHELL=/bin/bash TZ=MST tmux new-session -d -s irssi irssi - fi - - # disable the status bar - tmux set -t irssi status off - - # if we're not at a dumb terminal (so this script can be shoved in a - # crontab), try to attach what we (maybe) just made. - # following line is a bashism - if [ -t 1 ]; then - tmux attach-session -t irssi - fi -else - # on a workstation, get connected to athena - mosh athena /home/spwhitton/src/dotfiles/bin/ii -fi diff --git a/bin/send-irssi-away-log b/bin/send-irssi-away-log deleted file mode 100755 index b7df1dcc..00000000 --- a/bin/send-irssi-away-log +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl - -use 5.028; -use strict; -use warnings; - -use Text::Wrap; - -our $away_log = "$ENV{HOME}/local/irclogs/away.log"; -exit unless -r $away_log; - -my $pos = 1; -if (-r "$away_log.pos") { - open my $pos_fh, "<", "$away_log.pos"; - chomp($pos = <$pos_fh>); -} - -my @lines; -open my $fh, "<", $away_log; -while (<$fh>) { - $. > $pos or next; - chomp; - s{./?}{}g; - /^[0-9]{2}:[0-9]{2}:[0-9]{2}\S+ \S+> / - and push @lines, wrap $&, " " x length $&, $'; -} - -exit unless @lines; - -open my $mail, "|-", "/usr/sbin/sendmail -t"; -say $mail "To: spwhitton"; -say $mail "From: spwhitton (Cron Daemon)"; -say $mail "Subject: Irssi away.log new messages"; -print $mail "\n"; -print $mail "$_\n\n" for @lines; - -open my $pos_fh, ">", "$away_log.pos"; -say $pos_fh $fh->input_line_number; -- cgit v1.2.3