feat(config): irssi config and plugins

This commit is contained in:
2023-09-29 14:43:59 +03:00
parent b1a7932b72
commit 540054d4bb
12 changed files with 2302 additions and 10 deletions

View File

@@ -140,8 +140,7 @@ alias code_scanner='docker run
alias zedit='$EDITOR ~/.dotfiles'
have irssi \
&& alias irssi="irssi --config='$IRSSI_CONFIG_FILE' --home='$IRSSI_CONFIG_HOME'"
alias irssi="irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_CONFIG_HOME/irssi"
if [[ -f "$HOME/.aliases.local" ]]; then
# shellcheck disable=SC1091

View File

@@ -53,14 +53,6 @@ export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export GOPATH="$XDG_DATA_HOME/go"
export GOBIN="$XDG_BIN_HOME"
# irssi
have irssi && {
# These variables are used in ./alias with --config and --home
export IRSSI_CONFIG_HOME="$XDG_CONFIG_HOME/irssi"
export IRSSI_CONFIG_FILE="$IRSSI_CONFIG_HOME/config"
x-dc "$IRSSI_CONFIG_HOME"
}
# nb, https://xwmx.github.io/nb/
export NBRC_PATH="$XDG_CONFIG_HOME/nbrc"
export NB_DIR="$XDG_STATE_HOME/nb"

318
config/irssi/config Normal file
View File

@@ -0,0 +1,318 @@
servers = (
{ address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; },
{
address = "ssl.efnet.org";
chatnet = "EFNet";
port = "9999";
use_tls = "yes";
tls_verify = "no";
},
{
address = "irc.esper.net";
chatnet = "EsperNet";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
},
{
address = "irc.libera.chat";
chatnet = "liberachat";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
},
{
address = "irc.gamesurge.net";
chatnet = "GameSurge";
port = "6667";
},
{
address = "ssl.ircnet.ovh";
chatnet = "IRCnet";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
},
{ address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; },
{
address = "irc.ircsource.net";
chatnet = "IRCSource";
port = "6667";
},
{ address = "irc.netfuze.net"; chatnet = "NetFuze"; port = "6667"; },
{
address = "irc.oftc.net";
chatnet = "OFTC";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
},
{
address = "irc.quakenet.org";
chatnet = "QuakeNet";
port = "6667";
},
{
address = "irc.rizon.net";
chatnet = "Rizon";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
},
{ address = "silc.silcnet.org"; chatnet = "SILC"; port = "706"; },
{
address = "irc.undernet.org";
chatnet = "Undernet";
port = "6667";
}
);
chatnets = {
DALnet = {
type = "IRC";
max_kicks = "4";
max_msgs = "20";
max_whois = "30";
};
EFNet = {
type = "IRC";
max_kicks = "1";
max_msgs = "4";
max_whois = "1";
};
EsperNet = {
type = "IRC";
max_kicks = "1";
max_msgs = "4";
max_whois = "1";
};
liberachat = {
type = "IRC";
max_kicks = "1";
max_msgs = "4";
max_whois = "1";
};
GameSurge = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
IRCnet = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
IRCSource = {
type = "IRC";
max_kicks = "1";
max_msgs = "4";
max_whois = "1";
};
NetFuze = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
OFTC = { type = "IRC"; max_kicks = "1"; max_msgs = "1"; max_whois = "1"; };
QuakeNet = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
Rizon = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
SILC = { type = "SILC"; };
Undernet = {
type = "IRC";
max_kicks = "1";
max_msgs = "1";
max_whois = "1";
};
};
channels = (
{ name = "#lobby"; chatnet = "EsperNet"; autojoin = "No"; },
{ name = "#libera"; chatnet = "liberachat"; autojoin = "No"; },
{ name = "#irssi"; chatnet = "liberachat"; autojoin = "No"; },
{ name = "#gamesurge"; chatnet = "GameSurge"; autojoin = "No"; },
{ name = "#irssi"; chatnet = "IRCNet"; autojoin = "No"; },
{ name = "#ircsource"; chatnet = "IRCSource"; autojoin = "No"; },
{ name = "#netfuze"; chatnet = "NetFuze"; autojoin = "No"; },
{ name = "#oftc"; chatnet = "OFTC"; autojoin = "No"; },
{ name = "silc"; chatnet = "SILC"; autojoin = "No"; }
);
aliases = {
ATAG = "WINDOW SERVER";
ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{visible_name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
B = "BAN";
BACK = "AWAY";
BANS = "BAN";
BYE = "QUIT";
C = "CLEAR";
CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi";
CHAT = "DCC CHAT";
CS = "QUOTE CS";
DATE = "TIME";
DEHIGHLIGHT = "DEHILIGHT";
DESCRIBE = "ACTION";
DHL = "DEHILIGHT";
EXEMPTLIST = "MODE $C +e";
EXIT = "QUIT";
GOTO = "SCROLLBACK GOTO";
HIGHLIGHT = "HILIGHT";
HL = "HILIGHT";
HOST = "USERHOST";
INVITELIST = "MODE $C +I";
J = "JOIN";
K = "KICK";
KB = "KICKBAN";
KN = "KNOCKOUT";
LAST = "LASTLOG";
LEAVE = "PART";
M = "MSG";
MS = "QUOTE MS";
MUB = "UNBAN *";
N = "NAMES";
NMSG = "^MSG";
NS = "QUOTE NS";
OS = "QUOTE OS";
P = "PART";
Q = "QUERY";
RESET = "SET -default";
RUN = "SCRIPT LOAD";
SAY = "MSG *";
SB = "SCROLLBACK";
SBAR = "STATUSBAR";
SHELP = "QUOTE HELP";
SIGNOFF = "QUIT";
SV = "MSG * Irssi $J ($V) - https://irssi.org";
T = "TOPIC";
UB = "UNBAN";
UMODE = "MODE $N";
UNSET = "SET -clear";
W = "WHO";
WC = "WINDOW CLOSE";
WG = "WINDOW GOTO";
WJOIN = "JOIN -window";
WI = "WHOIS";
WII = "WHOIS $0 $0";
WL = "WINDOW LIST";
WN = "WINDOW NEW HIDDEN";
WQUERY = "QUERY -window";
WW = "WHOWAS";
};
statusbar = {
items = {
barstart = "{sbstart}";
barend = "{sbend}";
topicbarstart = "{topicsbstart}";
topicbarend = "{topicsbend}";
time = "{sb $Z}";
user = "{sb {sbnickmode $cumode}$N{sbmode $usermode}{sbaway $A}}";
window = "{sb $winref:$tag/$itemname{sbmode $M}}";
window_empty = "{sb $winref{sbservertag $tag}}";
prompt = "{prompt $[.15]itemname}";
prompt_empty = "{prompt $winname}";
topic = " $topic";
topic_empty = " Irssi v$J - https://irssi.org";
lag = "{sb Lag: $0-}";
act = "{sb Act: $0-}";
more = "-- more --";
};
default = {
window = {
disabled = "no";
type = "window";
placement = "bottom";
position = "1";
visible = "active";
items = {
barstart = { priority = "100"; };
time = { };
user = { };
window = { };
window_empty = { };
lag = { priority = "-1"; };
act = { priority = "10"; };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
window_inact = {
type = "window";
placement = "bottom";
position = "1";
visible = "inactive";
items = {
barstart = { priority = "100"; };
window = { };
window_empty = { };
more = { priority = "-1"; alignment = "right"; };
barend = { priority = "100"; alignment = "right"; };
};
};
prompt = {
type = "root";
placement = "bottom";
position = "100";
visible = "always";
items = {
prompt = { priority = "-1"; };
prompt_empty = { priority = "-1"; };
input = { priority = "10"; };
};
};
topic = {
type = "root";
placement = "top";
position = "1";
visible = "always";
items = {
topicbarstart = { priority = "100"; };
topic = { };
topic_empty = { };
topicbarend = { priority = "100"; alignment = "right"; };
};
};
};
};
settings = {
core = {
real_name = "Ismo Vuorinen";
user_name = "ivuorinen";
nick = "ivuorinen";
};
"fe-common/core" = { theme = "lyynx"; };
};

295
config/irssi/default.theme Normal file
View File

@@ -0,0 +1,295 @@
# 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. "ownnick" 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";
window_border = "%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" already puts a 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";
};

258
config/irssi/lyynx.theme Normal file
View File

@@ -0,0 +1,258 @@
# LyyNx.theme
# started this by editing agon.theme, but later i noticed that there
# was nothing left from agon :)
# so here it is. i use it with transparent aterm, tint - lightblue,
# shading - 99, foreground - lightyellow
default_color = "-1";
info_eol = "false";
replaces = { "[]=" = "%K$*%n"; };
abstracts = {
##
## generic
##
# text to insert at the beginning of each non-message line
line_start = ". ";
# timestamp styling, nothing by default
timestamp = "%w$*%n";
# 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 = "%w$0-%n";
# nick is printed
nick = "%_%n$*%_";
# 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$0-%n";
chanhost_hilight = "{nickhost %w$0-%n}";
# nick/host is printed (parts, quits, etc.)
channick = "%c$*";
chanhost = "%w{nickhost $*}";
# highlighted channel name is printed
channelhilight = "%n$*%n";
# ban/ban exception/invite list mask is printed
ban = "%n$*%n";
##
## messages
##
# the basic styling of how to print message, $0 = nick mode, $1 = nick
msgnick = "%_%n$0%n$1-%w:%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 mod, $1 = nick
ownmsgnick = "%n{msgnick %n$0$1-%n}%w";
ownnick = "%w$*%n";
# public message in channel, $0 = nick mode, $1 = nick
pubmsgnick = "{msgnick %n$0 %b$1-}";
pubnick = "%w$*%n";
# public message in channel meant for me, $0 = nick mode, $1 = nick
pubmsgmenick = "{msgnick $0 $1-}";
menick = "%w$*";
# 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 = "[%n$0%K(%W$1-%K)%n] ";
# private message from you, $0 = "msg", $1 = target nick
ownprivmsg = "[%n$0%K(%n$1-%K)%n] ";
# own private message in query
ownprivmsgnick = "{msgnick $*}%W";
ownprivnick = "%n$*%W";
# private message in query
privmsgnick = "{msgnick $*}";
##
## Actions (/ME stuff)
##
# used internally by this theme
action_core = "%c * $*";
# 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 = "%W (*) $*%n ";
pvtaction_query = "{action $*}";
# public action sent by others
pubaction = "{action $*}";
##
## other IRC events
##
# whois
whois = "$[8]0: $1-";
# notices
ownnotice = "[%n$0%K(%R$1-%K)]%n ";
notice = "%K-%C$*%K-%n ";
pubnotice_channel = "%K:%m$*";
pvtnotice_host = "%K(%m$*%K)";
servernotice = "%g!$*%n ";
# CTCPs
ownctcp = "[%y$0%K(%n$1-%K)] ";
ctcp = "%Y$*%n";
# wallops
wallop = "%W$*%n: ";
wallop_nick = "%n$*";
wallop_action = "%W * $*%n ";
# netsplits
netsplit = "%n$*%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 = "%c$*%n";
names_channel = "%C$*%n";
# DCC
dcc = "%g$*%n";
dccfile = "%_$*%_";
# DCC chat, own msg/action
dccownmsg = "[%n$0%K($1-%K)%n] ";
dccownnick = "%n$*%n";
dccownquerynick = "%W$*%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 = "%W (*dcc*) $*%n %|";
##
## statusbar
##
# default background for all statusbars. You can also give
# the default foreground color for statusbar items.
sb_background = "%N%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 = " %n$*%n";
sbmode = "";
#sbaway = " (%g[away]%n)";
sbservertag = " $0";
sbnickmode = "$0";
# activity in statusbar
# ',' separator
sb_act_sep = "%K$*";
# normal text
sb_act_text = "%w$*";
# public message
sb_act_msg = "%c$*";
# hilight
sb_act_hilight = "%C$*";
# hilight with specified color, $0 = color, $1 = text
sb_act_hilight_color = "$0$1-%n";
};
formats = {
"fe-common/core" = {
join = "%g{channick $0} {chanhost $1} %cgot in {channel $2}";
part = "%g{channick $0} {chanhost $1} %cgot out of%n $2";
kick = "%g{channick $2} kicked %g{channick $0} ($3)";
quit = "%g{channick $0} {chanhost $1} %cleft irc%n ($2)";
line_start_irssi = "{line_start}";
nick_changed = "%g{channick $0} --> {channick $1}";
new_topic = "%g{nick $0} topic change -> {channel $1} to: $2";
endofnames = "$1 nicks totaly - $2 ops, $3 voices and $4 normal";
timestamp = "{timestamp %%H:%%M:%%S} ";
};
};

View File

@@ -0,0 +1,129 @@
# /AUTOAWAY <n> - Mark user away after <n> seconds of inactivity
# /AWAY - play nice with autoaway
# New, brighter, whiter version of my autoaway script. Actually works :)
# (c) 2000 Larry Daffner (vizzie@airmail.net)
# You may freely use, modify and distribute this script, as long as
# 1) you leave this notice intact
# 2) you don't pretend my code is yours
# 3) you don't pretend your code is mine
#
# share and enjoy!
# A simple script. /autoaway <n> will mark you as away automatically if
# you have not typed any commands in <n> seconds. (<n>=0 disables the feature)
# It will also automatically unmark you away the next time you type a command.
# Note that using the /away command will disable the autoaway mechanism, as
# well as the autoreturn. (when you unmark yourself, the autoaway wil
# restart again)
# Thanks to Adam Monsen for multiserver and config file fix
use strict;
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);
$VERSION = "0.5";
%IRSSI = (
authors => 'Larry "Vizzie" Daffner',
contact => 'vizzie@airmail.net',
name => 'Automagic away setting',
description => 'Automatically goes away after defined inactivity',
license => 'BSD',
url => 'http://www.flamingpackets.net/~vizzie/irssi/',
changed => '2018-12-02',
);
my ($autoaway_sec, $autoaway_to_tag, $autoaway_state);
$autoaway_state = 0;
#
# /AUTOAWAY - set the autoaway timeout
#
sub cmd_autoaway {
my ($data, $server, $channel) = @_;
if (!($data =~ /^[0-9]+$/)) {
Irssi::print("autoaway: usage: /autoaway <seconds>");
return 1;
}
$autoaway_sec = $data;
if ($autoaway_sec) {
Irssi::settings_set_int("autoaway_timeout", $autoaway_sec);
Irssi::print("autoaway timeout set to $autoaway_sec seconds");
} else {
Irssi::print("autoway disabled");
}
if (defined($autoaway_to_tag)) {
Irssi::timeout_remove($autoaway_to_tag);
$autoaway_to_tag = undef;
}
if ($autoaway_sec) {
$autoaway_to_tag =
Irssi::timeout_add($autoaway_sec*1000, "auto_timeout", "");
}
}
#
# away = Set us away or back, within the autoaway system
sub cmd_away {
my ($data, $server, $channel) = @_;
if ($data eq "") {
$autoaway_state = 0;
} else {
if ($autoaway_state eq 0) {
Irssi::timeout_remove($autoaway_to_tag);
$autoaway_to_tag = undef;
$autoaway_state = 2;
}
}
}
sub auto_timeout {
my ($data, $server) = @_;
# we're in the process.. don't touch anything.
$autoaway_state = 3;
foreach my $server (Irssi::servers()) {
$server->command("/AWAY autoaway after $autoaway_sec seconds");
}
Irssi::timeout_remove($autoaway_to_tag);
$autoaway_state = 1;
}
sub reset_timer {
if ($autoaway_state eq 1) {
$autoaway_state = 3;
foreach my $server (Irssi::servers()) {
$server->command("/AWAY");
}
$autoaway_state = 0;
}
if ($autoaway_state eq 0) {
if (defined($autoaway_to_tag)) {
Irssi::timeout_remove($autoaway_to_tag);
$autoaway_to_tag = undef();
}
if ($autoaway_sec) {
$autoaway_to_tag = Irssi::timeout_add($autoaway_sec*1000, "auto_timeout", "");
}
}
}
Irssi::settings_add_int("misc", "autoaway_timeout", 0);
$autoaway_sec = Irssi::settings_get_int("autoaway_timeout");
reset_timer();
Irssi::command_bind('autoaway', 'cmd_autoaway');
Irssi::command_bind('away', 'cmd_away');
Irssi::signal_add('send command', 'reset_timer');
# vim:set expandtab ts=2 sw=2:

View File

@@ -0,0 +1,39 @@
# /WHOIS all the users who send you a private message.
# v1.1 for irssi 0.7.98 by Timo Sirainen
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "1.1";
%IRSSI = (
authors => "Timo \'cras\' Sirainen",
contact => "tss\@iki.fi",
name => "autowhois",
description => "/WHOIS all the users who send you a private message.",
license => "Public Domain",
url => "http://irssi.org/",
changed => "2002-03-04T22:47+0100",
changes => "v1.1: don't /WHOIS if query exists for the nick already"
);
# History:
# v1.1: don't /WHOIS if query exists for the nick already
my ($lastfrom, $lastquery);
sub msg_private_first {
my ($server, $msg, $nick, $address) = @_;
$lastquery = $server->query_find($nick);
}
sub msg_private {
my ($server, $msg, $nick, $address) = @_;
return if $lastquery || $lastfrom eq $nick;
$lastfrom = $nick;
$server->command("whois $nick");
}
Irssi::signal_add_first('message private', 'msg_private_first');
Irssi::signal_add('message private', 'msg_private');

View File

@@ -0,0 +1,115 @@
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<tab> and /go <tab> (that's two spaces)
#
# The following settings exist:
#
# /SET go_match_case_sensitive [ON|OFF]
# Match window/item names sensitively (the default). Turning this off
# means e.g. "/go foo" would jump to a window named "Foobar", too.
#
# /SET go_match_anchored [ON|OFF]
# Match window/names only at the start of the word (the default). Turning
# this off will mean that strings can match anywhere in the window/names.
# The leading '#' of channel names is optional either way.
#
# /SET go_complete_case_sensitive [ON|OFF]
# When using tab-completion, match case-insensitively (the default).
# Turning this on means that "/go foo<tab>" will *not* suggest "Foobar".
#
# /SET go_complete_anchored [ON|OFF]
# Match window/names only at the start of the word. The default is 'off',
# which causes completion to match anywhere in the window/names during
# completion. The leading '#' of channel names is optional either way.
#
$VERSION = '1.1.1';
%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 => '2019-02-25'
);
sub _make_regexp {
my ($name, $ci, $aw) = @_;
my $re = "\Q${name}\E";
$re = "(?i:$re)" unless $ci;
$re = "^#?$re" if $aw;
return $re;
}
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);
my $re = _make_regexp($word,
Irssi::settings_get_bool('go_complete_case_sensitive'),
Irssi::settings_get_bool('go_complete_anchored'));
@$complist = ();
foreach my $w (Irssi::windows) {
my $name = $w->get_active_name();
if ($word ne "") {
if ($name =~ $re) {
push(@$complist, $name)
}
} else {
push(@$complist, $name);
}
}
Irssi::signal_stop();
};
sub cmd_go
{
my($chan,$server,$witem) = @_;
my $case_sensitive = Irssi::settings_get_bool('go_match_case_sensitive');
my $match_anchored = Irssi::settings_get_bool('go_match_anchored');
$chan =~ s/ *//g;
my $re = _make_regexp($chan, $case_sensitive, $match_anchored);
my @matches;
foreach my $w (Irssi::windows) {
my $name = $w->get_active_name();
if (($case_sensitive && $name eq $chan) ||
(!$case_sensitive && CORE::fc $name eq CORE::fc $chan)) {
$w->set_active();
return;
} elsif ($name =~ /$re/) {
push(@matches, $w);
}
}
if (@matches) {
$matches[0]->set_active();
}
}
Irssi::command_bind("go", "cmd_go");
Irssi::signal_add_first('complete word', 'signal_complete_go');
Irssi::settings_add_bool('go', 'go_match_case_sensitive', 1);
Irssi::settings_add_bool('go', 'go_complete_case_sensitive', 0);
Irssi::settings_add_bool('go', 'go_match_anchored', 1);
Irssi::settings_add_bool('go', 'go_complete_anchored', 0);
# Changelog
#
# 2017-02-02 1.1 martin f. krafft <madduck@madduck.net>
# - made case-sensitivity of match configurable
# - made anchoring of search strings configurable
#
# 2019-02-025 1.1.1 dylan lloyd <dylan@disinclined.org>
# - prefer exact channel matches

View File

@@ -0,0 +1,113 @@
use strict;
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);
$VERSION = "1.0";
%IRSSI = (
"authors" => "Mantis",
"contact" => "mantis\@inta-link.com",
"name" => "highlite",
"description" => "shows events happening in all channels you are in that may concern you",
"url" => "http://www.inta-link.com/",
"license" => "GNU GPL v2",
"changed" => "2003-01-03"
);
sub msg_join
{
my ($server, $channame, $nick, $host) = @_;
$channame =~ s/^://;
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%B%0JOIN : " . $nick . " : " . $channame . " : " . $host, MSGLEVEL_CLIENTCRAP) if ($windowname);
}
sub msg_part
{
my ($server, $channame, $nick, $host) = @_;
$channame =~ s/^://;
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%b%0PART : " . $nick . " : " . $channame . " : " . $host, MSGLEVEL_CLIENTCRAP) if ($windowname);
}
sub msg_quit
{
my ($server, $nick, $host, $quitmsg) = @_;
if (substr($quitmsg, 0, 14) eq "Read error to ")
{
$quitmsg = "[ General Read Error ]";
}
if (substr($quitmsg, 0, 17) eq "Ping timeout for ")
{
$quitmsg = "[ General Ping Timeout Error ]";
}
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%R%0QUIT : " . $nick . " : " . $host . " : " . $quitmsg, MSGLEVEL_CLIENTCRAP) if ($windowname);
$quitmsg = "";
}
sub msg_topic
{
my ($server, $channame, $topicmsg, $nick, $host) = @_;
$channame =~ s/^://;
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%G%0TOPIC : " . $nick . " : " . $channame . " : " . $topicmsg, MSGLEVEL_CLIENTCRAP) if ($windowname);
}
sub msg_nick
{
my ($server, $nick, $old_nick, $host) = @_;
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%m%0NICK : " . $old_nick . " : " . $nick . " : " . $host, MSGLEVEL_CLIENTCRAP) if ($windowname);
}
sub msg_kick
{
my ($server, $channame, $kicked, $nick, $host, $reason) = @_;
$channame =~ s/^://;
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%Y%0KICK : " . $kicked . " : " . $channame . " : " . $nick . " : " . $reason, MSGLEVEL_CLIENTCRAP) if ($windowname);
}
sub sig_printtext {
my ($dest, $text, $stripped) = @_;
if (($dest->{level} & (MSGLEVEL_HILIGHT|MSGLEVEL_MSGS)) && ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0)
{
if ($dest->{level} & MSGLEVEL_PUBLIC)
{
my $windowname = Irssi::window_find_name('highlite');
$windowname->print("%W%0HIGHLITE : " . $dest->{target} . " : " . $text, MSGLEVEL_CLIENTCRAP) if ($windowname);
}
}
}
my $windowname = Irssi::window_find_name('highlite');
if (!$windowname)
{
Irssi::command("window new hidden");
Irssi::command("window name highlite");
}
Irssi::signal_add(
{
'message join' => \&msg_join,
'message part' => \&msg_part,
'message quit' => \&msg_quit,
'message topic' => \&msg_topic,
'print text', 'sig_printtext',
'message nick' => \&msg_nick,
'message kick' => \&msg_kick
}
);

View File

@@ -0,0 +1,257 @@
use strict;
use Irssi 20020101.0250 ();
use vars qw($VERSION %IRSSI);
$VERSION = "2.1";
%IRSSI = (
authors => "Timo Sirainen, Ian Peters, David Leadbeater, Bruno Cattáneo",
contact => "tss\@iki.fi",
name => "Nick Color",
description => "assign a different color for each nick",
license => "Public Domain",
url => "http://irssi.org/",
changed => "Mon 08 Jan 21:28:53 BST 2018",
);
# Tweaks to this plugin are:
# - Moved irssi folder under $XDG_CONFIG_HOME/irssi/
# - changed TABs to spaces
# Settings:
# nickcolor_colors: List of color codes to use.
# e.g. /set nickcolor_colors 2 3 4 5 6 7 9 10 11 12 13
# (avoid 8, as used for hilights in the default theme).
#
# nickcolor_enable_prefix: Enables prefix for same nick.
#
# nickcolor_enable_truncate: Enables nick truncation.
#
# nickcolor_prefix_text: Prefix text for succesive messages.
# e.g. /set nickcolor_prefix_text -
#
# nickcolor_truncate_value: Truncate nick value.
# e.g. /set nickcolor_truncate_value -7
# This will truncate nicknames at 7 characters and make them right aligned
my %saved_colors;
my %session_colors = {};
my %saved_nicks; # To store each channel's last nickname
sub load_colors {
open my $color_fh, "<", "$ENV{XDG_CONFIG_HOME}/irssi/saved_colors";
while (<$color_fh>) {
chomp;
my($nick, $color) = split ":";
$saved_colors{$nick} = $color;
}
}
sub save_colors {
open COLORS, ">", "$ENV{XDG_CONFIG_HOME}/irssi/saved_colors";
foreach my $nick (keys %saved_colors) {
print COLORS "$nick:$saved_colors{$nick}\n";
}
close COLORS;
}
# If someone we've colored (either through the saved colors, or the hash
# function) changes their nick, we'd like to keep the same color associated
# with them (but only in the session_colors, ie a temporary mapping).
sub sig_nick {
my ($server, $newnick, $nick, $address) = @_;
my $color;
$newnick = substr ($newnick, 1) if ($newnick =~ /^:/);
if ($color = $saved_colors{$nick}) {
$session_colors{$newnick} = $color;
} elsif ($color = $session_colors{$nick}) {
$session_colors{$newnick} = $color;
}
}
# This gave reasonable distribution values when run across
# /usr/share/dict/words
sub simple_hash {
my ($string) = @_;
chomp $string;
my @chars = split //, $string;
my $counter;
foreach my $char (@chars) {
$counter += ord $char;
}
my @colors = split / /, Irssi::settings_get_str('nickcolor_colors');
$counter = $colors[$counter % @colors];
return $counter;
}
# process public (others) messages
sub sig_public {
my ($server, $msg, $nick, $address, $target) = @_;
my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix');
my $enable_truncate = Irssi::settings_get_bool('nickcolor_enable_truncate');
my $prefix_text = Irssi::settings_get_str('nickcolor_prefix_text');
my $truncate_value = Irssi::settings_get_int('nickcolor_truncate_value');
# Reference for server/channel
my $tagtarget = "$server->{tag}/$target";
# Set default nick truncate value to 0 if option is disabled
$truncate_value = 0 if (!$enable_truncate);
# Has the user assigned this nick a color?
my $color = $saved_colors{$nick};
# Have -we- already assigned this nick a color?
if (!$color) {
$color = $session_colors{$nick};
}
# Let's assign this nick a color
if (!$color) {
$color = simple_hash $nick;
$session_colors{$nick} = $color;
}
$color = sprintf "\003%02d", $color;
# Optional: We check if it's the same nickname for current target
if ($saved_nicks{$tagtarget} eq $nick && $enable_prefix)
{
# Grouped message
Irssi::command('/^format pubmsg ' . $prefix_text . '$1');
}
else
{
# Normal message
Irssi::command('/^format pubmsg {pubmsgnick $2 {pubnick ' . $color . '$[' . $truncate_value . ']0}}$1');
# Save nickname for next message
$saved_nicks{$tagtarget} = $nick;
}
}
# process public (me) messages
sub sig_me {
my ($server, $msg, $target) = @_;
my $nick = $server->{nick};
my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix');
my $enable_truncate = Irssi::settings_get_bool('nickcolor_enable_truncate');
my $prefix_text = Irssi::settings_get_str('nickcolor_prefix_text');
my $truncate_value = Irssi::settings_get_int('nickcolor_truncate_value');
# Reference for server/channel
my $tagtarget = "$server->{tag}/$target";
# Set default nick truncate value to 0 if option is disabled
$truncate_value = 0 if (!$enable_truncate);
# Optional: We check if it's the same nickname for current target
if ($saved_nicks{$tagtarget} eq $nick && $enable_prefix)
{
# Grouped message
Irssi::command('/^format own_msg ' . $prefix_text . '$1');
}
else
{
# Normal message
Irssi::command('/^format own_msg {ownmsgnick $2 {ownnick $[' . $truncate_value . ']0}}$1');
# Save nickname for next message
$saved_nicks{$tagtarget} = $nick;
}
}
# process public (others) actions
sub sig_action_public {
my ($server, $msg, $nick, $address, $target) = @_;
my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix');
# Reference for server/channel
my $tagtarget = "$server->{tag}/$target";
# Empty current target nick if prefix option is enabled
$saved_nicks{$tagtarget} = '' if ($enable_prefix);
}
# process public (me) actions
sub sig_action_me {
my ($server, $msg, $target) = @_;
my $nick = $server->{nick};
my $enable_prefix = Irssi::settings_get_bool('nickcolor_enable_prefix');
# Reference for server/channel
my $tagtarget = "$server->{tag}/$target";
# Empty current target nick if prefix option is enabled
$saved_nicks{$tagtarget} = '' if ($enable_prefix);
}
sub cmd_color {
my ($data, $server, $witem) = @_;
my ($op, $nick, $color) = split " ", $data;
$op = lc $op;
if (!$op) {
Irssi::print ("No operation given (save/set/clear/list/preview)");
} elsif ($op eq "save") {
save_colors;
} elsif ($op eq "set") {
if (!$nick) {
Irssi::print ("Nick not given");
} elsif (!$color) {
Irssi::print ("Color not given");
} elsif ($color < 2 || $color > 14) {
Irssi::print ("Color must be between 2 and 14 inclusive");
} else {
$saved_colors{$nick} = $color;
}
} elsif ($op eq "clear") {
if (!$nick) {
Irssi::print ("Nick not given");
} else {
delete ($saved_colors{$nick});
}
} elsif ($op eq "list") {
Irssi::print ("\nSaved Colors:");
foreach my $nick (keys %saved_colors) {
Irssi::print (chr (3) . sprintf("%02d", $saved_colors{$nick}) . "$nick" .
chr (3) . "1 ($saved_colors{$nick})");
}
} elsif ($op eq "preview") {
Irssi::print ("\nAvailable colors:");
foreach my $i (2..14) {
Irssi::print (chr (3) . "$i" . "Color #$i");
}
}
}
load_colors;
Irssi::settings_add_str('misc', 'nickcolor_colors', '2 3 4 5 6 7 9 10 11 12 13');
Irssi::settings_add_bool('misc', 'nickcolor_enable_prefix', 0);
Irssi::settings_add_bool('misc', 'nickcolor_enable_truncate', 0);
Irssi::settings_add_str('misc', 'nickcolor_prefix_text' => '- ');
Irssi::settings_add_int('misc', 'nickcolor_truncate_value' => 0);
Irssi::command_bind('color', 'cmd_color');
Irssi::signal_add('message public', 'sig_public');
Irssi::signal_add('message own_public', 'sig_me');
Irssi::signal_add('message irc action', 'sig_action_public');
Irssi::signal_add('message irc own_action', 'sig_action_me');
Irssi::signal_add('event nick', 'sig_nick');

View File

@@ -0,0 +1,606 @@
## trackbar.pl
#
# 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.
#
# redraw trackbar only works on irssi 0.8.17 or higher.
#
##
## Usage:
#
# The script works right out of the box, but if you want you can change
# the working by /set'ing the following variables:
#
# Setting: trackbar_style
# Description: This setting will be the color of your trackbar line.
# By default the value will be '%K', only Irssi color
# formats are allowed. If you don't know the color formats
# by heart, you can take a look at the formats documentation.
# You will find the proper docs on http://www.irssi.org/docs.
#
# Setting: trackbar_string
# Description: This is the string that your line will display. This can
# be multiple characters or just one. For example: '~-~-'
# The default setting is '-'.
# Here are some unicode characters you can try:
# "───" => U+2500 => a line
# "═══" => U+2550 => a double line
# "━━━" => U+2501 => a wide line
# "▭ " => U+25ad => a white rectangle
#
# Setting: trackbar_use_status_window
# Description: If this setting is set to OFF, Irssi won't print a trackbar
# in the statuswindow
#
# Setting: trackbar_ignore_windows
# Description: A list of windows where no trackbar should be printed
#
# Setting: trackbar_print_timestamp
# Description: If this setting is set to ON, Irssi will print the formatted
# timestamp in front of the trackbar.
#
# Setting: trackbar_require_seen
# Description: Only clear the trackbar if it has been scrolled to.
#
# Setting: trackbar_all_manual
# Description: Never clear the trackbar until you do /mark.
#
# /mark is a command that will redraw the line at the bottom.
#
# Command: /trackbar, /trackbar goto
# Description: Jump to where the trackbar is, to pick up reading
#
# Command: /trackbar keep
# Description: Keep this window's trackbar where it is the next time
# you switch windows (then this flag is cleared again)
#
# Command: /mark, /trackbar mark
# Description: Remove the old trackbar and mark the bottom of this
# window with a new trackbar
#
# Command: /trackbar markvisible
# Description: Like mark for all visible windows
#
# Command: /trackbar markall
# Description: Like mark for all windows
#
# Command: /trackbar remove
# Description: Remove this window's trackbar
#
# Command: /trackbar removeall
# Description: Remove all windows' trackbars
#
# Command: /trackbar redraw
# Description: Force redraw of trackbars
#
##
##
#
# For bugreports and other improvements contact one of the authors.
#
# 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 script; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
##
use strict;
use warnings;
use vars qw($VERSION %IRSSI);
$VERSION = "2.9"; # a4c78e85092a271
%IRSSI = (
authors => "Peter 'kinlo' Leurs, Uwe Dudenhoeffer, " .
"Michiel Holtkamp, Nico R. Wohlgemuth, " .
"Geert Hauwaerts",
contact => 'peter@pfoe.be',
patchers => 'Johan Kiviniemi (UTF-8), Uwe Dudenhoeffer (on-upgrade-remove-line)',
name => 'trackbar',
description => 'Shows a bar where you have last read a window.',
license => 'GNU General Public License',
url => 'http://www.pfoe.be/~peter/trackbar/',
commands => 'trackbar',
);
## Comments and remarks.
#
# This script uses settings.
# Use /SET to change the value or /TOGGLE to switch it on or off.
#
#
# Tip: The command 'trackbar' is very useful if you bind that to a key,
# so you can easily jump to the trackbar. Please see 'help bind' for
# more information about keybindings in Irssi.
#
# Command: /BIND meta2-P key F1
# /BIND F1 command trackbar
#
##
## Bugfixes and new items in this rewrite.
#
# * Remove all the trackbars before upgrading.
# * New setting trackbar_use_status_window to control the statuswindow trackbar.
# * New setting trackbar_print_timestamp to print a timestamp or not.
# * New command 'trackbar' to scroll up to the trackbar.
# * When resizing your terminal, Irssi will update all the trackbars to the new size.
# * When changing trackbar settings, change all the trackbars to the new settings.
# * New command 'trackbar mark' to draw a new trackbar (The old '/mark').
# * New command 'trackbar markall' to draw a new trackbar in each window.
# * New command 'trackbar remove' to remove the trackbar from the current window.
# * New command 'trackbar removeall' to remove all the trackbars.
# * Don't draw a trackbar in empty windows.
# * Added a version check to prevent Irssi redraw errors.
# * Fixed a bookmark NULL versus 0 bug.
# * Fixed a remove-line bug in Uwe Dudenhoeffer his patch.
# * New command 'help trackbar' to display the trackbar commands.
# * Fixed an Irssi startup bug, now processing each auto-created window.
#
##
## Known bugs and the todolist.
#
# Todo: * Instead of drawing a line, invert the line.
#
##
## 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:
#
# 2.9: - fix crash on /mark in empty window
# 2.8: - fix /^join bug
# 2.7: - add /set trackbar_all_manual option
# 2.5: - merge back on scripts.irssi.org
# - fix /trackbar redraw broken in 2.4
# - fix legacy encodings
# - add workaround for irssi issue #271
# 2.4: - add support for horizontal splits
# 2.3: - add some features for seen tracking using other scripts
# 2.0: - big rewrite based on 1.4
# * removed /tb, you can have it with /alias tb trackbar if you want
# * subcommand and settings changes:
# /trackbar vmark => /trackbar markvisible
# /trackbar scroll => /trackbar goto (or just /trackbar)
# /trackbar help => /help trackbar
# /set trackbar_hide_windows => /set trackbar_ignore_windows
# /set trackbar_timestamp => /set trackbar_print_timestamp
# * magic line strings were removed, just paste the unicode you want!
# * trackbar_timestamp_styled is not currently supported
# 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
#
##
use Irssi;
use Irssi::TextUI;
use Encode;
use POSIX qw(strftime);
sub cmd_help {
my ($args) = @_;
if ($args =~ /^trackbar *$/i) {
print CLIENTCRAP <<HELP
%9Syntax:%9
TRACKBAR
TRACKBAR GOTO
TRACKBAR KEEP
TRACKBAR MARK
TRACKBAR MARKVISIBLE
TRACKBAR MARKALL
TRACKBAR REMOVE
TRACKBAR REMOVEALL
TRACKBAR REDRAW
%9Parameters:%9
GOTO: Jump to where the trackbar is, to pick up reading
KEEP: Keep this window's trackbar where it is the next time
you switch windows (then this flag is cleared again)
MARK: Remove the old trackbar and mark the bottom of this
window with a new trackbar
MARKVISIBLE: Like mark for all visible windows
MARKALL: Like mark for all windows
REMOVE: Remove this window's trackbar
REMOVEALL: Remove all windows' trackbars
REDRAW: Force redraw of trackbars
%9Description:%9
Manage a trackbar. Without arguments, it will scroll up to the trackbar.
%9Examples:%9
/TRACKBAR MARK
/TRACKBAR REMOVE
HELP
}
}
Irssi::theme_register([
'trackbar_loaded', '%R>>%n %_Scriptinfo:%_ Loaded $0 version $1 by $2.',
'trackbar_wrong_version', '%R>>%n %_Trackbar:%_ Please upgrade your client to 0.8.17 or above if you would like to use this feature of trackbar.',
'trackbar_all_removed', '%R>>%n %_Trackbar:%_ All the trackbars have been removed.',
'trackbar_not_found', '%R>>%n %_Trackbar:%_ No trackbar found in this window.',
]);
my $old_irssi = Irssi::version < 20140701;
sub check_version {
if ($old_irssi) {
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_wrong_version');
return;
} else {
return 1;
}
}
sub is_utf8 {
lc Irssi::settings_get_str('term_charset') eq 'utf-8'
}
my (%config, %keep_trackbar, %unseen_trackbar);
sub remove_one_trackbar {
my $win = shift;
my $view = shift || $win->view;
my $line = $view->get_bookmark('trackbar');
if (defined $line) {
my $bottom = $view->{bottom};
$view->remove_line($line);
$win->command('^scrollback end') if $bottom && !$win->view->{bottom};
$view->redraw;
}
}
sub add_one_trackbar_pt1 {
my $win = shift;
my $view = shift || $win->view;
my $last_cur_line = ($view->{buffer}{cur_line}||+{})->{_irssi};
$win->print(line($win->{width}), MSGLEVEL_NEVER);
my $cur_line = ($win->view->{buffer}{cur_line}||+{})->{_irssi}; # get a fresh buffer
($last_cur_line//'') ne ($cur_line//'') # printing was successful
}
sub add_one_trackbar_pt2 {
my $win = shift;
my $view = $win->view;
$view->set_bookmark_bottom('trackbar');
$unseen_trackbar{ $win->{_irssi} } = 1;
Irssi::signal_emit("window trackbar added", $win);
$view->redraw;
}
sub update_one_trackbar {
my $win = shift;
my $view = shift || $win->view;
my $force = shift;
my $ignored = win_ignored($win, $view);
my $success;
$success = add_one_trackbar_pt1($win, $view) ? 1 : 0
if $force || !$ignored;
remove_one_trackbar($win, $view)
if ( $success || !defined $success ) && ( $force || !defined $force || !$ignored );
add_one_trackbar_pt2($win)
if $success;
}
sub win_ignored {
my $win = shift;
my $view = shift || $win->view;
return 1 unless $view->{buffer}{lines_count};
return 1 if $win->{name} eq '(status)' && !$config{use_status_window};
no warnings 'uninitialized';
return 1 if grep { $win->{name} eq $_ || $win->{refnum} eq $_
|| $win->get_active_name eq $_ } @{ $config{ignore_windows} };
return 0;
}
sub sig_window_changed {
my ($newwindow, $oldwindow) = @_;
return unless $oldwindow;
redraw_one_trackbar($newwindow) unless $old_irssi;
trackbar_update_seen($newwindow);
return if delete $keep_trackbar{ $oldwindow->{_irssi} };
trackbar_update_seen($oldwindow);
return if $config{require_seen} && $unseen_trackbar{ $oldwindow->{_irssi } };
return if $config{all_manual};
update_one_trackbar($oldwindow, undef, 0);
}
sub trackbar_update_seen {
my $win = shift;
return unless $win;
return unless $unseen_trackbar{ $win->{_irssi} };
my $view = $win->view;
my $line = $view->get_bookmark('trackbar');
unless ($line) {
delete $unseen_trackbar{ $win->{_irssi} };
Irssi::signal_emit("window trackbar seen", $win);
return;
}
my $startline = $view->{startline};
return unless $startline;
if ($startline->{info}{time} < $line->{info}{time}
|| $startline->{_irssi} == $line->{_irssi}) {
delete $unseen_trackbar{ $win->{_irssi} };
Irssi::signal_emit("window trackbar seen", $win);
}
}
sub screen_length;
{ local $@;
eval { require Text::CharWidth; };
unless ($@) {
*screen_length = sub { Text::CharWidth::mbswidth($_[0]) };
}
else {
*screen_length = sub {
my $temp = shift;
Encode::_utf8_on($temp) if is_utf8();
length($temp)
};
}
}
{ my %strip_table = (
(map { $_ => '' } (split //, '04261537' . 'kbgcrmyw' . 'KBGCRMYW' . 'U9_8I:|FnN>#[' . 'pP')),
(map { $_ => $_ } (split //, '{}%')),
);
sub c_length {
my $o = Irssi::strip_codes($_[0]);
$o =~ s/(%(%|Z.{6}|z.{6}|X..|x..|.))/exists $strip_table{$2} ? $strip_table{$2} :
$2 =~ m{x(?:0[a-f]|[1-6][0-9a-z]|7[a-x])|z[0-9a-f]{6}}i ? '' : $1/gex;
screen_length($o)
}
}
sub line {
my ($width, $time) = @_;
my $string = $config{string};
$string = ' ' unless length $string;
$time ||= time;
Encode::_utf8_on($string) if is_utf8();
my $length = c_length($string);
my $format = '';
if ($config{print_timestamp}) {
$format = $config{timestamp_str};
$format =~ y/%/\01/;
$format =~ s/\01\01/%/g;
$format = strftime($format, localtime $time);
$format =~ y/\01/%/;
}
my $times = $width / $length;
$times += 1 if $times != int $times;
my $style = "$config{style}";
Encode::_utf8_on($style) if is_utf8();
$format .= $style;
$width -= c_length($format);
$string x= $times;
chop $string while length $string && c_length($string) > $width;
return $format . $string;
}
sub remove_all_trackbars {
for my $window (Irssi::windows) {
next unless ref $window;
remove_one_trackbar($window);
}
}
sub UNLOAD {
remove_all_trackbars();
}
sub redraw_one_trackbar {
my $win = shift;
my $view = $win->view;
my $line = $view->get_bookmark('trackbar');
return unless $line;
my $bottom = $view->{bottom};
$win->print_after($line, MSGLEVEL_NEVER, line($win->{width}, $line->{info}{time}),
$line->{info}{time});
$view->set_bookmark('trackbar', $win->last_line_insert);
$view->remove_line($line);
$win->command('^scrollback end') if $bottom && !$win->view->{bottom};
$view->redraw;
}
sub redraw_trackbars {
return unless check_version();
for my $win (Irssi::windows) {
next unless ref $win;
redraw_one_trackbar($win);
}
}
sub goto_trackbar {
my $win = Irssi::active_win;
my $line = $win->view->get_bookmark('trackbar');
if ($line) {
$win->command("scrollback goto ". strftime("%d %H:%M:%S", localtime($line->{info}{time})));
} else {
$win->printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_not_found');
}
}
sub cmd_mark {
update_one_trackbar(Irssi::active_win, undef, 1);
}
sub cmd_markall {
for my $window (Irssi::windows) {
next unless ref $window;
update_one_trackbar($window);
}
}
sub signal_stop {
Irssi::signal_stop;
}
sub cmd_markvisible {
my @wins = Irssi::windows;
my $awin =
my $bwin = Irssi::active_win;
my $awin_counter = 0;
Irssi::signal_add_priority('window changed' => 'signal_stop', -99);
do {
Irssi::active_win->command('window up');
$awin = Irssi::active_win;
update_one_trackbar($awin);
++$awin_counter;
} until ($awin->{refnum} == $bwin->{refnum} || $awin_counter >= @wins);
Irssi::signal_remove('window changed' => 'signal_stop');
}
sub cmd_trackbar_remove_one {
remove_one_trackbar(Irssi::active_win);
}
sub cmd_remove_all_trackbars {
remove_all_trackbars();
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_all_removed');
}
sub cmd_keep_once {
$keep_trackbar{ Irssi::active_win->{_irssi} } = 1;
}
sub trackbar_runsub {
my ($data, $server, $item) = @_;
$data =~ s/\s+$//g;
if ($data) {
Irssi::command_runsub('trackbar', $data, $server, $item);
} else {
goto_trackbar();
}
}
sub update_config {
my $was_status_window = $config{use_status_window};
$config{style} = Irssi::settings_get_str('trackbar_style');
$config{string} = Irssi::settings_get_str('trackbar_string');
$config{require_seen} = Irssi::settings_get_bool('trackbar_require_seen');
$config{all_manual} = Irssi::settings_get_bool('trackbar_all_manual');
$config{ignore_windows} = [ split /[,\s]+/, Irssi::settings_get_str('trackbar_ignore_windows') ];
$config{use_status_window} = Irssi::settings_get_bool('trackbar_use_status_window');
$config{print_timestamp} = Irssi::settings_get_bool('trackbar_print_timestamp');
if (defined $was_status_window && $was_status_window != $config{use_status_window}) {
if (my $swin = Irssi::window_find_name('(status)')) {
if ($config{use_status_window}) {
update_one_trackbar($swin);
}
else {
remove_one_trackbar($swin);
}
}
}
if ($config{print_timestamp}) {
my $ts_format = Irssi::settings_get_str('timestamp_format');
my $ts_theme = Irssi::current_theme->get_format('fe-common/core', 'timestamp');
my $render_str = Irssi::current_theme->format_expand($ts_theme);
(my $ts_escaped = $ts_format) =~ s/([%\$])/$1$1/g;
$render_str =~ s/(?|\$(.)(?!\w)|\$\{(\w+)\})/$1 eq 'Z' ? $ts_escaped : $1/ge;
$config{timestamp_str} = $render_str;
}
redraw_trackbars() unless $old_irssi;
}
Irssi::settings_add_str('trackbar', 'trackbar_string', is_utf8() ? "\x{2500}" : '-');
Irssi::settings_add_str('trackbar', 'trackbar_style', '%K');
Irssi::settings_add_str('trackbar', 'trackbar_ignore_windows', '');
Irssi::settings_add_bool('trackbar', 'trackbar_use_status_window', 1);
Irssi::settings_add_bool('trackbar', 'trackbar_print_timestamp', 0);
Irssi::settings_add_bool('trackbar', 'trackbar_require_seen', 0);
Irssi::settings_add_bool('trackbar', 'trackbar_all_manual', 0);
update_config();
Irssi::signal_add_last( 'mainwindow resized' => 'redraw_trackbars')
unless $old_irssi;
Irssi::signal_register({'window trackbar added' => [qw/Irssi::UI::Window/]});
Irssi::signal_register({'window trackbar seen' => [qw/Irssi::UI::Window/]});
Irssi::signal_register({'gui page scrolled' => [qw/Irssi::UI::Window/]});
Irssi::signal_add_last('gui page scrolled' => 'trackbar_update_seen');
Irssi::signal_add('setup changed' => 'update_config');
Irssi::signal_add_priority('session save' => 'remove_all_trackbars', Irssi::SIGNAL_PRIORITY_HIGH-1);
Irssi::signal_add('window changed' => 'sig_window_changed');
Irssi::command_bind('trackbar goto' => 'goto_trackbar');
Irssi::command_bind('trackbar keep' => 'cmd_keep_once');
Irssi::command_bind('trackbar mark' => 'cmd_mark');
Irssi::command_bind('trackbar markvisible' => 'cmd_markvisible');
Irssi::command_bind('trackbar markall' => 'cmd_markall');
Irssi::command_bind('trackbar remove' => 'cmd_trackbar_remove_one');
Irssi::command_bind('trackbar removeall' => 'cmd_remove_all_trackbars');
Irssi::command_bind('trackbar redraw' => 'redraw_trackbars');
Irssi::command_bind('trackbar' => 'trackbar_runsub');
Irssi::command_bind('mark' => 'cmd_mark');
Irssi::command_bind_last('help' => 'cmd_help');
Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'trackbar_loaded', $IRSSI{name}, $VERSION, $IRSSI{authors});
# workaround for issue #271
{ package Irssi::Nick }

View File

@@ -0,0 +1,171 @@
use Irssi 20020101.0250 ();
$VERSION = "1.16";
%IRSSI = (
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
contact => 'dgl@dgl.cx, tss@iki.fi, georg@boerde.de',
name => 'usercount',
description => 'Adds a usercount for a channel as a statusbar item',
license => 'GNU GPLv2 or later',
url => 'http://irssi.dgl.yi.org/',
);
# Once you have loaded this script run the following command:
# /statusbar window add usercount
# You can also add -alignment left|right option
# /set usercount_show_zero on or off to show users when 0 users of that type
# /set usercount_show_ircops (default off)
# /set usercount_show_halfops (default on)
# you can customize the look of this item from theme file:
# sb_usercount = "{sb %_$0%_ nicks ($1-)}";
# sb_uc_ircops = "%_*%_$*";
# sb_uc_ops = "%_@%_$*";
# sb_uc_halfops = "%_%%%_$*";
# sb_uc_voices = "%_+%_$*";
# sb_uc_normal = "$*";
# sb_uc_space = " ";
use strict;
use Irssi::TextUI;
my ($ircops, $ops, $halfops, $voices, $normal, $total);
my ($timeout_tag, $recalc);
# Called to make the status bar item
sub usercount {
my ($item, $get_size_only) = @_;
my $wi = !Irssi::active_win() ? undef : Irssi::active_win()->{active};
if(!ref $wi || $wi->{type} ne "CHANNEL") { # only works on channels
return unless ref $item;
$item->{min_size} = $item->{max_size} = 0;
return;
}
if ($recalc) {
$recalc = 0;
calc_users($wi);
}
my $theme = Irssi::current_theme();
my $format = $theme->format_expand("{sb_usercount}");
if ($format) {
# use theme-specific look
my $ircopstr = $theme->format_expand("{sb_uc_ircops $ircops}",
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
my $opstr = $theme->format_expand("{sb_uc_ops $ops}",
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
my $halfopstr = $theme->format_expand("{sb_uc_halfops $halfops}",
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
my $voicestr = $theme->format_expand("{sb_uc_voices $voices}",
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
my $normalstr = $theme->format_expand("{sb_uc_normal $normal}",
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
my $space = $theme->format_expand('{sb_uc_space}',
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
$space = " " unless $space;
my $str = "";
$str .= $ircopstr.$space if defined $ircops;
$str .= $opstr.$space if defined $ops;
$str .= $halfopstr.$space if defined $halfops;
$str .= $voicestr.$space if defined $voices;
$str .= $normalstr.$space if defined $normal;
$str =~ s/\Q$space\E$//;
$format = $theme->format_expand("{sb_usercount $total $str}",
Irssi::EXPAND_FLAG_IGNORE_REPLACES);
} else {
# use the default look
$format = "{sb \%_$total\%_ nicks \%c(\%n";
$format .= '*'.$ircops.' ' if (defined $ircops);
$format .= '@'.$ops.' ' if (defined $ops);
$format .= '%%'.$halfops.' ' if (defined $halfops);
$format .= "+$voices " if (defined $voices);
$format .= "$normal " if (defined $normal);
$format =~ s/ $//;
$format .= "\%c)}";
}
$item->default_handler($get_size_only, $format, undef, 1);
}
sub calc_users() {
my $channel = shift;
my $server = $channel->{server};
$ircops = $ops = $halfops = $voices = $normal = 0;
for ($channel->nicks()) {
if ($_->{serverop}) {
$ircops++;
}
if ($_->{op}) {
$ops++;
} elsif ($_->{halfop}) {
$halfops++;
} elsif ($_->{voice}) {
$voices++;
} else {
$normal++;
}
}
$total = $ops+$halfops+$voices+$normal;
if (!Irssi::settings_get_bool('usercount_show_zero')) {
$ircops = undef if ($ircops == 0);
$ops = undef if ($ops == 0);
$halfops = undef if ($halfops == 0);
$voices = undef if ($voices == 0);
$normal = undef if ($normal == 0);
}
$halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
$ircops = undef unless Irssi::settings_get_bool('usercount_show_ircops');
}
sub refresh {
if ($timeout_tag > 0) {
Irssi::timeout_remove($timeout_tag);
$timeout_tag = 0;
}
Irssi::statusbar_items_redraw('usercount');
}
sub refresh_check {
my $channel = shift;
my $wi = ref Irssi::active_win() ? Irssi::active_win()->{active} : 0;
return unless ref $wi && ref $channel;
return if $wi->{name} ne $channel->{name};
return if $wi->{server}->{tag} ne $channel->{server}->{tag};
# don't refresh immediately, or we'll end up refreshing
# a lot around netsplits
$recalc = 1;
Irssi::timeout_remove($timeout_tag) if ($timeout_tag > 0);
$timeout_tag = Irssi::timeout_add(500, 'refresh', undef);
}
sub refresh_recalc {
$recalc = 1;
refresh();
}
$recalc = 1;
$timeout_tag = 0;
Irssi::settings_add_bool('usercount', 'usercount_show_zero', 1);
Irssi::settings_add_bool('usercount', 'usercount_show_ircops', 0);
Irssi::settings_add_bool('usercount', 'usercount_show_halfops', 1);
Irssi::statusbar_item_register('usercount', undef, 'usercount');
Irssi::statusbars_recreate_items();
Irssi::signal_add_last('nicklist new', 'refresh_check');
Irssi::signal_add_last('nicklist remove', 'refresh_check');
Irssi::signal_add_last('nick mode changed', 'refresh_check');
Irssi::signal_add_last('setup changed', 'refresh_recalc');
Irssi::signal_add_last('window changed', 'refresh_recalc');
Irssi::signal_add_last('window item changed', 'refresh_recalc');