From 0ba449d8be26b047eea3b0b7e4ecdcba906f03f8 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 22 Sep 2021 12:33:10 +0200 Subject: [PATCH] Merge pull request #39 from ailin-nemui/sync run syncdocs.sh and syncscripts.sh (cherry picked from commit 85a9dc146d803be344bf3806395ac294d6929c13) --- docs/faq.html | 4 +- docs/faq.txt | 6 +- docs/startup-HOWTO.html | 4 +- docs/startup-HOWTO.txt | 4 +- scripts/quitmsg.pl | 27 +++----- scripts/scriptassist.pl | 139 +++++++++++++++++++++++++--------------- 6 files changed, 104 insertions(+), 80 deletions(-) diff --git a/docs/faq.html b/docs/faq.html index 7c17f45d..50b404a0 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -2,7 +2,7 @@

Frequently Asked Questions

Q: Why doesn’t irssi display colors even when ircii etc. displays them?

-

A: They force ANSI colors even if terminal doesn’t support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like xterm-color or color_xterm (eg. TERM=xterm-color irssi). If this doesn’t help, then use the evil way of /SET term_force_colors ON.

+

A: They force ANSI colors even if terminal doesn’t support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like xterm-256color or color_xterm (eg. TERM=xterm-256color irssi). If this doesn’t help, then use the evil way of /SET term_force_colors ON.

Q: How do I easily write text to channel that starts with ‘/’ character?

@@ -54,7 +54,7 @@

Q: Will there be /DETACH-like feature?

-

A: tmux, screen and dtach can be used to do it just fine.

+

A: tmux, screen and dtach can be used to do it just fine.

Q: How do I run scripts automatically at startup?

diff --git a/docs/faq.txt b/docs/faq.txt index 0d0b5f46..0fcc156a 100644 --- a/docs/faq.txt +++ b/docs/faq.txt @@ -4,8 +4,8 @@ Q: Why doesn’t irssi display colors even when ircii etc. displays them? A: They force ANSI colors even if terminal doesn’t support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like - xterm-color or color_xterm (eg. TERM=xterm-color irssi). If this doesn’t help, - then use the evil way of /SET term_force_colors ON. + xterm-256color or color_xterm (eg. TERM=xterm-256color irssi). If this doesn’t + help, then use the evil way of /SET term_force_colors ON. Q: How do I easily write text to channel that starts with ‘/’ character? A: / /text @@ -119,6 +119,6 @@ A: Check [6]here [1] https://github.com/irssi-import/xirssi [2] https://tmux.github.io/ [3] https://www.gnu.org/software/screen/screen.html - [4] http://dtach.sf.net/ + [4] https://sourceforge.net/projects/dtach/ [5] https://dgl.cx/irssi/hack-whois-in-current-window.pl [6] https://irssi.org/assets/irssi.wav diff --git a/docs/startup-HOWTO.html b/docs/startup-HOWTO.html index b0c68f1f..696dea4d 100644 --- a/docs/startup-HOWTO.html +++ b/docs/startup-HOWTO.html @@ -226,7 +226,7 @@ Ctrl-P, Ctrl-N - Jump to previous / next window

And finally channels:

-
/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet
+
/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet
 /CHANNEL ADD -auto #secret IRCnet password
 
@@ -395,7 +395,7 @@ Ctrl-X - set the next server in list active

/HELP bind tells pretty much everything there is to know about keyboard bindings. However, there’s the problem of how to bind some non-standard keys. They might differ a bit with each terminal, so you’ll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in cat. Here’s an example for pressing F1 key:

-
 [user@host] ~% cat
+
 [cras@hurina] ~% cat
  ^[OP
 
diff --git a/docs/startup-HOWTO.txt b/docs/startup-HOWTO.txt index bff33108..90d278de 100644 --- a/docs/startup-HOWTO.txt +++ b/docs/startup-HOWTO.txt @@ -218,7 +218,7 @@ IRC network, other servers are automatically connected in same network if the And finally channels: -/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet +/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet /CHANNEL ADD -auto #secret IRCnet password -bots and -botcmd should be the only ones needing a bit of explaining. They’re @@ -442,7 +442,7 @@ They might differ a bit with each terminal, so you’ll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in cat. Here’s an example for pressing F1 key: - [user@host] ~% cat + [cras@hurina] ~% cat ^[OP So in irssi you would use /BIND ^[OP /ECHO F1 pressed. If you use multiple diff --git a/scripts/quitmsg.pl b/scripts/quitmsg.pl index e289468c..102d9aa5 100644 --- a/scripts/quitmsg.pl +++ b/scripts/quitmsg.pl @@ -6,36 +6,27 @@ use Irssi::Irc; use strict; use vars qw($VERSION %IRSSI); -$VERSION = "1.00"; +$VERSION = "1.01"; %IRSSI = ( authors => 'Timo Sirainen', name => 'quitmsg', description => 'Random quit messages', license => 'Public Domain', - changed => 'Sun Mar 10 23:18 EET 2002' + changed => 'Mon Jul 22 20:00 EET 2020' ); -my $quitfile = glob "~/.irssi/irssi.quit"; +my $quitfile = Irssi::get_irssi_dir() . "/irssi.quit"; sub cmd_quit { my ($data, $server, $channel) = @_; return if ($data ne ""); + + open (my $fh, "<", $quitfile) || return; + my @lines = <$fh>; - open (f, "<", $quitfile) || return; - my $lines = 0; while() { $lines++; }; - - my $line = int(rand($lines))+1; - - my $quitmsg; - seek(f, 0, 0); $. = 0; - while() { - next if ($. != $line); - - chomp; - $quitmsg = $_; - last; - } - close(f); + my $quitmsg = $lines[int(rand(@lines))]; + chomp($quitmsg); + close($fh); foreach my $server (Irssi::servers) { $server->command("/disconnect ".$server->{tag}." $quitmsg"); diff --git a/scripts/scriptassist.pl b/scripts/scriptassist.pl index 536ef33a..cf02d57e 100644 --- a/scripts/scriptassist.pl +++ b/scripts/scriptassist.pl @@ -5,7 +5,7 @@ use strict; -our $VERSION = '2003020807'; +our $VERSION = '2020042700'; our %IRSSI = ( authors => 'Stefan \'tommie\' Tomanek', contact => 'stefan@pico.ruhr.de', @@ -23,12 +23,15 @@ use Irssi 20020324; use CPAN::Meta::YAML; use LWP::UserAgent; use POSIX; +use version; # GnuPG is not always needed $have_gpg = 0; eval "use GnuPG qw(:algo :trust);"; $have_gpg = 1 if not ($@); +my $irssi_version = qv(Irssi::parse_special('v$J') =~ s/-.*//r); + sub show_help { my $help = "scriptassist $VERSION /scriptassist check @@ -39,15 +42,15 @@ sub show_help { Search the script database /scriptassist info Display information about -".#/scriptassist ratings -# Retrieve the average ratings of the the scripts -#/scriptassist top -# Retrieve the first top rated scripts -"/scriptassist new +/scriptassist ratings + Retrieve the average ratings of the the scripts +/scriptassist top + Retrieve the first top rated scripts +/scriptassist new Display the newest scripts -".#/scriptassist rate