1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-30 06:45:25 +00:00

Merge tag '1.3.2-an' into HEAD

This commit is contained in:
Ailin Nemui 2022-01-21 13:37:41 +01:00
commit 2e6375d4ff
25 changed files with 260 additions and 182 deletions

View File

@ -18,7 +18,7 @@ jobs:
steps:
- name: prepare required software
run: |
sudo apt install $apt_build_deps $apt_build_deps_autotools
sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_autotools
- uses: actions/checkout@main
- name: make dist
run: |
@ -38,18 +38,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-latest]
os: [ubuntu-18.04, ubuntu-latest]
builder: [meson, configure]
compiler: [clang, gcc]
flags: [regular]
include:
- os: ubuntu-16.04
- os: ubuntu-18.04
builder: meson
meson_ver: ==0.49.2
setuptools_ver: <51
- os: ubuntu-latest
builder: meson
meson_ver: <0.59.0
meson_ver: <0.60.0
- os: ubuntu-latest
builder: meson
flags: meson-latest FAILURE-OK
@ -64,7 +64,7 @@ jobs:
meson_ver: ${{ matrix.meson_ver }}
setuptools_ver: ${{ matrix.setuptools_ver }}
run: |
sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }}
sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }}
eval "$get_pip_build_deps_${{ matrix.builder }}"
curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl
- name: unpack archive

50
NEWS
View File

@ -1,10 +1,23 @@
v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
* /SET resolve_reverse_lookup setting was removed (#1135)
v1.3.2-an 2022-01-14 Ailin Nemui <Nei>
- CHANTYPES take precedence over (missing) STATUSMSG in /join
(#1358, an#54)
- Fix crash in Perl's $view->set_bookmark (freebsd#254237,
an#56)
v1.3.1-an 2021-12-17 Ailin Nemui <Nei>
- Minor help fixes (an#51, an#52)
- Fix regression where own channel status was forgotten after
/UPGRADE (#1357, an#53)
v1.3.0-an 2021-11-11 Ailin Nemui <Nei>
* /SET resolve_reverse_lookup setting was removed (#1034,
#1135)
* Irssi will try to connect on IPv4 if IPv6 connection failed
(#1146). By Shivaram Lingamneni
* The display system now renders formats on the fly (#1079,
#1188, #1191, #1192, #1204, #1205, #1209, an#13, an#14, an#28,
an#29)
#1188, #1191, #1192, #1204, #1205, #1209, #1349, #1355,
an#13, an#14, an#28, an#29, an#36, an#37, an#49)
This major change will break scripts that try to modify
printed text during "print text" signal (#1189). They need
@ -38,7 +51,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
/SET show_names_on_join_limit -1
* -tls_verify is now enabled by default (#1170, an#18, #1309,
an#23)
an#23, #1343, #1351)
This may cause an ugly display of notls_verify in the output
of /SERVER LIST, even on plain-text connection, on old
@ -127,21 +140,24 @@ v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
join_extended_account, that theme writers need to take into
account if desired.
+ Add support for IRCv3 setname (#1093, #1104, #1254, GL#33,
#1104, #1254)
+ Add support for IRCv3 setname (#1093, #1104, #1254, GL#33)
+ Add support for IRCv3 account-notify (#1100, #1098, GL#33,
#1105, #1131). Credit to oss-fuzz
/SET show_account_notify to enable
+ Add support for IRCv3 invite-notify (#1094)
+ Add support for receiving IRCv3 message-tags (#576, #1090)
+ Add support for sending IRCv3 message-tags (#1092)
+ Add support for the oragono.io/maxline-2 CAP to increase IRC
protocol line length (#1092)
+ Add support for sending IRCv3 message-tags (#1092, an#34)
+ Enable the znc.in/self-message CAP by default (#1123)
+ Add support for IRCv3 away-notify. /SET away_notify_public
to enable (#1099, GL#33, #1105)
+ Add support for IRCv3 chghost (#1096, GL#33, #1105)
+ Add support for IRCv3 account-notify.
For servers with broken chghost implementation that fill the
status window with host changed messages, one may add "quote
cap req -chghost" to the -autosendcmd or, if the host change
messages are entirely undesired, "/format -delete
host_changed"
+ Add support for IRCv3 server-time. /SET show_server_time to
enable (#1108)
+ Add support for logging IRCv3 server-time.
@ -183,7 +199,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
+ Allow -tls_ca{file,path} '' to unset an argument (#730,
#1060, an#30)
+ Add a "server outgoing modify" signal to intercept outgoing
messages (#1148, #1151, an#15). Original by
messages (#1148, #1151, an#15, an#43). Original by
JustAnotherArchivist
- remove some hard-coded 510 byte assumptions (#1086)
- Several fixes for error checks in SSL (#944, #1037, #943,
@ -207,7 +223,7 @@ v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
#891, #1129). By Dan Collins
- Fix /IGNORE not setting the right level in irc_op_public
messages (#1280). Credit to oss-fuzz
- Fix GTimeVal deprecation (#1141, #1144, #1145)
- Fix GTimeVal deprecation (#1141, #1144, #1145, #1350, an#44)
If multi-version compatibility is desired, module authors
can find an example of backwards compatible code in
@ -241,12 +257,13 @@ v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
- Fix /SERVER ADD -matrix -network my_matrix_network
(an#12). By Andrej Kacian
- Fix /SERVER ADD creating duplicated entries in the config
file (#1317, an#22)
file (#1317, an#22, an#41)
- Fix critical when SASL user is set and SASL password is
empty (#1325, an#21)
- Misc fixes (#1106, #1141, #1272, #1297)
- Misc fixes (#1106, #1141, #1272, #1297, an#35)
- Fuzz fixes (#1116, #1117, #1119, #1125, #1126, an#20)
- Build system fixes (#1101, #1102, #1069, #1140, #1181, #1253)
- Sync docs and scripts (an#39)
- Text and Help updates
- add -tls_* options to manual (#1029, #1030). By Jacob
V. Rasmussen
@ -262,9 +279,10 @@ v1.3.0-an 2021-09-05 Ailin Nemui <Nei>
- Add documentation for escaping some characters (#1329,
#1330, an#9). By Guntbert Reiter
- Fix some typos (#1336, an#10). By Francis Mteo
- Document $abiversion and parse_special (an#38). By bw1
- Infrastructure updates:
- Support for Github Actions (#1039, #1103, #1160, #1212,
#1231, #1252, #1261)
#1231, #1252, #1261, an#40)
- Run clang-format on pull requests (#1172, #1173, #1184,
#1230, #1247, #1287)
- Run abidiff on pull requests (#1179, #1195)

View File

@ -1,4 +1,4 @@
AC_INIT(irssi, 1.3-head)
AC_INIT(irssi, 1.3.2-an)
AC_CONFIG_SRCDIR([src])
AC_CONFIG_AUX_DIR(build-aux)
AC_PREREQ(2.50)

View File

@ -2,7 +2,7 @@
<h1>Frequently Asked Questions</h1>
<h3 id="q-why-doesnt-irssi-display-colors-even-when-ircii-etc-displays-them">Q: Why doesnt irssi display colors even when ircii etc. displays them?</h3>
<p>A: They force ANSI colors even if terminal doesnt 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. <code>TERM=xterm-color irssi</code>). If this doesnt help, then use the evil way of <code>/SET term_force_colors ON</code>.</p>
<p>A: They force ANSI colors even if terminal doesnt 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. <code>TERM=xterm-256color irssi</code>). If this doesnt help, then use the evil way of <code>/SET term_force_colors ON</code>.</p>
<h3 id="q-how-do-i-easily-write-text-to-channel-that-starts-with--character">Q: How do I easily write text to channel that starts with / character?</h3>
@ -54,7 +54,7 @@
<h3 id="q-will-there-be-detach-like-feature">Q: Will there be /DETACH-like feature?</h3>
<p>A: <a href="https://tmux.github.io/">tmux</a>, <a href="https://www.gnu.org/software/screen/screen.html">screen</a> and <a href="http://dtach.sf.net/">dtach</a> can be used to do it just fine.</p>
<p>A: <a href="https://tmux.github.io/">tmux</a>, <a href="https://www.gnu.org/software/screen/screen.html">screen</a> and <a href="https://sourceforge.net/projects/dtach/">dtach</a> can be used to do it just fine.</p>
<h3 id="q-how-do-i-run-scripts-automatically-at-startup">Q: How do I run scripts automatically at startup?</h3>

View File

@ -4,8 +4,8 @@ Q: Why doesnt irssi display colors even when ircii etc. displays them?
A: They force ANSI colors even if terminal doesnt 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 doesnt help,
then use the evil way of /SET term_force_colors ON.
xterm-256color or color_xterm (eg. TERM=xterm-256color irssi). If this doesnt
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

View File

@ -5,7 +5,7 @@
%9Parameters:%9
LIST: Displays the list of servers you are connected to.
LIST: Displays the list of servers you have configured.
CONNECT: Connects to the given server.
ADD: Adds a server to your configuration.
MODIFY: Modifies a server in your configuration.
@ -51,10 +51,9 @@
When using the ADD parameter on a server that already exists, the
configuration will be merged with each other.
When using the command without any of the given parameters, it will
connect to the specified server; the server in the active window will be
disconnected unless you prepend the server with the '+' character; the same
method is applicable to the CONNECT parameter.
When using the CONNECT parameter, it will connect to the specified
server; the server in the active window will be disconnected
unless you prepend the server with the '+' character.
Specify '-' as password to remove a server password

View File

@ -151,7 +151,7 @@ irc.c:
"whois default event", SERVER_REC, char *args, char *sender_nick, char *sender_address
"server incoming", SERVER_REC, char *data
"server outgoing modify", SERVER_REC, GString *data
"server outgoing modify", SERVER_REC, GString *data, int crlf
(for perl parser..)
"redir "<cmd>, SERVER_REC, char *args, char *sender_nick, char *sender_address

View File

@ -226,7 +226,7 @@ Ctrl-P, Ctrl-N - Jump to previous / next window
<p>And finally channels:</p>
<div><div><pre><code>/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet
<div><div><pre><code>/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet
/CHANNEL ADD -auto #secret IRCnet password
</code></pre></div></div>
@ -395,7 +395,7 @@ Ctrl-X - set the next server in list active
<p><code>/HELP bind</code> tells pretty much everything there is to know about keyboard bindings. However, theres the problem of how to bind some non-standard keys. They might differ a bit with each terminal, so youll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in <code>cat</code>. Heres an example for pressing F1 key:</p>
<div><div><pre><code> [user@host] ~% cat
<div><div><pre><code> [cras@hurina] ~% cat
^[OP
</code></pre></div></div>

View File

@ -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. Theyre
@ -442,7 +442,7 @@ They might differ a bit with each terminal, so youll need to find out what
exactly the keypress produces. Easiest way to check that would be to see what
it prints in cat. Heres 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

View File

@ -1,5 +1,5 @@
project('irssi', 'c',
version : '1.3-head',
version : '1.3.2-an',
meson_version : '>=0.49',
default_options : ['warning_level=1'])

View File

@ -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(<f>) { $lines++; };
my $line = int(rand($lines))+1;
my $quitmsg;
seek(f, 0, 0); $. = 0;
while(<f>) {
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");

View File

@ -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 <scripts>
Display information about <scripts>
".#/scriptassist ratings <scripts>
# Retrieve the average ratings of the the scripts
#/scriptassist top <num>
# Retrieve the first <num> top rated scripts
"/scriptassist new <num>
/scriptassist ratings <scripts|all>
Retrieve the average ratings of the the scripts
/scriptassist top <num>
Retrieve the first <num> top rated scripts
/scriptassist new <num>
Display the newest <num> scripts
".#/scriptassist rate <script> <stars>
# Rate the script with a number of stars ranging from 0-5
"/scriptassist contact <script>
/scriptassist rate <script>
Rate the script if you like it
/scriptassist contact <script>
Write an email to the author of the script
(Requires OpenURL)
/scriptassist cpan <module>
@ -95,6 +98,7 @@ sub call_openurl {
$code->($url);
} else {
print CLIENTCRAP "%R>>%n Please install openurl.pl";
print CLIENTCRAP "%R>>%n or open < $url > manually";
}
}
@ -188,7 +192,7 @@ sub get_unknown {
foreach (keys %$db) {
next unless defined $db->{$_}{commands};
foreach my $item (split / /, $db->{$_}{commands}) {
return { $_ => $db->{$_} } if ($item =~ /^$cmd$/i);
return { $_ => +{%{$db->{$_}}} } if ($item =~ /^$cmd$/i);
}
}
return undef;
@ -264,47 +268,80 @@ sub script_info {
$result{$sname}{modules}{$mod}{installed} = module_exist($mod);
}
}
if (defined $xml->{$plname}{depends}) {
my $depends = $xml->{$plname}{depends};
foreach my $dep (split(/ /, $depends)) {
$result{$sname}{depends}{$dep}{installed} = 1;
}
}
# if (defined $xml->{$plname}{depends}) {
# my $depends = $xml->{$plname}{depends};
# foreach my $dep (split(/ /, $depends)) {
# $result{$sname}{depends}{$dep}{installed} = 1; #(defined ${ 'Irssi::Script::'.$dep });
# }
# }
}
return \%result;
}
sub get_rate_url {
my ($src) = @_;
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.$VERSION);
my $request = HTTP::Request->new('GET', $src);
my $response = $ua->request($request);
unless ($response->is_success) {
my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
die("Fetching ratings location failed: $error");
}
my $votes_url;
for my $tag ($response->content() =~ /<script([^>]*)>/g) {
my $attr = " $tag ";
($votes_url = $1) =~ s/\.\w+$/.yml/
if $attr =~ /\sasync\s/ && $attr =~ m{\ssrc="(https?://.*?/votes\.\w+)"\s};
}
unless ($votes_url) {
die("Fetching ratings failed: Could not find votes script\n");
}
$request = HTTP::Request->new('GET', $votes_url);
$response = $ua->request($request);
if (!$response->is_success) {
my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
die("Fetching ratings failed: $error");
}
my $data = $response->content();
utf8::decode($data);
CPAN::Meta::YAML->read_string($data)->[0];
}
sub rate_script {
my ($script, $stars) = @_;
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.2003020803);
my $request = HTTP::Request->new('GET', 'http://ratings.irssi.de/irssirate.pl?&stars='.$stars.'&mode=rate&script='.$script);
my $response = $ua->request($request);
unless ($response->is_success() && $response->content() =~ /You already rated this script/) {
return 1;
} else {
return 0;
}
my $xml = get_scripts();
my $votes = get_rate_url(map { $_->{source} } values %$xml);
my ($sname, $plname, $pname) = get_names($script, $xml);
die "Script $script not found\n" unless $votes->{$plname};
return $votes->{$plname}{u}
}
sub get_ratings {
my ($scripts, $limit) = @_;
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.2003020803);
my $script = join(',', @{$scripts});
my $request = HTTP::Request->new('GET', 'http://ratings.irssi.de/irssirate.pl?script='.$script.'&sort=rating&limit='.$limit);
my $response = $ua->request($request);
my %result;
if ($response->is_success()) {
foreach (split /\n/, $response->content()) {
if (/<tr><td><a href=".*?">(.*?)<\/a>/) {
my $entry = $1;
if (/"><\/td><td>([0-9.]+)<\/td><td>(.*?)<\/td><td>/) {
$result{$entry} = [$1, $2];
}
}
my $xml = get_scripts();
my $votes = get_rate_url(map { $_->{source} } values %$xml);
foreach (keys %{$votes}) {
if ($xml->{$_}) {
$xml->{$_}{votes} = $votes->{$_}{v};
}
}
my %result;
if (@{$scripts}) {
foreach (@{$scripts}) {
my ($sname, $plname, $pname) = get_names($_, $xml);
next unless (defined $xml->{$plname} || ( exists $Irssi::Script::{$pname} && exists $Irssi::Script::{$pname}{IRSSI} ));
$result{$plname} = [$xml->{$plname}{votes}];
}
} else {
my @keys = sort { $xml->{$b}{votes} <=> $xml->{$a}{votes}
|| $xml->{$b}{modified} cmp $xml->{$a}{modified} }
grep { !$xml->{$_}{HIDDEN} && $xml->{$_}{votes} ne '' } keys %$xml;
foreach (splice @keys, 0, $limit) {
$result{$_} = [$xml->{$_}{votes}];
}
}
die "No such script found\n" unless keys %result;
return \%result;
}
@ -597,13 +634,8 @@ sub print_rate {
my (%data) = @_;
my $line;
foreach my $script (sort keys(%data)) {
if ($data{$script}) {
$line .= "%go%n %9".$script."%9 has been rated";
} else {
$line .= "%ro%n %9".$script."%9 : Already rated this script";
}
call_openurl($data{$script});
}
print CLIENTCRAP draw_box('ScriptAssist', $line, 'rating', 1) ;
}
sub print_ratings {
@ -617,8 +649,7 @@ sub print_ratings {
push @line, "%yo%n";
}
push @line, "%9".$script."%9";
push @line, $data{$script}{rating};
push @line, "[".$data{$script}{votes}." votes]";
push @line, "[".(length $data{$script}{rating} ? $data{$script}{rating} : 'no')." votes]";
push @table, \@line;
}
print CLIENTCRAP draw_box('ScriptAssist', array2table(@table), 'ratings', 1) ;
@ -845,7 +876,8 @@ sub get_scripts {
}
$fetched = 1;
my $data = $response->content();
my ($src, $type);
my $src = $site;
my $type = '';
if ($site =~ /(.*\/).+\.(.+)/) {
$src = $1;
$type = $2;
@ -1115,9 +1147,9 @@ sub cmd_scripassist {
} elsif ($args[0] eq 'ratings' && defined $args[1]) {
shift @args;
bg_do("ratings ".join(' ', @args));
} elsif ($args[0] eq 'rate' && defined $args[1] && defined $args[2]) {
} elsif ($args[0] eq 'rate' && defined $args[1]) {
shift @args;
bg_do("rate ".join(' ', @args)) if ($args[2] >= 0 && $args[2] < 6);
bg_do("rate ".join(' ', @args));
} elsif ($args[0] eq 'info' && defined $args[1]) {
shift @args;
bg_do("info ".join(' ', @args));
@ -1158,6 +1190,7 @@ sub sig_command_script_load {
sub sig_default_command {
my ($cmd, $server) = @_;
return unless Irssi::settings_get_bool("scriptassist_check_unknown_commands");
return if ($cmd =~ /^\d+$/ && $irssi_version >= v1.2.0 && Irssi::settings_get_bool("window_number_commands"));
bg_do('unknown '.$cmd);
}
@ -1213,11 +1246,11 @@ foreach my $cmd ( ( 'check',
'search',
# '-h',
'help',
# 'ratings',
# 'rate',
'ratings',
'rate',
'info',
# 'echo',
# 'top',
'top',
'cpan',
'autorun',
'new' ) ) {

View File

@ -322,7 +322,7 @@ static char *expando_last_invite(SERVER_REC *server, void *item, int *free_ret)
/* client version text string */
static char *expando_version(SERVER_REC *server, void *item, int *free_ret)
{
return PACKAGE_VERSION "-an";
return PACKAGE_VERSION;
}
/* current value of CMDCHARS */

View File

@ -42,7 +42,7 @@ enum {
MSGLEVEL_HIDDEN = 0x10000000, /* Hidden from view */
MSGLEVEL_RESERVED1 = 0x20000000,
MSGLEVEL_RESERVED2 = 0x40000000,
MSGLEVEL_FORMAT = 0x80000000 /* Format data */
MSGLEVEL_FORMAT = (int)0x80000000 /* Format data */
};
/* clang-format on */

View File

@ -124,17 +124,17 @@ static void cmd_server_add_modify(const char *data, gboolean add)
port = old_port = -1;
if (*portstr != '\0')
port = add_port = atoi(portstr);
value = g_hash_table_lookup(optlist, "port");
if (value != NULL && *value != '\0')
port = add_port = atoi(value);
else if (g_hash_table_lookup(optlist, "tls") ||
g_hash_table_lookup(optlist, "ssl"))
add_port = DEFAULT_SERVER_ADD_TLS_PORT;
else
add_port = DEFAULT_SERVER_ADD_PORT;
value = g_hash_table_lookup(optlist, "port");
if (value != NULL && *value != '\0')
old_port = atoi(value);
if (*portstr != '\0')
old_port = atoi(portstr);
chatnet = g_hash_table_lookup(optlist, "network");
@ -307,12 +307,14 @@ static void cmd_server_remove(const char *data)
SERVER_SETUP_REC *rec;
char *addr, *port, *chatnet;
void *free_arg;
int portnum;
if (!cmd_get_params(data, &free_arg, 3, &addr, &port, &chatnet))
return;
if (*addr == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*port == '\0') {
portnum = DEFAULT_SERVER_ADD_PORT;
if (*chatnet == '\0')
rec = server_setup_find(addr, -1, NULL);
else
@ -320,17 +322,21 @@ static void cmd_server_remove(const char *data)
}
else
{
portnum = atoi(port);
if (*chatnet == '\0')
rec = server_setup_find(addr, atoi(port), NULL);
rec = server_setup_find(addr, portnum, NULL);
else
rec = server_setup_find(addr, atoi(port), chatnet);
rec = server_setup_find(addr, portnum, chatnet);
}
if (rec == NULL)
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_NOT_FOUND, addr, port);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_NOT_FOUND, addr,
portnum);
else {
portnum = rec->port;
server_setup_remove(rec);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_REMOVED, addr, port);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_SETUPSERVER_REMOVED, addr,
portnum);
}
cmd_params_free(free_arg);

View File

@ -22,6 +22,7 @@
#include <irssi/src/fe-common/core/formats.h>
FORMAT_REC fecommon_core_formats[] = {
/* clang-format off */
{ MODULE_NAME, "Core", 0 },
/* ---- */
@ -87,8 +88,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "server_reconnect_removed", "Removed reconnection to server {server $0} port {hilight $1}", 3, { 0, 1, 0 } },
{ "server_reconnect_not_found", "Reconnection tag {server $0} not found", 1, { 0 } },
{ "setupserver_added", "Server {server $0} saved", 2, { 0, 1 } },
{ "setupserver_removed", "Server {server $0} removed", 2, { 0, 1 } },
{ "setupserver_not_found", "Server {server $0} not found", 2, { 0, 1 } },
{ "setupserver_removed", "Server {server $0} {hilight $1} removed", 2, { 0, 1 } },
{ "setupserver_not_found", "Server {server $0} {hilight $1} not found", 2, { 0, 1 } },
{ "your_nick", "Your nickname is {nick $0}", 1, { 0 } },
/* ---- */
@ -316,4 +317,5 @@ FORMAT_REC fecommon_core_formats[] = {
{ "tls_protocol_version", "Protocol: {hilight $0} ({hilight $1} bit, {hilight $2})", 3, { 0, 1, 0 } },
{ NULL, NULL, 0 }
/* clang-format on */
};

View File

@ -265,7 +265,7 @@ static void sig_gui_print_text_finished(WINDOW_REC *window, TEXT_DEST_REC *dest)
info->meta = line_meta_create(dest->meta);
info->level |= MSGLEVEL_FORMAT;
info->level = dest->level | MSGLEVEL_FORMAT;
/* the line will be inserted into the view with textbuffer_view_insert_line by
gui-printtext.c:view_add_eol */

View File

@ -63,6 +63,20 @@ IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server, const char *name,
#define get_join_key(key) \
(((key) == NULL || *(key) == '\0') ? "x" : (key))
static char *force_channel_name(IRC_SERVER_REC *server, const char *name)
{
char *chantypes;
if (server_ischannel(SERVER(server), name))
return g_strdup(name);
chantypes = g_hash_table_lookup(server->isupport, "chantypes");
if (chantypes == NULL || *chantypes == '\0')
chantypes = "#";
return g_strdup_printf("%c%s", *chantypes, name);
}
static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
int automatic)
{
@ -99,8 +113,7 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
tmp = chanlist;
for (;; tmp++) {
if (*tmp != NULL) {
channel = server_ischannel(SERVER(server), *tmp) ? g_strdup(*tmp) :
g_strdup_printf("#%s", *tmp);
channel = force_channel_name(server, *tmp);
chanrec = irc_channel_find(server, channel);
if (chanrec == NULL) {
@ -170,17 +183,14 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
}
/* function for finding IRC channels - adds support for !channels */
static CHANNEL_REC *irc_channel_find_server(SERVER_REC *server,
const char *channel)
static CHANNEL_REC *irc_channel_find_server(IRC_SERVER_REC *server, const char *channel)
{
GSList *tmp;
char *fmt_channel;
/* if 'channel' has no leading # this lookup is going to fail, add a
* octothorpe in front of it to handle this case. */
fmt_channel = server_ischannel(SERVER(server), channel) ?
g_strdup(channel) :
g_strdup_printf("#%s", channel);
fmt_channel = force_channel_name(server, channel);
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
CHANNEL_REC *rec = tmp->data;
@ -189,12 +199,12 @@ static CHANNEL_REC *irc_channel_find_server(SERVER_REC *server,
continue;
/* check both !ABCDEchannel and !channel */
if (IRC_SERVER(server)->nick_comp_func(fmt_channel, rec->name) == 0) {
if (server->nick_comp_func(fmt_channel, rec->name) == 0) {
g_free(fmt_channel);
return rec;
}
if (IRC_SERVER(server)->nick_comp_func(fmt_channel, rec->visible_name) == 0) {
if (server->nick_comp_func(fmt_channel, rec->visible_name) == 0) {
g_free(fmt_channel);
return rec;
}
@ -210,7 +220,8 @@ static void sig_server_connected(SERVER_REC *server)
if (!IS_IRC_SERVER(server))
return;
server->channel_find_func = irc_channel_find_server;
server->channel_find_func =
(CHANNEL_REC * (*) (SERVER_REC *, const char *) ) irc_channel_find_server;
server->channels_join = (void (*) (SERVER_REC *, const char *, int))
irc_channels_join;
}

View File

@ -84,10 +84,11 @@ static int ischannel_func(SERVER_REC *server, const char *data)
chantypes = "#&!+"; /* normal, local, secure, modeless */
statusmsg = g_hash_table_lookup(irc_server->isupport, "statusmsg");
if (statusmsg == NULL)
if (statusmsg == NULL && strchr(chantypes, '@') == NULL)
statusmsg = "@";
data += strspn(data, statusmsg);
if (statusmsg != NULL)
data += strspn(data, statusmsg);
/* strchr(3) considers the trailing NUL as part of the string, make sure
* we didn't advance too much. */
@ -282,7 +283,6 @@ static void server_init_1(IRC_SERVER_REC *server)
irc_cap_toggle(server, CAP_SASL, TRUE);
}
irc_cap_toggle(server, CAP_MAXLINE, TRUE);
irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE);
irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE);
irc_cap_toggle(server, CAP_SETNAME, TRUE);
@ -647,24 +647,6 @@ static void sig_server_quit(IRC_SERVER_REC *server, const char *msg)
g_free(recoded);
}
static void cap_maxline(IRC_SERVER_REC *server)
{
unsigned int maxline = 0;
gboolean parse_successful = FALSE;
const char *maxline_str;
maxline_str = g_hash_table_lookup(server->cap_supported, CAP_MAXLINE);
if (maxline_str != NULL) {
parse_successful = parse_uint(maxline_str, NULL, 10, &maxline);
}
if (parse_successful &&
maxline >= MAX_IRC_MESSAGE_LEN + 2 /* 2 bytes for CR+LF */) {
server->max_message_len = maxline - 2;
}
}
void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const char *data)
{
char *recoded;
@ -737,6 +719,7 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
GString *str;
long usecs;
char *cmd;
int crlf;
if (!IS_IRC_SERVER(server))
return 0;
@ -760,15 +743,29 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
/* send command */
str = g_string_new(cmd);
signal_emit("server outgoing modify", 2, server, str);
if (str->len > 2 && str->str[str->len - 2] == '\r')
crlf = 2;
else if (str->len > 1 && str->str[str->len - 1] == '\n')
crlf = 1;
else
crlf = 0;
if (crlf)
g_string_truncate(str, str->len - crlf);
signal_emit("server outgoing modify", 3, server, str, crlf);
if (str->len) {
if (crlf == 2)
g_string_append(str, "\r\n");
else if (crlf == 1)
g_string_append(str, "\n");
irc_server_send_data(server, str->str, str->len);
/* add to rawlog without [CR+]LF */
if (str->len > 2 && str->str[str->len - 2] == '\r')
str->str[str->len - 2] = '\0';
else if (str->str[str->len - 1] == '\n')
str->str[str->len - 1] = '\0';
if (crlf)
g_string_truncate(str, str->len - crlf);
rawlog_output(server->rawlog, str->str);
server_redirect_command(server, str->str, redirect);
}
@ -1226,7 +1223,6 @@ void irc_servers_init(void)
signal_add_first("server disconnected", (SIGNAL_FUNC) sig_disconnected);
signal_add_last("server destroyed", (SIGNAL_FUNC) sig_destroyed);
signal_add_last("server quit", (SIGNAL_FUNC) sig_server_quit);
signal_add("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline);
signal_add("event 670", (SIGNAL_FUNC) event_starttls);
signal_add("event 451", (SIGNAL_FUNC) event_registerfirst);
signal_add("server cap end", (SIGNAL_FUNC) event_capend);
@ -1258,7 +1254,6 @@ void irc_servers_deinit(void)
signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
signal_remove("server destroyed", (SIGNAL_FUNC) sig_destroyed);
signal_remove("server quit", (SIGNAL_FUNC) sig_server_quit);
signal_remove("server cap ack " CAP_MAXLINE, (SIGNAL_FUNC) cap_maxline);
signal_remove("event 670", (SIGNAL_FUNC) event_starttls);
signal_remove("event 451", (SIGNAL_FUNC) event_registerfirst);
signal_remove("server cap end", (SIGNAL_FUNC) event_capend);

View File

@ -15,7 +15,6 @@
#define MAX_IRC_USER_TAGS_LEN 4094
#define CAP_LS_VERSION "302"
#define CAP_MAXLINE "oragono.io/maxline-2"
#define CAP_MESSAGE_TAGS "message-tags"
#define CAP_SASL "sasl"
#define CAP_MULTI_PREFIX "multi-prefix"

View File

@ -115,20 +115,34 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe
if (!raw) {
/* Add CR+LF to command */
g_string_append_c(str, 13);
g_string_append_c(str, 10);
g_string_append(str, "\r\n");
}
if (irc_send_when == IRC_SEND_NOW) {
signal_emit("server outgoing modify", 2, server, str);
int crlf;
if (str->len > 2 && str->str[str->len - 2] == '\r')
crlf = 2;
else if (str->len > 1 && str->str[str->len - 1] == '\n')
crlf = 1;
else
crlf = 0;
if (crlf)
g_string_truncate(str, str->len - crlf);
signal_emit("server outgoing modify", 3, server, str, crlf);
if (str->len) {
if (crlf == 2)
g_string_append(str, "\r\n");
else if (crlf == 1)
g_string_append(str, "\n");
irc_server_send_data(server, str->str, str->len);
/* add to rawlog without [CR+]LF */
if (str->len > 2 && str->str[str->len - 2] == '\r')
str->str[str->len - 2] = '\0';
else if (str->str[str->len - 1] == '\n')
str->str[str->len - 1] = '\0';
if (crlf)
g_string_truncate(str, str->len - crlf);
rawlog_output(server->rawlog, str->str);
server_redirect_command(server, str->str, server->redirect_next);
}

View File

@ -104,7 +104,7 @@ static int sig_check_lag(void)
if (rec->lag_sent != 0) {
/* waiting for lag reply */
if (max_lag > 1 && now - rec->lag_sent > max_lag * G_TIME_SPAN_SECOND) {
if (max_lag > 1 && now - (rec->lag_sent / G_TIME_SPAN_SECOND) > max_lag) {
/* too much lag, disconnect */
signal_emit("server lag disconnect", 1, rec);
rec->connection_lost = TRUE;

View File

@ -43,13 +43,6 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
g_return_if_fail(data != NULL);
if (g_ascii_strcasecmp(nick, server->nick) == 0) {
/* You joined, do not massjoin */
send_massjoin = FALSE;
} else {
send_massjoin = TRUE;
}
params = event_get_params(data, 3, &channel, &account, &realname);
ptr = strchr(channel, 7); /* ^G does something weird.. */
@ -62,6 +55,19 @@ static void event_join(IRC_SERVER_REC *server, const char *data,
return;
}
if (g_ascii_strcasecmp(nick, server->nick) == 0) {
/* do not overwrite our /UPGRADEd ownnick */
if (chanrec->session_rejoin) {
g_free(params);
return;
} else {
/* You joined, do not massjoin */
send_massjoin = FALSE;
}
} else {
send_massjoin = TRUE;
}
/* check that the nick isn't already in nicklist. seems to happen
sometimes (server desyncs or something?) */
nickrec = nicklist_find(CHANNEL(chanrec), nick);

View File

@ -318,13 +318,17 @@ void dcc_chat_input(CHAT_DCC_REC *dcc)
}
if (ret > 0) {
SERVER_REC *server;
char *recoded;
dcc->transfd += ret;
recoded = recode_in(SERVER(dcc->server), str, dcc->nick);
server = SERVER(dcc->server);
recoded = recode_in(server, str, dcc->nick);
signal_emit("dcc chat message", 2, dcc, recoded);
g_free(recoded);
if (server != NULL)
server_meta_clear_all(server);
}
} while (ret > 0);
}

View File

@ -49,14 +49,14 @@ textbuffer_view_scroll_line(view, line)
Irssi::TextUI::TextBufferView view
Irssi::TextUI::Line line
CODE:
textbuffer_view_scroll_line(view, line->line);
textbuffer_view_scroll_line(view, Line(line));
Irssi::TextUI::LineCache
textbuffer_view_get_line_cache(view, line)
Irssi::TextUI::TextBufferView view
Irssi::TextUI::Line line
CODE:
RETVAL = textbuffer_view_get_line_cache(view, line->line);
RETVAL = textbuffer_view_get_line_cache(view, Line(line));
OUTPUT:
RETVAL
@ -65,7 +65,7 @@ textbuffer_view_remove_line(view, line)
Irssi::TextUI::TextBufferView view
Irssi::TextUI::Line line
CODE:
textbuffer_view_remove_line(view, line->line);
textbuffer_view_remove_line(view, Line(line));
void
textbuffer_view_remove_all_lines(view)
@ -82,7 +82,7 @@ textbuffer_view_set_bookmark(view, name, line)
char *name
Irssi::TextUI::Line line
CODE:
textbuffer_view_set_bookmark(view, name, line->line);
textbuffer_view_set_bookmark(view, name, Line(line));
void
textbuffer_view_set_bookmark_bottom(view, name)