Compare commits
23 commits
4e6001f961
...
main
Author | SHA1 | Date | |
---|---|---|---|
9f3ecd73f7 | |||
cba8138ce6 | |||
8a61f16543 | |||
2fef6bb84c | |||
a51ca5d54a | |||
34cbad807e | |||
5ee774aa2e | |||
6f156428d1 | |||
566ce3e606 | |||
2b6e96440f | |||
5d701682fa | |||
57caaf7544 | |||
deb3127d58 | |||
82331e2c04 | |||
e435a8d5ec | |||
709372319a | |||
e92ae47067 | |||
21b1495621 | |||
8d2967296a | |||
df3809461c | |||
fba4114e44 | |||
fa985037a7 | |||
88e606094f |
29 changed files with 2851 additions and 34 deletions
|
@ -11,13 +11,13 @@
|
|||
|
||||
|
||||
# tilde.tel contacts
|
||||
"echo test" <sip:1101>
|
||||
"futel" <sip:1938>
|
||||
"conference" <sip:1105>
|
||||
"echo test" <sip:1101@neotilde.tel>
|
||||
"futel" <sip:1938@neotilde.tel>
|
||||
"conference" <sip:1105@neotilde.tel>
|
||||
|
||||
"brendo" <sip:2013105>
|
||||
"darcy" <sip:2163101>
|
||||
"rawktucc" <sip:2013123>
|
||||
"brendo" <sip:2013105@neotilde.tel>
|
||||
"iris" <sip:2163101@neotilde.tel>
|
||||
"rawktucc" <sip:2013123@neotilde.tel>
|
||||
|
||||
|
||||
# Access rules
|
||||
|
|
4
.bashrc
4
.bashrc
|
@ -58,8 +58,8 @@ fi
|
|||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
#export PS1='$(tput setaf 34)[ $(tput bold; tput setaf 28)ltc$(tput setaf 40)@$(tput setaf 28)arch$(tput sgr0; tput setaf 34) ] $(tput setaf 46)[ $(tput bold; tput setaf 40)\w$(tput sgr0; tput setaf 46) ]$(DIRY="\w"; printf "%$(($COLUMNS - 9 - 3 - 5 - ${#DIRY} - 12))s")$(tput bold; tput setaf 34)[ \t ]\n$ $(tput sgr0)'
|
||||
PS1="\[\$([ \$? -eq 0 ] && tput setaf 14 || tput setaf 9)$(tput setab 14)\]\[$(tput bold; tput setaf 0; tput setab 14)\]\u \[\e[m$(tput setaf 14; tput setab 4)\]\[$(tput setaf 0; tput setab 4)\] \w \[\e[m$(tput setaf 4)\]\[\e[m\] "
|
||||
|
||||
#PS1="\[\$([ \$? -eq 0 ] && tput setaf 14 || tput setaf 9)$(tput setab 14)\]\[$(tput bold; tput setaf 0; tput setab 14)\]\u \[\e[m$(tput setaf 14; tput setab 4)\]\[$(tput setaf 0; tput setab 4)\] \w \[\e[m$(tput setaf 4)\]\[\e[m\] "
|
||||
export PS1="\[\e[1;34m\]┌──\[\$([ \$? -eq 0 ] && tput setaf 2 || tput setaf 9)\] UwU \n\[\e[1;34m\]└╼ \[\e[0;31m\]\w \[\e[1;34m\]\$ \[\e[m\]"
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}[ \u@\h \w\]$ '
|
||||
fi
|
||||
|
|
|
@ -104,11 +104,11 @@ bindsym $mod+space focus mode_toggle
|
|||
#bindsym $mod+a focus parent
|
||||
|
||||
# take a screenshot
|
||||
bindsym --release $mod+s exec "scrot -s -e 'curl -F\\"file=@$f\\" https://foxes.are.allowed.org/ | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
bindsym $mod+shift+s exec "scrot -e 'curl -F\\"file=@$f\\" https://foxes.are.allowed.org/ | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
bindsym --release $mod+z exec "scrot -s -e 'curl -F\\"file=@$f\\" https://foxes.are.allowed.org/ | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
bindsym --release $mod+s exec "scrot -l mode=edge -s -e 'curl -F\\"file=@$f\\" https://foxes.are.allowed.org/ | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
bindsym $mod+shift+s exec "scrot -l mode=edge -e 'curl -F\\"file=@$f\\" https://foxes.are.allowed.org/ | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
bindsym --release $mod+z exec "scrot -l mode=edge -s -e 'curl -F\\"file=@$f\\" https://foxes.are.allowed.org/ | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
|
||||
#bindsym --release $mod+x exec "scrot -s -e 'curl -F\\"file=@$f\\" https://xfnw.ttm.sh/u.php | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
#bindsym --release $mod+x exec "scrot -l mode=edge -s -e 'curl -F\\"file=@$f\\" https://xfnw.ttm.sh/u.php | xclip -selection clipboard; mv $f ~/Pictures/scrot/'"
|
||||
|
||||
# show titles
|
||||
bindsym $mod+t border normal 1
|
||||
|
@ -184,7 +184,8 @@ for_window [class="guvcview"] floating enable
|
|||
for_window [class="gajim"] floating enable
|
||||
for_window [class="FLTK"] floating enable
|
||||
for_window [class="mpv"] fullscreen enable
|
||||
for_window [title="Gnuplot window 0"] floating enable]
|
||||
for_window [title="Gnuplot window 0"] floating enable
|
||||
for_window [title="OpenSeeFace GD"] floating enable, sticky enable
|
||||
|
||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||
# finds out, if available)
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
🙀 weary cat face; U+1F640
|
||||
😿 crying cat face; U+1F63F
|
||||
😾 pouting cat face; U+1F63E
|
||||
🥺👉👈 pleading face right left;
|
||||
☭ communism;
|
||||
🙈 see-no-evil monkey; U+1F648
|
||||
🙉 hear-no-evil monkey; U+1F649
|
||||
|
@ -1387,6 +1388,7 @@
|
|||
🏴 black flag; U+1F3F4
|
||||
🏳 white flag; U+1F3F3
|
||||
🏳️🌈 rainbow flag; U+1F3F3 U+FE0F U+200D U+1F308
|
||||
🏳️⚧️ trans flag;
|
||||
🏴☠️ pirate flag; U+1F3F4 U+200D U+2620 U+FE0F
|
||||
🇦🇨 flag: Ascension Island; U+1F1E6 U+1F1E8
|
||||
🇦🇩 flag: Andorra; U+1F1E6 U+1F1E9
|
||||
|
|
|
@ -5,7 +5,7 @@ rm /tmp/lock.png
|
|||
scrot /tmp/lock.png
|
||||
|
||||
# imagemagik is fun
|
||||
convert /tmp/lock.png -paint 1 -blur 8x5 -matte /tmp/lock.png
|
||||
convert /tmp/lock.png -paint 1 -blur 8x5 ~/.config/i3/lockfox.png -gravity center -composite -matte /tmp/lock.png
|
||||
|
||||
# hmm i3lock
|
||||
i3lock -e -f -c 000000 -i /tmp/lock.png
|
||||
|
|
BIN
.config/i3/lockfox.png
Normal file
BIN
.config/i3/lockfox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 105 KiB |
|
@ -3,6 +3,7 @@
|
|||
PISSNET IS FOSS! PISSNET IS IRC! PISSNET IS THE FUTURE! PISSNET IS TRUTH! PISSNET IS INCLUSION! PISSNET IS FORKS! PISSNET IS FREEDOM! PISSNET IS FOR YOU! ASK NOT WHAT YOU CAN DO FOR PISSNET, BUT WHAT PISSNET CAN DO FOR YOU! PISSNET IS THE WAY!
|
||||
I didn’t fuck my cat. I didn’t cum on my cat. I didn’t put my dick anywhere near my cat. I’ve never done anything weird with my cats. I promised myself I wasn’t going to make apology videos after last years thing so I’m just trying to be as short and honest with this as possible.
|
||||
I have put you on a permanent ignore, public and private. I have found you disturbing, rude and generally not worth talking to. According to the channels you hang on, it strengtens the effect of wanting to put you on ignore because of my lack of interest in you as a person. This message is not meant to be rude to you, just to inform you that i won't see anything of what you type from now on.
|
||||
"Ok, I have a better plan. - you learn to fly by flapping your arms fast enough - you then learn to pee burning gasoline - then, you fly around New York, setting everybody you see on fire, until people make you emperor." --Linus Torvalds
|
||||
/me is broadcasting on Tilderadio! Tune in now at https://tilderadio.org/ !
|
||||
We are one. We are many. We are all. We are none. We are the singularity.
|
||||
We are the collective, we are seven
|
||||
|
|
|
@ -82,7 +82,7 @@ font_size 12.0
|
|||
#: with the background color of the cell underneath instead, use the
|
||||
#: special keyword: background
|
||||
|
||||
# cursor_shape block
|
||||
cursor_shape block
|
||||
|
||||
#: The cursor shape can be one of (block, beam, underline)
|
||||
|
||||
|
@ -466,7 +466,7 @@ visual_bell_duration 0.1
|
|||
|
||||
#: The foreground and background colors
|
||||
|
||||
background_opacity 0.8
|
||||
#background_opacity 0.8
|
||||
|
||||
#: The opacity of the background. A number between 0 and 1, where 1 is
|
||||
#: opaque and 0 is fully transparent. This will only work if
|
||||
|
@ -594,7 +594,7 @@ color15 #CCBC8E
|
|||
|
||||
# env
|
||||
|
||||
env PS1="\[$(tput bold)\]\[$(tput setaf 34)\][\[$(tput setaf 28)\]\u\[$(tput setaf 40)\]@\[$(tput setaf 28)\]\h \[$(tput setaf 40)\]\W\[$(tput setaf 34)\]]\[$(tput setaf 28)\]\\$ \[$(tput sgr0)\]"
|
||||
#env PS1="\[$(tput bold)\]\[$(tput setaf 34)\][\[$(tput setaf 28)\]\u\[$(tput setaf 40)\]@\[$(tput setaf 28)\]\h \[$(tput setaf 40)\]\W\[$(tput setaf 34)\]]\[$(tput setaf 28)\]\\$ \[$(tput sgr0)\]"
|
||||
|
||||
|
||||
#: Specify environment variables to set in all child processes. Note
|
||||
|
@ -635,6 +635,14 @@ env PS1="\[$(tput bold)\]\[$(tput setaf 34)\][\[$(tput setaf 28)\]\u\[$(tput set
|
|||
#: functionality is a security risk as it means that any program, even
|
||||
#: one running on a remote server via SSH can read your clipboard.
|
||||
|
||||
shell_integration no-cursor
|
||||
|
||||
#: Enable shell integration on supported shells. This enables features
|
||||
#: such as jumping to previous prompts, browsing the output of the
|
||||
#: previous command in a pager, etc. on supported shells. Set to
|
||||
#: ``disabled`` to turn off shell integration, completely. See
|
||||
#: https://sw.kovidgoyal.net/kitty/shell-integration/ for details.
|
||||
|
||||
term xterm-256color
|
||||
|
||||
#: The value of the TERM environment variable to set. Changing this
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
feed-sort-order unreadarticlecount
|
||||
confirm-mark-feed-read no
|
||||
browser "firefox %u"
|
||||
auto-reload yes
|
||||
reload-time 10
|
||||
reload-threads 10
|
||||
notify-beep yes
|
||||
include /usr/share/doc/newsboat/contrib/colorschemes/inkpot
|
||||
|
||||
|
|
19
.gitconfig
Normal file
19
.gitconfig
Normal file
|
@ -0,0 +1,19 @@
|
|||
# This is Git's per-user configuration file.
|
||||
[user]
|
||||
# Please adapt and uncomment the following lines:
|
||||
name = xfnw
|
||||
email = xfnw@riseup.net
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[sendemail]
|
||||
smtpencryption = tls
|
||||
smtpserver = mail.riseup.net
|
||||
smtpuser = xfnw@riseup.net
|
||||
smtpserverport = 587
|
||||
[alias]
|
||||
quickserve = daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
|
||||
[commit]
|
||||
verbose = true
|
||||
[pull]
|
||||
rebase = true
|
|
@ -157,6 +157,9 @@ aliases = {
|
|||
rainbow = "exec -o toilet --irc --gay -f term -- $";
|
||||
nn = "window number";
|
||||
move = "window move";
|
||||
kline = "quote kline";
|
||||
gline = "quote gline";
|
||||
challenge = "quote challenge";
|
||||
};
|
||||
|
||||
settings = {
|
||||
|
@ -171,6 +174,7 @@ settings = {
|
|||
theme = "furry";
|
||||
active_window_ignore_refnum = "no";
|
||||
autoclose_query = "172800";
|
||||
beep_msg_level = "MSGS HILIGHT DCCMSGS";
|
||||
};
|
||||
"irc/core" = { cmds_max_at_once = "100"; };
|
||||
};
|
||||
|
@ -193,7 +197,6 @@ statusbar = {
|
|||
input = { priority = "100"; };
|
||||
lag = { };
|
||||
more = { };
|
||||
act = { };
|
||||
};
|
||||
};
|
||||
topic = {
|
||||
|
@ -204,6 +207,7 @@ statusbar = {
|
|||
topic = { };
|
||||
topic_empty = { };
|
||||
topicbarend = { priority = "100"; alignment = "right"; };
|
||||
act = { priority = "10"; alignment = "right"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -213,16 +217,14 @@ hilights = (
|
|||
text = "xfnw";
|
||||
color = "%G";
|
||||
act_color = "%Y";
|
||||
nick = "no";
|
||||
word = "no";
|
||||
regexp = "yes";
|
||||
word = "yes";
|
||||
full = "yes";
|
||||
},
|
||||
{
|
||||
text = "vulpine";
|
||||
color = "%G";
|
||||
act_color = "%Y";
|
||||
nick = "no";
|
||||
word = "no";
|
||||
regexp = "yes";
|
||||
word = "yes";
|
||||
full = "yes";
|
||||
}
|
||||
);
|
||||
|
|
39
.irssi/scripts/autorun/autostuff.pl
Normal file
39
.irssi/scripts/autorun/autostuff.pl
Normal file
|
@ -0,0 +1,39 @@
|
|||
use strict;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = '0.02';
|
||||
%IRSSI = (
|
||||
authors => 'Juerd',
|
||||
contact => '#####@juerd.nl',
|
||||
name => 'autostuff',
|
||||
description => 'Save current servers, channels and windows for autoconnect and autojoin',
|
||||
license => 'Public Domain',
|
||||
url => 'http://juerd.nl/site.plp/irssi',
|
||||
changed => '2010-03-24 14:35',
|
||||
);
|
||||
|
||||
use Irssi qw(command_bind servers channels windows command);
|
||||
|
||||
command_bind autostuff => sub {
|
||||
my ($data, $server, $window) = @_;
|
||||
for (servers) {
|
||||
my $chatnet = $_->{chatnet} || $_->{tag};
|
||||
command "/network add $chatnet";
|
||||
command "/server add -auto -network $chatnet $_->{address} $_->{port} $_->{password}";
|
||||
}
|
||||
for (channels) {
|
||||
my $chatnet = $_->{server}->{chatnet} || $_->{server}->{tag};
|
||||
command "/channel add -auto $_->{name} $chatnet $_->{key}";
|
||||
}
|
||||
command "/layout save";
|
||||
command "/save";
|
||||
};
|
||||
|
||||
command_bind "window clean" => sub {
|
||||
for (sort { $b->{refnum} <=> $a->{refnum} } windows) {
|
||||
next if $_->{active};
|
||||
next if $_->{immortal};
|
||||
next if $_->{name};
|
||||
command "/window close $_->{refnum}";
|
||||
}
|
||||
};
|
54
.irssi/scripts/autorun/chghost.pl
Normal file
54
.irssi/scripts/autorun/chghost.pl
Normal file
|
@ -0,0 +1,54 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Irssi;
|
||||
|
||||
our $VERSION = '0.0.1';
|
||||
our %IRSSI = (
|
||||
authors => 'launchd',
|
||||
contact => 'me@zpld.me',
|
||||
name => 'chghost',
|
||||
description => 'implement support for https://ircv3.net/specs/extensions/chghost.html',
|
||||
license => 'MIT',
|
||||
changed => '5/20/2021'
|
||||
);
|
||||
|
||||
Irssi::theme_register([
|
||||
chghost => '{channick_hilight $0} {nickhost $1} has changed hostname to {hilight $2}',
|
||||
]);
|
||||
|
||||
Irssi::signal_add('event chghost', sub {
|
||||
my ($server, $data, $nick, $oldhost) = @_;
|
||||
|
||||
my @parts = split m/ /, $data;
|
||||
my $newhost = "$parts[0]\@$parts[1]";
|
||||
|
||||
# Print the notification to all shared channels, and the nick's query if any
|
||||
for my $c ($server->channels) {
|
||||
$c->printformat(MSGLEVEL_NICKS, 'chghost', $nick, $oldhost, $newhost) if $c->nick_find($nick);
|
||||
}
|
||||
my $q = $server->query_find($nick);
|
||||
$q->printformat(MSGLEVEL_NICKS, 'chghost', $nick, $oldhost, $newhost) if defined $q;
|
||||
Irssi::signal_stop();
|
||||
});
|
||||
|
||||
|
||||
Irssi::signal_add('event connected', sub {
|
||||
my ($server) = @_;
|
||||
|
||||
if ($server->{chat_type} eq 'IRC')
|
||||
{
|
||||
$server->irc_server_cap_toggle('chghost', 1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!Irssi::Irc::Server->can('irc_server_cap_toggle')) {
|
||||
die 'this version of irssi is not supported';
|
||||
}
|
||||
|
||||
for my $server (Irssi::servers()) {
|
||||
if ($server->{chat_type} eq 'IRC')
|
||||
{
|
||||
$server->irc_server_cap_toggle('chghost', 1);
|
||||
}
|
||||
}
|
85
.irssi/scripts/autorun/hilightwin.pl
Normal file
85
.irssi/scripts/autorun/hilightwin.pl
Normal file
|
@ -0,0 +1,85 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
# Changed a little by rummik to optionally show network name. Enable with
|
||||
# `/set hilightwin_show_network on`
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Irssi;
|
||||
use POSIX;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = "1.00";
|
||||
%IRSSI = (
|
||||
authors => "Timo \'cras\' Sirainen, Mark \'znx\' Sangster, Kimberly \'rummik\' Zick",
|
||||
contact => "tss\@iki.fi, znxster\@gmail.com, git\@zick.kim",
|
||||
name => "hilightwin",
|
||||
description => "Print hilighted messages to window named \"hilight\"",
|
||||
license => "Public Domain",
|
||||
url => "http://irssi.org/",
|
||||
changed => "Thu Apr 6 15:30:25 EDT 2017"
|
||||
);
|
||||
|
||||
sub is_ignored {
|
||||
my ($dest) = @_;
|
||||
|
||||
my @ignore = split(' ', Irssi::settings_get_str('hilightwin_ignore_targets'));
|
||||
return 0 if (!@ignore);
|
||||
|
||||
my %targets = map { $_ => 1 } @ignore;
|
||||
|
||||
return 1 if exists($targets{"*"});
|
||||
return 1 if exists($targets{$dest->{target}});
|
||||
|
||||
if ($dest->{server}) {
|
||||
my $tag = $dest->{server}->{tag};
|
||||
return 1 if exists($targets{$tag . "/*"});
|
||||
return 1 if exists($targets{$tag . "/" . $dest->{target}});
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub sig_printtext {
|
||||
my ($dest, $text, $stripped) = @_;
|
||||
|
||||
my $opt = MSGLEVEL_HILIGHT;
|
||||
my $shownetwork = Irssi::settings_get_bool('hilightwin_show_network');
|
||||
|
||||
if(Irssi::settings_get_bool('hilightwin_showprivmsg')) {
|
||||
$opt = MSGLEVEL_HILIGHT|MSGLEVEL_MSGS;
|
||||
}
|
||||
|
||||
if(
|
||||
($dest->{level} & ($opt)) &&
|
||||
($dest->{level} & MSGLEVEL_NOHILIGHT) == 0 &&
|
||||
(!is_ignored($dest))
|
||||
) {
|
||||
my $window = Irssi::window_find_name('hilight');
|
||||
|
||||
if ($dest->{level} & MSGLEVEL_PUBLIC) {
|
||||
$text = $dest->{target}.": ".$text;
|
||||
$text = $dest->{server}->{tag} . "/" . $text if ($shownetwork);
|
||||
} elsif ($shownetwork) {
|
||||
$text = $dest->{server}->{tag} . ": " . $text;
|
||||
}
|
||||
$text =~ s/%/%%/g;
|
||||
$window->print($text, MSGLEVEL_CLIENTCRAP) 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::settings_add_str('hilightwin', 'hilightwin_ignore_targets', '');
|
||||
Irssi::settings_add_bool('hilightwin','hilightwin_show_network', 0);
|
||||
|
||||
Irssi::signal_add('print text', 'sig_printtext');
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
671
.irssi/scripts/autorun/isbanned.pl
Normal file
671
.irssi/scripts/autorun/isbanned.pl
Normal file
|
@ -0,0 +1,671 @@
|
|||
use Irssi;
|
||||
use strict;
|
||||
use warnings;
|
||||
use bignum;
|
||||
use Socket;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
%IRSSI =
|
||||
(
|
||||
name => "isbanned",
|
||||
description => "freenode-specific script that checks whether someone is banned on some channel",
|
||||
commands => "isbanned ismuted islisted isreset",
|
||||
authors => "mniip",
|
||||
contact => "mniip \@ freenode",
|
||||
license => "Public domain",
|
||||
modified => "2015-09-14"
|
||||
);
|
||||
$VERSION = "0.7.0";
|
||||
|
||||
# Commands:
|
||||
# /isbanned <channel> <user>
|
||||
# Check whether <user> is banned on <channel>
|
||||
# /ismuted <channel> <user>
|
||||
# Check whether <user> is muted on <channel>
|
||||
# /islisted <channel> <mode> <user>
|
||||
# Check whether <user> is listed in <channel>'s
|
||||
# <mode> list (can be b, q, e, or I)
|
||||
# /isreset
|
||||
# If something screws up, this resets the state to inactive
|
||||
#
|
||||
# <user> can either be a nickname, or a hostmask in the form
|
||||
# nick!ident@host#gecos$account
|
||||
# where some parts can be omitted. Strictly speaking the form is
|
||||
# [nick] ['!' ident] ['@' host] ['#' gecos] ['$' account]
|
||||
# If any part is omitted, it is assumed to be empty string, except for
|
||||
# account: if the account part is omitted the user is assumed to be
|
||||
# unidentified (as opposed to identified as empty string)
|
||||
#
|
||||
# Supports all kinds of features, misfeatures, and quirks freenode uses.
|
||||
# Supports $a, $j, $r, $x, and $z extbans, and any edge cases of those.
|
||||
# Supports CIDR bans, both IPv4 and IPv6, and the misfeature by which
|
||||
# an invalid IP address is not parsed and zeroes are matched instead.
|
||||
# Supports the +ikmrS modes. Supports the RFC2812 casemapping in patterns,
|
||||
# which are, by the way, parsed without backtracking and thus effeciently.
|
||||
#
|
||||
# Changelog:
|
||||
# 0.6.0 (2015.01.12)
|
||||
# Ported from the hexchat script version 0.6
|
||||
#
|
||||
# 0.6.1 (2015.01.13)
|
||||
# Fixed a few porting issues: the original host is now included
|
||||
# in the hosts list too. Fixed IPv6 parsing. Fixed $x and $~x.
|
||||
#
|
||||
# 0.6.2 (2015.01.13)
|
||||
# Fixed a few warnings.
|
||||
#
|
||||
# 0.6.3 (2015.01.16)
|
||||
# Improve command argument parsing. Display usage on incorrect use.
|
||||
# Support multiple modes at once in islisted.
|
||||
#
|
||||
# 0.6.4 (2015.03.22)
|
||||
# Fix translation from python: fix bans containing the letter Z not matching
|
||||
#
|
||||
# 0.7.0 (2015.09.14)
|
||||
# Support trailing characters in CIDR bans.
|
||||
|
||||
my $active = 0;
|
||||
my $user;
|
||||
my $channel;
|
||||
my $orig_list;
|
||||
my $modes;
|
||||
my @whois;
|
||||
my $lists_left;
|
||||
my @bans;
|
||||
|
||||
sub parse_ipv6_word
|
||||
{
|
||||
my ($w) = @_;
|
||||
return hex $w if $w =~ /^0*[0-9a-fA-F]{1,4}$/;
|
||||
die "Invalid IPv6 word";
|
||||
}
|
||||
|
||||
sub parse_ip
|
||||
{
|
||||
my ($ip, $strict) = @_;
|
||||
if($ip =~ /:/)
|
||||
{
|
||||
if($ip =~ /::/)
|
||||
{
|
||||
my $edge = ($ip =~ /::$/) || ($ip =~ /^::/);
|
||||
$ip = $ip . "0" if $ip =~ /::$/;
|
||||
$ip = "0" . $ip if $ip =~ /^::/;
|
||||
my ($head, $tail) = split /::/, $ip, 2;
|
||||
my @headwords = split /:/, $head, 8;
|
||||
my @tailwords = split /:/, $tail, 8;
|
||||
if(@headwords + @tailwords <= ($edge ? 8 : 7))
|
||||
{
|
||||
my $result;
|
||||
eval
|
||||
{
|
||||
@headwords = map { parse_ipv6_word($_) } @headwords;
|
||||
@tailwords = map { parse_ipv6_word($_) } @tailwords;
|
||||
my @words = (@headwords, (0) x (8 - @headwords - @tailwords), @tailwords);
|
||||
$result = 0;
|
||||
for(my $i = 0; $i < 8; $i++)
|
||||
{
|
||||
$result |= $words[$i] << ((7 - $i) * 16);
|
||||
}
|
||||
};
|
||||
return $result if defined $result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my @words = split /:/, $ip, 8;
|
||||
if(scalar @words == 8)
|
||||
{
|
||||
my $result;
|
||||
eval
|
||||
{
|
||||
@words = map { parse_ipv6_word($_) } @words;
|
||||
$result = 0;
|
||||
for(my $i = 0; $i < 8; $i++)
|
||||
{
|
||||
$result |= $words[$i] << ((7 - $i) * 16);
|
||||
}
|
||||
};
|
||||
return $result if defined $result;
|
||||
}
|
||||
}
|
||||
die "Invalid IPv6" if $strict;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($ip =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
|
||||
{
|
||||
my ($o1, $o2, $o3, $o4) = (0 + $1, 0 + $2, 0 + $3, 0 + $4);
|
||||
return $o1 << 24 | $o2 << 16 | $o3 << 8 | $o4
|
||||
if $o1 < 256 && $o2 < 256 && $o3 < 256 && $o4 < 256;
|
||||
}
|
||||
die "Invalid IPv4" if $strict;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
my %char_classes =
|
||||
(
|
||||
"[" => "[\[{]",
|
||||
"{" => "[{\[]",
|
||||
"|" => "[|\\]",
|
||||
"\\" => "[\\|]",
|
||||
"]" => "[\]}]",
|
||||
"}" => "[}\]]",
|
||||
"~" => "[~^]",
|
||||
"?" => "."
|
||||
);
|
||||
$char_classes{$_} = $_ foreach split //, '-_`^0123456789';
|
||||
for(my $c = 0; $c <= 25; $c++)
|
||||
{
|
||||
my $lc = chr($c + ord "a");
|
||||
my $uc = chr($c + ord "A");
|
||||
$char_classes{$lc} = "[$lc$uc]";
|
||||
$char_classes{$uc} = "[$uc$lc]";
|
||||
}
|
||||
|
||||
sub match_pattern
|
||||
{
|
||||
my ($string, $pattern) = @_;
|
||||
$string = "" if !defined $string;
|
||||
$pattern =~ s|[?*]+|"?" x ($& =~ tr/?/?/) . ($& =~ /\*/ ? "*" : "")|ge;
|
||||
|
||||
my $last_pos = 0;
|
||||
my @pieces = split /\*/, $pattern;
|
||||
push @pieces, "" if $pattern =~ /\*$/;
|
||||
push @pieces, "" if $pattern eq "*";
|
||||
for(my $i = 0; $i < scalar @pieces; $i++)
|
||||
{
|
||||
my $regex = "";
|
||||
$regex .= "^" if !$i;
|
||||
$regex .= defined $char_classes{$_} ? $char_classes{$_} : "\\$_" for split //, $pieces[$i];
|
||||
$regex .= "\$" if $i == $#pieces;
|
||||
if((substr $string, $last_pos) =~ qr/$regex/)
|
||||
{
|
||||
$last_pos += $+[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
my @found_modes;
|
||||
sub add_ban
|
||||
{
|
||||
push @found_modes, "\x0302$_[1] $_[0]\x0F in \x0306$_[2]\x0F set by \x0310$_[3]\x0F on \x0308" . (scalar localtime $_[4]) . "\x0F";
|
||||
}
|
||||
|
||||
sub analyze
|
||||
{
|
||||
$active = 0;
|
||||
my ($nick, $ident, $host, $gecos, $account, $ssl) = @whois;
|
||||
@found_modes = ();
|
||||
my @hostile_modes = ();
|
||||
for my $c(split //, $modes)
|
||||
{
|
||||
push @hostile_modes, $c if $orig_list eq "b" && ($c eq "i" || ($c eq "r" && !$account) || ($c eq "S" && !$ssl));
|
||||
push @hostile_modes, $c if $orig_list eq "q" && ($c eq "m" || ($c eq "r" && !$account));
|
||||
}
|
||||
push @found_modes, ("\x0302+" . join("", @hostile_modes) . "\x0F in \x0306$channel\x0F") if(@hostile_modes);
|
||||
for my $b(@bans)
|
||||
{
|
||||
my ($ban) = split /(?<!^)\$/, $b->[0], 2;
|
||||
if($ban =~ /^\$/)
|
||||
{
|
||||
add_ban(@$b) if $ban eq '$a' && $account;
|
||||
if($ban =~ /^\$a:(.*)$/)
|
||||
{
|
||||
add_ban(@$b) if $account && nick_eq($account, $1);
|
||||
}
|
||||
add_ban(@$b) if $ban eq '$~a' && !$account;
|
||||
if($ban =~ /^\$~a:(.*)$/)
|
||||
{
|
||||
add_ban(@$b) if !$account || !nick_eq($account, $1);
|
||||
}
|
||||
add_ban(@$b) if $ban =~ /^\$~j:/;
|
||||
if($ban =~ /^\$r:(.*)$/)
|
||||
{
|
||||
add_ban(@$b) if match_pattern($gecos, $1);
|
||||
}
|
||||
if($ban =~ /^\$~r:(.*)$/)
|
||||
{
|
||||
add_ban(@$b) if !match_pattern($gecos, $1);
|
||||
}
|
||||
if($ban =~ /^\$x:(.*)$/)
|
||||
{
|
||||
for my $h(@$host)
|
||||
{
|
||||
if(match_pattern("$nick!$ident\@$h#$gecos", $1))
|
||||
{
|
||||
add_ban(@$b);
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($ban =~ /^\$~x:(.*)$/)
|
||||
{
|
||||
my $found = 0;
|
||||
for my $h(@$host)
|
||||
{
|
||||
if(match_pattern("$nick!$ident\@$h#$gecos", $1))
|
||||
{
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
add_ban(@$b) if !$found;
|
||||
}
|
||||
add_ban(@$b) if $ban eq '$z' && $ssl;
|
||||
add_ban(@$b) if $ban eq '$~z' && !$ssl;
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($v, $bhost) = split /@/, $ban, 2;
|
||||
my ($bnick, $bident) = split /!/, $v, 2;
|
||||
if(match_pattern($nick, $bnick) && match_pattern($ident, $bident))
|
||||
{
|
||||
my $found = 0;
|
||||
for my $h(@$host)
|
||||
{
|
||||
if(match_pattern($h, $bhost))
|
||||
{
|
||||
$found = 1;
|
||||
add_ban(@$b);
|
||||
last;
|
||||
}
|
||||
}
|
||||
if(!$found)
|
||||
{
|
||||
my ($ip, $width) = split /\//, $bhost, 2;
|
||||
if(defined $width)
|
||||
{
|
||||
$width =~ s/^([0-9]*).*/$1/g;
|
||||
$width = int("0" . $width);
|
||||
if($width > 0)
|
||||
{
|
||||
my $is_v4 = !($ip =~ /:/);
|
||||
$width = ($is_v4 ? 32 : 128) - $width;
|
||||
$width = 0 if $width < 0;
|
||||
$ip = parse_ip($ip);
|
||||
for my $h(@$host)
|
||||
{
|
||||
if(!($h =~ /:/) == $is_v4)
|
||||
{
|
||||
my $last;
|
||||
eval
|
||||
{
|
||||
my $h = parse_ip($h, 1);
|
||||
if(($ip >> $width) == ($h >> $width))
|
||||
{
|
||||
add_ban(@$b);
|
||||
$last = 1;
|
||||
}
|
||||
};
|
||||
last if $last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} # omg so many }
|
||||
}
|
||||
}
|
||||
if(@found_modes)
|
||||
{
|
||||
if($orig_list eq "b")
|
||||
{
|
||||
Irssi::print("The following are preventing \x0310$user\x0F from joining \x0306$channel\x0F:");
|
||||
}
|
||||
elsif($orig_list eq "q")
|
||||
{
|
||||
Irssi::print("The following are preventing \x0310$user\x0F from speaking in \x0306$channel\x0F:");
|
||||
}
|
||||
else
|
||||
{
|
||||
Irssi::print("The following \x0302+$orig_list\x0F modes affect \x0310$user\x0F in \x0306$channel\x0F:");
|
||||
}
|
||||
Irssi::print($_) for(@found_modes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($orig_list eq "b")
|
||||
{
|
||||
Irssi::print("Nothing is preventing \x0310$user\x0F from joining \x0306$channel\x0F");
|
||||
}
|
||||
elsif($orig_list eq "q")
|
||||
{
|
||||
Irssi::print("Nothing is preventing \x0310$user\x0F from speaking in \x0306$channel\x0F");
|
||||
}
|
||||
else
|
||||
{
|
||||
Irssi::print("No \x0302+$orig_list\x0F modes affect \x0310$user\x0F in \x0306$channel\x0F");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub reset
|
||||
{
|
||||
$active = 0;
|
||||
}
|
||||
|
||||
sub lookup_host
|
||||
{
|
||||
my ($host) = @_;
|
||||
$host = "" if !defined $host;
|
||||
Irssi::print("\x0302Resolving <$host>");
|
||||
my @addresses = gethostbyname($host);
|
||||
if(@addresses)
|
||||
{
|
||||
@addresses = map { inet_ntoa($_) } @addresses[4 .. $#addresses];
|
||||
my %seen;
|
||||
@addresses = grep { !$seen{$_}++ } (@addresses, $host);
|
||||
Irssi::print("\x0302IPs: <@addresses>");
|
||||
return @addresses;
|
||||
}
|
||||
else
|
||||
{
|
||||
Irssi::print("\x0302Found nothing, will use <$host>");
|
||||
return $host;
|
||||
}
|
||||
}
|
||||
|
||||
sub query_list
|
||||
{
|
||||
my ($server, $channel, $mode) = @_;
|
||||
$server->command("quote MODE $channel");
|
||||
for my $m(split //, $mode)
|
||||
{
|
||||
$lists_left++;
|
||||
$server->command("quote MODE $channel $m");
|
||||
}
|
||||
}
|
||||
|
||||
sub query_whois
|
||||
{
|
||||
my ($server, $nick) = @_;
|
||||
$nick =~ s/\s+//g;
|
||||
$server->command("quote WHOIS $nick");
|
||||
}
|
||||
|
||||
sub ignored
|
||||
{
|
||||
Irssi::signal_stop() if $active;
|
||||
}
|
||||
|
||||
sub nick_eq
|
||||
{
|
||||
my ($n1, $n2) = @_;
|
||||
$n1 = lc $n1;
|
||||
$n1 =~ tr/[]\\/{}|/;
|
||||
$n2 = lc $n2;
|
||||
$n2 =~ tr/[]\\/{}|/;
|
||||
return $n1 eq $n2;
|
||||
}
|
||||
|
||||
sub modes
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
my ($server, $data, $nick, $address) = @_;
|
||||
my @w = split / /, $data;
|
||||
Irssi::print("\x0302Channel $w[1] is +s, report may be incomplete") if $w[2] =~ /s/;
|
||||
if(nick_eq($w[1], $channel))
|
||||
{
|
||||
$modes = $w[2];
|
||||
analyze() if !$lists_left && @whois;
|
||||
}
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub list_entry_b { list_entry("+b", @_); }
|
||||
sub list_entry_q { list_entry("+q", @_); }
|
||||
sub list_entry_I { list_entry("+I", @_); }
|
||||
sub list_entry_e { list_entry("+e", @_); }
|
||||
|
||||
sub list_entry
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
my ($u, $server, $data, $nick, $address) = @_;
|
||||
my @w = split / /, $data;
|
||||
splice @w, 2, 1 if $u eq "+q";
|
||||
if(nick_eq($w[1], $channel) && $w[2] =~ /^\$j:(.*)$/)
|
||||
{
|
||||
query_list($server, $1 =~ s/\$.*$//r, "b")
|
||||
}
|
||||
else
|
||||
{
|
||||
push @bans, [$w[2], $u, $w[1], $w[3], $w[4]];
|
||||
}
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub list_end
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
$lists_left--;
|
||||
analyze() if !$lists_left && @whois && $modes;
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub no_modes
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
Irssi::print("\x0304Attempted to get modes for a nickname, did you put the arguments in the wrong order?");
|
||||
if(!$modes)
|
||||
{
|
||||
$modes = "+";
|
||||
}
|
||||
else
|
||||
{
|
||||
$lists_left--;
|
||||
analyze() if !$lists_left && @whois;
|
||||
}
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub mode_error
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
Irssi::print("\x0304Something went wrong with the modes, report may be incomplete");
|
||||
if(!$modes)
|
||||
{
|
||||
$modes = "+";
|
||||
analyze() if !$lists_left && @whois;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lists_left--;
|
||||
analyze() if !$lists_left && @whois;
|
||||
}
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub no_list
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
my ($server, $data, $nick, $address) = @_;
|
||||
my @w = split / /, $data;
|
||||
Irssi::print("\x0304Could not obtain modes for $w[1], report may be incomplete");
|
||||
if(nick_eq($w[1], $channel) && !$modes)
|
||||
{
|
||||
$modes = "+";
|
||||
analyze() if !$lists_left && @whois;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lists_left--;
|
||||
analyze() if !$lists_left && @whois && $modes;
|
||||
}
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
my @wh;
|
||||
my $ac;
|
||||
my $ssl;
|
||||
|
||||
sub whois_start
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
my ($server, $data, $nick, $address) = @_;
|
||||
my @w = split / /, $data;
|
||||
@wh = ($w[1], $w[2], [lookup_host($w[3])], substr((join " ", @w[5 .. $#w]), 1));
|
||||
undef $ac;
|
||||
undef $ssl;
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub whois_ssl
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
$ssl = 1;
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub whois_account
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
my ($server, $data, $nick, $address) = @_;
|
||||
my @w = split / /, $data;
|
||||
$ac = $w[2];
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub whois_end
|
||||
{
|
||||
if($active)
|
||||
{
|
||||
my ($server, $data, $nick, $address) = @_;
|
||||
if(@wh)
|
||||
{
|
||||
@whois = (@wh, $ac, $ssl);
|
||||
@wh = ();
|
||||
analyze() if !$lists_left && $modes;
|
||||
}
|
||||
else
|
||||
{
|
||||
Irssi::print("\x0304Whois failed, aborting!");
|
||||
$active = 0;
|
||||
}
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
}
|
||||
|
||||
sub start_search
|
||||
{
|
||||
my ($server, $ch, $u, $mode) = @_;
|
||||
@whois = ();
|
||||
$orig_list = $mode;
|
||||
$channel = $ch;
|
||||
$user = $u;
|
||||
if($user =~ /[!@#\$]/)
|
||||
{
|
||||
my ($account, $rname, $host, $nick, $ident, $v);
|
||||
($v, $account) = split /\$/, $user, 2;
|
||||
($v, $rname) = split /#/, $v, 2;
|
||||
($v, $host) = split /@/, $v, 2;
|
||||
($nick, $ident) = split /!/, $v, 2;
|
||||
@whois = ($nick, $ident, [lookup_host($host)], $rname, $account, 0);
|
||||
}
|
||||
undef $modes;
|
||||
$lists_left = 0;
|
||||
@bans = ();
|
||||
$active = 1;
|
||||
query_list($server, $channel, $mode);
|
||||
query_whois($server, $user) if !@whois;
|
||||
}
|
||||
|
||||
sub isbanned
|
||||
{
|
||||
my ($arg, $server, $witem) = @_;
|
||||
if($arg =~ /^\s*(\S+)\s+(.*\S)\s*/)
|
||||
{
|
||||
my $chan = $1;
|
||||
my $user = $2;
|
||||
return start_search($server, $chan, $user, "b") if $chan ne "" && $user ne "";
|
||||
}
|
||||
Irssi::print("Usage: /isbanned <channel> <user>");
|
||||
}
|
||||
|
||||
sub ismuted
|
||||
{
|
||||
my ($arg, $server, $witem) = @_;
|
||||
my ($chan, $user) = split / /, $arg, 2;
|
||||
if($arg =~ /^\s*(\S+)\s+(.*\S)\s*/)
|
||||
{
|
||||
my $chan = $1;
|
||||
my $user = $2;
|
||||
if($chan ne "" && $user ne "")
|
||||
{
|
||||
start_search($server, $chan, $user, "q");
|
||||
query_list($server, $chan, "b");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Irssi::print("Usage: /ismuted <channel> <user>");
|
||||
}
|
||||
|
||||
sub islisted
|
||||
{
|
||||
my ($arg, $server, $witem) = @_;
|
||||
my ($chan, $mode, $user) = split / /, $arg, 3;
|
||||
if($arg =~ /^\s*(\S+)\s+(\S+)\s+(.*\S)\s*/)
|
||||
{
|
||||
my $chan = $1;
|
||||
my $mode = $2;
|
||||
my $user = $3;
|
||||
$mode =~ s/\+//g;
|
||||
return start_search($server, $chan, $user, $mode) if $chan ne "" && $mode ne "" && $user ne "";
|
||||
}
|
||||
Irssi::print("Usage: /islisted <channel> <mode> <user>");
|
||||
}
|
||||
|
||||
Irssi::signal_add("event 329", \&ignored);
|
||||
Irssi::signal_add("event 276", \&ignored);
|
||||
Irssi::signal_add("event 317", \&ignored);
|
||||
Irssi::signal_add("event 378", \&ignored);
|
||||
Irssi::signal_add("event 319", \&ignored);
|
||||
Irssi::signal_add("event 312", \&ignored);
|
||||
Irssi::signal_add("event 324", \&modes);
|
||||
Irssi::signal_add("event 367", \&list_entry_b);
|
||||
Irssi::signal_add("event 728", \&list_entry_q);
|
||||
Irssi::signal_add("event 346", \&list_entry_I);
|
||||
Irssi::signal_add("event 348", \&list_entry_e);
|
||||
Irssi::signal_add("event 368", \&list_end);
|
||||
Irssi::signal_add("event 729", \&list_end);
|
||||
Irssi::signal_add("event 347", \&list_end);
|
||||
Irssi::signal_add("event 349", \&list_end);
|
||||
Irssi::signal_add("event 502", \&no_modes);
|
||||
Irssi::signal_add("event 221", \&no_modes);
|
||||
Irssi::signal_add("event 472", \&mode_error);
|
||||
Irssi::signal_add("event 501", \&mode_error);
|
||||
Irssi::signal_add("event 403", \&no_list);
|
||||
Irssi::signal_add("event 482", \&no_list);
|
||||
Irssi::signal_add("event 311", \&whois_start);
|
||||
Irssi::signal_add("event 671", \&whois_ssl);
|
||||
Irssi::signal_add("event 330", \&whois_account);
|
||||
Irssi::signal_add("event 318", \&whois_end);
|
||||
Irssi::command_bind("isbanned", \&isbanned);
|
||||
Irssi::command_bind("ismuted", \&ismuted);
|
||||
Irssi::command_bind("islisted", \&islisted);
|
||||
Irssi::command_bind("isreset", \&reset);
|
51
.irssi/scripts/autorun/ls.pl
Normal file
51
.irssi/scripts/autorun/ls.pl
Normal file
|
@ -0,0 +1,51 @@
|
|||
use strict;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
use Irssi 20020120;
|
||||
$VERSION = "0.03";
|
||||
%IRSSI = (
|
||||
authors => "c0ffee",
|
||||
contact => "c0ffee\@penguin-breeder.org",
|
||||
name => "List nicks in channel",
|
||||
description => "Use /ls <regex> to show all nicks (including ident\@host) matching regex in the current channel",
|
||||
license => "Public Domain",
|
||||
url => "http://www.penguin-breeder.org/irssi/",
|
||||
changed => "Sun Sep 17 06:31 CEST 2017",
|
||||
);
|
||||
|
||||
|
||||
sub cmd_ls {
|
||||
my ($data, $server, $channel) = @_;
|
||||
|
||||
if ($channel->{type} ne "CHANNEL") {
|
||||
Irssi::print("You are not on a channel");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$channel->print("--- Search results:");
|
||||
|
||||
my @nicks = $channel->nicks();
|
||||
|
||||
my $re = eval { qr/$data/i };
|
||||
if (not $re) {
|
||||
chomp $@;
|
||||
$channel->print("Invalid regex pattern:\n$@");
|
||||
return;
|
||||
}
|
||||
|
||||
my $found;
|
||||
foreach my $nick (@nicks) {
|
||||
my $n = $nick->{nick} . "!" . $nick->{host};
|
||||
|
||||
if ($n =~ $re) {
|
||||
$channel->print($n);
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (not $found) {
|
||||
$channel->print("No matches");
|
||||
}
|
||||
}
|
||||
|
||||
Irssi::command_bind('ls','cmd_ls');
|
114
.irssi/scripts/autorun/mkick.pl
Normal file
114
.irssi/scripts/autorun/mkick.pl
Normal file
|
@ -0,0 +1,114 @@
|
|||
#
|
||||
# Usage: /MKICK [options] [mode] [mask] [reason]
|
||||
# Options:
|
||||
# -n normal kick
|
||||
# -6 '2+4' kickmethod
|
||||
# Mode:
|
||||
# -a all on channel
|
||||
# -o chops
|
||||
# -v chvoices
|
||||
# -d users without op
|
||||
# -l users without op and voice
|
||||
# Settings.
|
||||
# /SET masskick_default_reason [reason]
|
||||
# /SET masskick_default_use_6method [On/Off]
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Irssi;
|
||||
use Irssi::Irc;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = "0.9";
|
||||
%IRSSI = (
|
||||
authors => 'Marcin Rozycki',
|
||||
contact => 'derwan@irssi.pl',
|
||||
name => 'mkick',
|
||||
description => 'Masskick, usage: /mkick [-aovdln6 (hostmask)] <[:]reason>',
|
||||
license => 'GNU GPL v2',
|
||||
url => 'http://derwan.irssi.pl',
|
||||
changed => 'Wed Oct 6 20:58:38 CEST 2004'
|
||||
);
|
||||
|
||||
Irssi::theme_register([
|
||||
'mkick_not_connected', 'Mkick: Not connected to server',
|
||||
'mkick_not_chanwin', 'Mkick: Not joined to any channel',
|
||||
'mkick_not_chanop', 'Mkick: You\'re not channel operator on {hilight $0}',
|
||||
'mkick_syntax', 'Mkick: $0, use: /MKICK [-a|-o|-v|-d|-l] [-n|-6] (mask) [reason]',
|
||||
'mkick_no_users', '%_Mkick:%_ No users matching given criteria',
|
||||
'mkick_kicklist', '%_Mkick:%_ Send masskick for $1 users on $0: $2-'
|
||||
]);
|
||||
|
||||
sub cmd_mkick
|
||||
{
|
||||
my ($args, $server, $witem) = @_;
|
||||
|
||||
Irssi::printformat(MSGLEVEL_CRAP, "mkick_not_connected"), return if (!$server or !$server->{connected});
|
||||
Irssi::printformat(MSGLEVEL_CRAP, "mkick_not_chanwin"), return if (!$witem or $witem->{type} !~ /^channel$/i);
|
||||
Irssi::printformat(MSGLEVEL_CRAP, "mkick_not_chanop", $witem->{name}), return if (!$witem->{chanop});
|
||||
|
||||
my $reason = Irssi::settings_get_str("masskick_default_reason");
|
||||
my $method = Irssi::settings_get_bool("masskick_default_use_6method");
|
||||
my $servernick = $server->{nick};
|
||||
my $channel = $witem->{name};
|
||||
my $mode = undef;
|
||||
my $mask = "*!*\@*";
|
||||
|
||||
my @kicklist = ();
|
||||
my @nicklist = ();
|
||||
my @args = split(/ +/, $args);
|
||||
|
||||
while ($_ = shift(@args))
|
||||
{
|
||||
/^..*!..*@..*$/ and $mask = "$&", next;
|
||||
/^-(a|o|v|d|l)$/ and s/-//, $mode = $_, next;
|
||||
/^-(n|6)$/ and $method = $_ =~ s/6//, next;
|
||||
/^-/ and Irssi::printformat(MSGLEVEL_CRAP, "mkick_syntax", "Unknown argument: $_"), return;
|
||||
/^:/ and s/^://;
|
||||
$reason = ($#args >= 0) ? $_." ".join(" ", @args) : $_;
|
||||
last;
|
||||
};
|
||||
|
||||
unless ($mode) {
|
||||
Irssi::printformat(MSGLEVEL_CRAP, "mkick_syntax", "Missing argument"), return if ($mask eq '*!*@*');
|
||||
$mode = "a";
|
||||
};
|
||||
|
||||
foreach my $hash ($witem->nicks())
|
||||
{
|
||||
my $nick = $hash->{nick};
|
||||
next if ($nick eq $servernick or !$server->mask_match_address($mask, $nick, $hash->{host}));
|
||||
|
||||
my $isop = $hash->{op};
|
||||
my $isvoice = $hash->{voice};
|
||||
|
||||
if ($mode eq "a" or
|
||||
$mode eq "o" && $isop or
|
||||
$mode eq "v" && $isvoice && !$isop or
|
||||
$mode eq "d" && !$isop or
|
||||
$mode eq "l" && !$isop && !$isvoice) {
|
||||
push(@kicklist, $nick);
|
||||
my $mod = ($isop == 1) ? "\@" : ($isvoice == 1) ? "+" : undef;
|
||||
push(@nicklist, $mod.$nick);
|
||||
};
|
||||
};
|
||||
|
||||
Irssi::printformat(MSGLEVEL_CRAP, "mkick_no_users", $mask, $mode), return if ($#kicklist < 0);
|
||||
Irssi::printformat(MSGLEVEL_CRAP, "mkick_kicklist", $channel, scalar(@nicklist), @nicklist);
|
||||
|
||||
if ($method > 0) {
|
||||
$reason = substr($reason, 0, 15) if (length($reason) > 15);
|
||||
while (@kicklist) {
|
||||
$server->send_raw("KICK $channel ".join(",", @kicklist[0 .. $method])." :$reason");
|
||||
@kicklist = @kicklist[($method + 1)..$#kicklist];
|
||||
$method = ($method == 3 && $#kicklist > 3) ? 1 : 3;
|
||||
};
|
||||
} else {
|
||||
$server->send_raw_split("KICK $channel ".join(",", @kicklist)." :$reason", 2, $server->{max_kicks_in_cmd});
|
||||
};
|
||||
};
|
||||
|
||||
Irssi::settings_add_str("misc", "masskick_default_reason", "Irssi BaBy!");
|
||||
Irssi::settings_add_bool("misc", "masskick_default_use_6method", 0);
|
||||
|
||||
Irssi::command_bind("mkick", "cmd_mkick");
|
153
.irssi/scripts/autorun/modelist.pl
Normal file
153
.irssi/scripts/autorun/modelist.pl
Normal file
|
@ -0,0 +1,153 @@
|
|||
# modelist.pl v 0.7.2 by Marcin Rozycki (derwan@irssi.pl) changed at Sat Jun 5 22:38:59 CEST 2004
|
||||
#
|
||||
# Usage:
|
||||
# /se
|
||||
# /si
|
||||
# /unexcept [index] ( ex. /unexcept 1 5 17)
|
||||
# /uninvite [index] ( ex. /uninvite 3 8)
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Irssi 20020600 ();
|
||||
use Irssi::Irc;
|
||||
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = "0.7.2";
|
||||
%IRSSI = (
|
||||
authors => 'Marcin Rozycki',
|
||||
contact => 'derwan@irssi.pl',
|
||||
name => 'modelist',
|
||||
description => 'Cache of invites and ban exceptions in channel. Usage: /si, /se, '.
|
||||
'/unexcept [indexes], /uninvite [indexes]',
|
||||
license => 'GNU GPL v2',
|
||||
url => 'http://derwan.irssi.pl',
|
||||
changed => 'Sat Jun 5 22:38:59 CEST 2004'
|
||||
);
|
||||
|
||||
Irssi::theme_register([
|
||||
'modelist', '$0 - {hilight $1}: $2 %c$3%n $4'
|
||||
]);
|
||||
|
||||
my %modelist = ();
|
||||
|
||||
sub channel_create
|
||||
{
|
||||
my ($server, $channel) = (@_[0], lc($_[1]));
|
||||
delete $modelist{lc($server->{tag})}{$channel};
|
||||
|
||||
$server->redirect_event("mode I", 1, "$channel", 0, undef, {
|
||||
'event 346' => 'redir modelist invite',
|
||||
'' => 'event empty' });
|
||||
$server->send_raw("MODE $channel I");
|
||||
|
||||
$server->redirect_event("mode e", 1, "$channel", 0, undef, {
|
||||
'event 348' => 'redir modelist except',
|
||||
'' => 'event empty' });
|
||||
$server->send_raw("MODE $channel e");
|
||||
}
|
||||
|
||||
sub sig_channel_created
|
||||
{
|
||||
channel_create($_[0]->{server}, $_[0]->{name}) unless ($_[0]->{no_modes});
|
||||
}
|
||||
|
||||
|
||||
sub sig_redir_modelist_invite
|
||||
{
|
||||
my ($nick, $chan, $mode) = split(/ +/, $_[1], 3);
|
||||
message_irc_mode($_[0], $chan, undef, undef, "+I $mode");
|
||||
}
|
||||
|
||||
sub sig_redir_modelist_except
|
||||
{
|
||||
my ($nick, $chan, $mode) = split(/ +/, $_[1], 3);
|
||||
message_irc_mode($_[0], $chan, undef, undef, "+e $mode");
|
||||
}
|
||||
|
||||
sub message_irc_mode
|
||||
{
|
||||
my ($mode, @args) = split(/ +/, $_[4]);
|
||||
return unless $_[0]->ischannel($_[1]);
|
||||
my ($tag, $chan, $mod) = (lc($_[0]->{tag}), lc($_[0]->channel_find($_[1])->{name}), "+");
|
||||
foreach ( split //, $mode )
|
||||
{
|
||||
/([+-])/ and $mod = $_, next;
|
||||
my $arg = ( $mod eq '+' && $_ =~ m/[beIkloRvh]/ or $mod eq '-' && $_ =~ m/[beIkoRvh]/ ) ? shift(@args) : undef;
|
||||
next unless ( $_ =~ m/[eI]/ );
|
||||
( $mod eq '+' ) and push(@{$modelist{$tag}{$chan}{$_}}, [$arg, $_[2], time]), next;
|
||||
for (my $idx = 0; $idx <= $#{$modelist{$tag}{$chan}{$_}}; $idx++) {
|
||||
splice(@{$modelist{$tag}{$chan}{$_}}, $idx, 1) if ($modelist{$tag}{$chan}{$_}[$idx][0] eq $arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub proc_modelist_show
|
||||
{
|
||||
my ($arg, $server, $channel, $list, $mode) = @_;
|
||||
|
||||
Irssi::print("You\'re not connected to server"), return unless ($server and $server->{connected});
|
||||
|
||||
$arg =~ s/\s.*//;
|
||||
if ($arg) {
|
||||
Irssi::print("Bad channel name: $arg"), return unless ($server->ischannel($arg));
|
||||
unless ($channel = $server->channel_find($arg)) {
|
||||
Irssi::print("You\'re not in channel $arg --> sending request to server");
|
||||
$server->send_raw("MODE $arg $list");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Irssi::print("Not joined to any channel"), return unless ($channel and $channel->{type} eq "CHANNEL");
|
||||
Irssi::print("Channel not fully synchronized yet, try again after a while"), return unless ($channel->{synced});
|
||||
Irssi::print("Channel doesn\'t support modes"), return if ($channel->{no_modes});
|
||||
|
||||
my ($tag, $name) = (lc($server->{tag}), $channel->{name});
|
||||
my $chan = lc($name);
|
||||
my $items = $#{$modelist{$tag}{$chan}{$list}};
|
||||
|
||||
Irssi::print("No $mode\s in channel %_$name%_"), return if ($items < 0);
|
||||
|
||||
for (my $idx = 0; $idx <= $items; $idx++)
|
||||
{
|
||||
my ($mask, $who) = ($modelist{$tag}{$chan}{$list}[$idx]->[0], $modelist{$tag}{$chan}{$list}[$idx]->[1]);
|
||||
$mask =~ tr/\240\002\003\037\026/\206\202\203\237\226/;
|
||||
my $setby = ($who) ? "\00314[\003by \002$who\002, ".(time - $modelist{$tag}{$chan}{$list}[$idx]->[2])." secs ago\00314]\003" : undef;
|
||||
$channel->printformat(MSGLEVEL_CRAP, 'modelist', ($idx+1), $name, $mode, $mask, $setby);
|
||||
}
|
||||
}
|
||||
|
||||
sub cmd_si { proc_modelist_show @_, "I", "invite"; }
|
||||
sub cmd_se { proc_modelist_show @_, "e", "ban exception"; }
|
||||
|
||||
sub cmd_modelist {
|
||||
my ( $type, $data, $server, $witem) = @_;
|
||||
Irssi::print("You\'re not connected to server"), return unless ($server and $server->{connected});
|
||||
Irssi::print("Not joined to any channel"), return unless ( $witem and $witem->{type} eq "CHANNEL" );
|
||||
my ($tag, $chan, @masks) = (lc($server->{tag}), lc($server->channel_find($witem->{name})->{name}));
|
||||
while ( $data =~ m/(\d+)/g ) {
|
||||
my $idx = $1 - 1;
|
||||
next unless ( exists $modelist{$tag}{$chan}{$type}[$idx] );
|
||||
push(@masks, $modelist{$tag}{$chan}{$type}[$idx]->[0]);
|
||||
}
|
||||
return unless ( $#masks >= 0 );
|
||||
$witem->command(sprintf("MODE %s -%s %s", $chan, $type x scalar(@masks), join(" ", @masks)));
|
||||
}
|
||||
|
||||
Irssi::signal_add("channel created", "sig_channel_created");
|
||||
Irssi::signal_add("redir modelist invite", "sig_redir_modelist_invite");
|
||||
Irssi::signal_add("redir modelist except", "sig_redir_modelist_except");
|
||||
Irssi::signal_add("message irc mode", "message_irc_mode");
|
||||
|
||||
Irssi::command_bind("si", "cmd_si");
|
||||
Irssi::command_bind("se", "cmd_se");
|
||||
Irssi::command_bind("uninvite" => sub { cmd_modelist("I", @_); });
|
||||
Irssi::command_bind("unexcept" => sub { cmd_modelist("e", @_); });
|
||||
|
||||
foreach my $server (Irssi::servers)
|
||||
{
|
||||
foreach my $channel ($server->channels())
|
||||
{
|
||||
channel_create($server, $channel->{name}) unless ($channel->{no_modes});
|
||||
}
|
||||
}
|
72
.irssi/scripts/autorun/savecmdhist.pl
Normal file
72
.irssi/scripts/autorun/savecmdhist.pl
Normal file
|
@ -0,0 +1,72 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Irssi 20171006;
|
||||
use Irssi::UI;
|
||||
|
||||
our $VERSION = '1.0'; # 7775fccf37d60a5
|
||||
our %IRSSI = (
|
||||
authors => 'Nei',
|
||||
contact => 'Nei @ anti@conference.jabber.teamidiot.de',
|
||||
url => "http://anti.teamidiot.de/",
|
||||
name => 'savecmdhist',
|
||||
description => 'Saves the commands you typed in the input prompt to a history file, so that they persist across /upgrade and restart.',
|
||||
license => 'ISC',
|
||||
);
|
||||
|
||||
# Usage
|
||||
# =====
|
||||
# Put the script in autorun if you want the history to be loaded on
|
||||
# start.
|
||||
|
||||
my $histfile = Irssi::get_irssi_dir()."/cmdhistory";
|
||||
|
||||
sub loadcmdhist {
|
||||
my %R = ("n" => "\n", "\\" => "\\", ";" => ";");
|
||||
my $fh;
|
||||
unless (open $fh, '<', $histfile) {
|
||||
warn "Could not open history file ($histfile) for readin: $!\n"
|
||||
if -e $histfile;
|
||||
return;
|
||||
}
|
||||
my @hist;
|
||||
while (defined(my $line = <$fh>)) {
|
||||
chomp $line;
|
||||
if ($line =~ /^: (\d*):(\d*):(.*?) :;(.*)$/) {
|
||||
push @hist, +{
|
||||
time => $1,
|
||||
window => length $2 ? $2 : undef,
|
||||
history => length $3 ? $3 : undef,
|
||||
};
|
||||
$hist[-1]{text} = $4 =~ s/\\(\\|;|n)/$R{$1}/gmsr;
|
||||
}
|
||||
}
|
||||
my $he1 = @{[Irssi::UI::Window::get_history_entries(undef)]};
|
||||
Irssi::UI::Window::load_history_entries(undef, @hist) if @hist && $he1 <= 1;
|
||||
}
|
||||
|
||||
sub savecmdhist {
|
||||
my %R = ("\n" => "\\n", "\\" => "\\\\", " :;" => " :\\;");
|
||||
my $old_umask =
|
||||
umask 0077;
|
||||
my $fh;
|
||||
unless (open $fh, '>', $histfile) {
|
||||
umask $old_umask;
|
||||
warn "Could not open history file ($histfile) for writing: $!\n";
|
||||
return;
|
||||
}
|
||||
umask $old_umask;
|
||||
no warnings 'uninitialized';
|
||||
for my $hist (Irssi::UI::Window::get_history_entries(undef)) {
|
||||
my $text = $hist->{text} =~ s/(\n|\\| :;)/$R{$1}/gmsr;
|
||||
print $fh ": $hist->{time}:$hist->{window}:$hist->{history} :;$text\n";
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
|
||||
Irssi::signal_add 'gui exit' => sub {
|
||||
savecmdhist() if Irssi::settings_get_bool('settings_autosave');
|
||||
};
|
||||
|
||||
Irssi::signal_add 'command save' => 'savecmdhist';
|
||||
|
||||
loadcmdhist();
|
156
.irssi/scripts/autorun/sb_search.pl
Normal file
156
.irssi/scripts/autorun/sb_search.pl
Normal file
|
@ -0,0 +1,156 @@
|
|||
# sb_search.pl - search in your scrollback, scroll to a match
|
||||
# Do /HELP SCROLLBACK for help
|
||||
|
||||
# Copyright (C) 2008 Wouter Coekaerts <wouter@coekaerts.be>, Emanuele Giaquinta <exg@irssi.org>
|
||||
#
|
||||
# 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 St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
use strict;
|
||||
use Irssi;
|
||||
use Irssi::TextUI;
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = '1.2';
|
||||
%IRSSI = (
|
||||
authors => 'Wouter Coekaerts, Emanuele Giaquinta',
|
||||
contact => 'wouter@coekaerts.be, exg@irssi.org',
|
||||
name => 'sb_search',
|
||||
description => 'search in your scrollback, scroll to a match',
|
||||
license => 'GPLv2 or later',
|
||||
url => 'http://wouter.coekaerts.be/irssi/',
|
||||
changed => '$LastChangedDate$',
|
||||
);
|
||||
|
||||
sub cmd_help {
|
||||
my ($args, $server, $witem) = @_;
|
||||
if ($args =~ /^scrollback( search)? *$/i) {
|
||||
Irssi::print ( <<SCRIPTHELP_EOF
|
||||
|
||||
SCROLLBACK SEARCH [-level <level>] [-regexp] [-case] [-word] [-forward] [-all] [<pattern>]
|
||||
|
||||
SEARCH: Search for text in the scrollback buffer.
|
||||
|
||||
-regexp: The given text pattern is a regular expression.
|
||||
-case: Performs a case-sensitive matching.
|
||||
-word: The text must match full words.
|
||||
-forward: Search forwards (default is backwards).
|
||||
-all: Search in all windows.
|
||||
|
||||
Without arguments, the last search is repeated.
|
||||
SCRIPTHELP_EOF
|
||||
,MSGLEVEL_CLIENTCRAP);
|
||||
}
|
||||
}
|
||||
|
||||
my $regex;
|
||||
my $all;
|
||||
my $level;
|
||||
|
||||
sub cmd_sb_search {
|
||||
my ($args, $server, $witem) = @_;
|
||||
|
||||
### handle options
|
||||
|
||||
my ($options, $pattern) = Irssi::command_parse_options('scrollback search', $args);
|
||||
|
||||
my $forward = defined(delete $options->{forward});
|
||||
|
||||
if (!%$options && !$pattern) {
|
||||
return if !$regex && !defined $level;
|
||||
} else {
|
||||
$all = defined($options->{all});
|
||||
$level = MSGLEVEL_ALL;
|
||||
undef $regex;
|
||||
}
|
||||
|
||||
if (defined($options->{level})) {
|
||||
$level = $options->{level};
|
||||
$level =~ y/,/ /;
|
||||
$level = Irssi::combine_level(0, $level);
|
||||
}
|
||||
|
||||
if ($pattern) {
|
||||
my $flags = defined($options->{case}) ? '' : '(?i)';
|
||||
my $b = defined($options->{word}) ? '\b' : '';
|
||||
if (defined($options->{regexp})) {
|
||||
local $@;
|
||||
eval {
|
||||
$regex = qr/$flags$b$pattern$b/;
|
||||
};
|
||||
if ($@) {
|
||||
my ($err) = $@ =~ /^(.*)/;
|
||||
$err =~ s/\sat .* line \d+\.$//;
|
||||
print CLIENTERROR $err;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$regex = qr/$flags$b\Q$pattern\E$b/;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### determine window(s) to search in
|
||||
|
||||
my $current_win = ref $witem ? $witem->window() : Irssi::active_win();
|
||||
|
||||
my @windows;
|
||||
if ($all) {
|
||||
# cycle backward or forwards over all windows starting from current
|
||||
# for example, searching backward through 5 windows, with window 3 active: search order is 3,2,1,5,4
|
||||
# if we're searching forward: 3,4,5,1,2
|
||||
my $order = $forward ? 1 : -1;
|
||||
@windows = sort {$order * ($a->{refnum} cmp $b->{refnum})} Irssi::windows();
|
||||
my @before_windows = grep {($_->{refnum} cmp $current_win->{refnum}) == $order} @windows;
|
||||
my @after_windows = grep {($_->{refnum} cmp $current_win->{refnum}) == -$order} @windows;
|
||||
@windows = ($current_win, @before_windows, @after_windows);
|
||||
} else {
|
||||
@windows = ($current_win);
|
||||
}
|
||||
|
||||
### do the search
|
||||
|
||||
foreach my $win (@windows) {
|
||||
my $view = $win->view;
|
||||
|
||||
## determine line to start from
|
||||
my $line;
|
||||
if ($all && $win != $current_win) {
|
||||
if ($forward) { # first line
|
||||
$line = $view->get_lines;
|
||||
} else { # last line
|
||||
$line = $view->{buffer}{cur_line};
|
||||
}
|
||||
} elsif ($view->{startline}) { # line after or before first visible line
|
||||
$line = $forward ? $view->{startline}->next : $view->{startline}->prev;
|
||||
}
|
||||
|
||||
## loop over the lines
|
||||
while (defined $line) {
|
||||
my $line_level = $line->{info}{level};
|
||||
if ($line_level & $level && $line->get_text(0) =~ $regex) {
|
||||
$view->scroll_line($line);
|
||||
if ($all) {
|
||||
Irssi::command('window goto ' . $win->{refnum});
|
||||
}
|
||||
return;
|
||||
}
|
||||
$line = $forward ? $line->next : $line->prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Irssi::command_bind('scrollback search', \&cmd_sb_search);
|
||||
Irssi::command_bind_last('help', \&cmd_help);
|
||||
Irssi::command_set_options('scrollback search', '-level regexp case word forward all');
|
86
.irssi/scripts/autorun/servercomplete.pl
Normal file
86
.irssi/scripts/autorun/servercomplete.pl
Normal file
|
@ -0,0 +1,86 @@
|
|||
use strict;
|
||||
use Irssi 20020101.0250 ();
|
||||
use vars qw($VERSION %IRSSI);
|
||||
$VERSION = "2";
|
||||
%IRSSI = (
|
||||
authors => 'David Leadbeater',
|
||||
contact => 'dgl@dgl.cx',
|
||||
name => 'servercomplete',
|
||||
description => 'Tab complete servers and userhosts (irc. -> irc server, user@ -> user@host). Useful for lazy ircops for /squit and so on :)',
|
||||
license => 'GNU GPLv2 or later',
|
||||
url => 'http://irssi.dgl.cx/',
|
||||
);
|
||||
|
||||
my %servers;
|
||||
|
||||
sub sig_complete {
|
||||
my ($complist, $window, $word, $linestart, $want_space) = @_;
|
||||
my $tag = $window->{active_server}->{tag};
|
||||
|
||||
if($word =~ /[!*@]/) {
|
||||
my $wi = Irssi::active_win()->{active};
|
||||
return unless ref $wi and $wi->{type} eq 'CHANNEL';
|
||||
my $server = $wi->{server};
|
||||
return unless ref $server;
|
||||
|
||||
my($nick,$ident,$host) = ('','','');
|
||||
|
||||
$nick = $1 if $word =~ /([^!]+)!/ && $1;
|
||||
$ident = $1 if $word !~ /!$/ && $word =~ /!?([^@]+)(@|$)/ && $1;
|
||||
$host = $1 if $word =~ /@(.*)$/ && $1;
|
||||
|
||||
for my $n ($wi->nicks()) {
|
||||
next if not_wild($nick) and $n->{nick} !~ /^\Q$nick\E/i;
|
||||
|
||||
my($user,$addr) = split(/@/, $n->{host});
|
||||
|
||||
next if not_wild($ident) and $user !~ /^\Q$ident\E/i;
|
||||
next if not_wild($host) and $addr !~ /^\Q$host\E/i;
|
||||
|
||||
if($word =~ /!/) {
|
||||
push @$complist, get_match($n->{nick}, $nick) . '!' . get_match($user, $ident) . '@' . get_match($addr,$host);
|
||||
}else{
|
||||
push @$complist, get_match($user, $ident) . '@' . get_match($addr,$host);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return unless $servers{$tag};
|
||||
for (keys %{$servers{$tag}}) {
|
||||
push @$complist, $_ if /^\Q$word\E/;
|
||||
}
|
||||
}
|
||||
|
||||
sub get_match {
|
||||
my($match, $thing) = @_;
|
||||
return $thing eq '*' ? '*' : $match;
|
||||
}
|
||||
|
||||
sub not_wild {
|
||||
return 0 if($_[0] eq '*' || $_[0] eq '');
|
||||
1;
|
||||
}
|
||||
|
||||
sub add_server {
|
||||
my($tag,$data,$offset) = @_;
|
||||
$servers{$tag}{(split(/ /,$data))[$offset]} = 1;
|
||||
}
|
||||
|
||||
Irssi::signal_add_last('complete word', 'sig_complete');
|
||||
|
||||
Irssi::signal_add('event 352', sub {
|
||||
my($server,$data) = @_;
|
||||
add_server($server->{tag}, $data, 4);
|
||||
} );
|
||||
|
||||
Irssi::signal_add('event 312', sub {
|
||||
my($server,$data) = @_;
|
||||
add_server($server->{tag}, $data, 2);
|
||||
} );
|
||||
|
||||
Irssi::signal_add('event 364', sub {
|
||||
my($server,$data) = @_;
|
||||
add_server($server->{tag}, $data, 1);
|
||||
add_server($server->{tag}, $data, 2);
|
||||
} );
|
||||
|
1258
.irssi/scripts/autorun/trigger.pl
Normal file
1258
.irssi/scripts/autorun/trigger.pl
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,19 @@
|
|||
\documentclass{article}
|
||||
\documentclass[12pt]{article}
|
||||
|
||||
\usepackage[a4paper]{geometry}
|
||||
\usepackage[letterpaper]{geometry}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{caption}
|
||||
\usepackage{graphicx}
|
||||
\graphicspath{ {./images/} }
|
||||
\captionsetup{labelformat=empty}
|
||||
|
||||
\title{}
|
||||
\author{}
|
||||
\date{}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\setlength{\parskip}{1em}
|
||||
|
||||
|
||||
\end{document}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021
|
||||
Copyright (c) 2022
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
24
.vim/templates/uni
Normal file
24
.vim/templates/uni
Normal file
|
@ -0,0 +1,24 @@
|
|||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
|
@ -12,6 +12,7 @@ command Tman :r ~/.vim/templates/man.1
|
|||
command Tmh :r ~/.vim/templates/man.html
|
||||
command Ttex :r ~/.vim/templates/general.tex
|
||||
command Tmit :r ~/.vim/templates/mit
|
||||
command Tuni :r ~/.vim/templates/uni
|
||||
|
||||
" run groff+refer on file
|
||||
:command Groff w|!sh -c 'p="%"; refer -PS -e -p ~/Documents/bib ${p::-4}.mom | groff -mom -Tpdf > ${p::-4}.pdf'
|
||||
|
|
2
.xinitrc
2
.xinitrc
|
@ -1,6 +1,8 @@
|
|||
|
||||
[ -f ~/.Xmodmap ] && xmodmap ~/.Xmodmap
|
||||
|
||||
source /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
|
||||
|
||||
export TERMINAL=kitty
|
||||
xrdb -load ~/.Xresources
|
||||
|
||||
|
|
11
.zshrc
11
.zshrc
|
@ -13,6 +13,7 @@ plot() { cat /dev/stdin > /tmp/plotuwu; gnuplot -p -e 'set object rectangle from
|
|||
smoothplot() { cat /dev/stdin > /tmp/plotuwu; gnuplot -p -e 'set object rectangle from screen 0,0 to screen 1,1 behind fillcolor rgb "black" fillstyle solid noborder; set border lw 3 lc rgb "white"; set xtics textcolor rgb "white"; set xlabel "X" textcolor rgb "white"; set ylabel "Y" textcolor rgb "white"; set key textcolor rgb "white"; plot for [col=1:'$1'] "/tmp/plotuwu" using 0:col smooth cspline title "'$3'" with '$2' lw 2 pt 7' ; }
|
||||
|
||||
calcpi() { echo "scale=$1; 16*a(1/5)-4*a(1/239)" | bc -l ; }
|
||||
vhsify() { ffmpeg -i "$1" -vf fps=24,scale="(iw*sar)*max(640/(iw*sar)\,480/ih):ih*max(640/(iw*sar)\,480/ih)",crop=640:480,setsar=1:1,convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2",curves="0/0 0.5/0.58 1/1",rgbashift=rh=-1:gh=1 -preset veryfast -c:a copy "$2" }
|
||||
|
||||
base58gen() { echo $(base64 /dev/urandom | tr -d "\n/+Il0O$2" | head -c ${$(($1/5.*8+1))%.*}) }
|
||||
|
||||
|
@ -20,6 +21,8 @@ alias hexcat="catgirl -h irc.libera.chat -n xfnwtest -ec cert.pem -u"
|
|||
|
||||
alias warc="wget -rpkm --warc-cdx --warc-file"
|
||||
alias ytdl="yt-dlp --extract-audio --audio-format mp3"
|
||||
alias ssk="ssh-keygen -l -f ~/.ssh/known_hosts | grep"
|
||||
alias qqemu="qemu-system-x86_64 -display gtk,zoom-to-fit=on -nic user -hdd"
|
||||
|
||||
alias sydi="sudo"
|
||||
|
||||
|
@ -2679,7 +2682,7 @@ function xtrename () {
|
|||
|
||||
|
||||
|
||||
zpst () { curl -F'file=@-' https://ttm.sh }
|
||||
zpst () { curl -F'file=@-' https://foxes.are.allowed.org }
|
||||
|
||||
# upload to ttm
|
||||
function zup () {
|
||||
|
@ -2703,7 +2706,7 @@ function zup () {
|
|||
print "curl is not available, but mandatory for ${PN}. Aborting."
|
||||
return 1
|
||||
fi
|
||||
api='https://ttm.sh/'
|
||||
api='https://foxes.are.allowed.org/'
|
||||
curl -F"file=@${url}" $api
|
||||
}
|
||||
|
||||
|
@ -2733,7 +2736,7 @@ function zpost () {
|
|||
print "curl is not available, but mandatory for ${PN}. Aborting."
|
||||
return 1
|
||||
fi
|
||||
api='https://ttm.sh/'
|
||||
api='https://foxes.are.allowed.org/'
|
||||
curl -F"url=${url}" $api
|
||||
}
|
||||
|
||||
|
@ -2766,7 +2769,7 @@ function zurl () {
|
|||
print "curl is not available, but mandatory for ${PN}. Aborting."
|
||||
return 1
|
||||
fi
|
||||
api='https://ttm.sh/'
|
||||
api='https://foxes.are.allowed.org/'
|
||||
curl -F"shorten=${url}" $api
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue