summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/help/in/connect.in1
-rw-r--r--docs/help/in/lastlog.in3
-rw-r--r--docs/help/in/list.in15
-rw-r--r--docs/help/in/server.in1
-rw-r--r--docs/irssi.164
-rw-r--r--scripts/Makefile.am1
-rw-r--r--scripts/autoop.pl73
-rw-r--r--scripts/autorejoin.pl71
-rw-r--r--scripts/buf.pl17
-rw-r--r--scripts/dns.pl22
-rw-r--r--scripts/kills.pl9
-rw-r--r--scripts/mail.pl4
-rw-r--r--scripts/mlock.pl2
-rw-r--r--scripts/quitmsg.pl4
-rw-r--r--scripts/sb_search.pl142
-rw-r--r--scripts/usercount.pl3
-rw-r--r--src/common.h4
-rw-r--r--src/core/channels-setup.c2
-rw-r--r--src/core/channels.c2
-rw-r--r--src/core/chat-commands.c14
-rw-r--r--src/core/chatnets.c2
-rw-r--r--src/core/commands.c2
-rw-r--r--src/core/ignore.c12
-rw-r--r--src/core/levels.c4
-rw-r--r--src/core/log.c16
-rw-r--r--src/core/misc.c4
-rw-r--r--src/core/modules-load.c18
-rw-r--r--src/core/modules.c4
-rw-r--r--src/core/network-openssl.c9
-rw-r--r--src/core/nicklist.c2
-rw-r--r--src/core/server-connect-rec.h1
-rw-r--r--src/core/server-setup-rec.h1
-rw-r--r--src/core/servers-reconnect.c3
-rw-r--r--src/core/servers-setup.c9
-rw-r--r--src/core/servers.c1
-rw-r--r--src/core/session.c15
-rw-r--r--src/core/settings.c26
-rw-r--r--src/core/settings.h2
-rw-r--r--src/fe-common/core/command-history.c6
-rw-r--r--src/fe-common/core/completion.c8
-rw-r--r--src/fe-common/core/fe-channels.c6
-rw-r--r--src/fe-common/core/fe-exec.c2
-rw-r--r--src/fe-common/core/fe-help.c6
-rw-r--r--src/fe-common/core/fe-ignore.c2
-rw-r--r--src/fe-common/core/fe-log.c4
-rw-r--r--src/fe-common/core/fe-messages.c8
-rw-r--r--src/fe-common/core/fe-queries.c2
-rw-r--r--src/fe-common/core/fe-recode.c2
-rw-r--r--src/fe-common/core/fe-server.c10
-rw-r--r--src/fe-common/core/fe-settings.c2
-rw-r--r--src/fe-common/core/hilight-text.c14
-rw-r--r--src/fe-common/core/keyboard.c12
-rw-r--r--src/fe-common/core/module-formats.c4
-rw-r--r--src/fe-common/core/themes.c10
-rw-r--r--src/fe-common/core/window-commands.c4
-rw-r--r--src/fe-common/core/windows-layout.c9
-rw-r--r--src/fe-common/irc/dcc/fe-dcc-chat.c2
-rw-r--r--src/fe-common/irc/fe-events-numeric.c4
-rw-r--r--src/fe-common/irc/fe-irc-commands.c8
-rw-r--r--src/fe-common/irc/fe-irc-messages.c2
-rw-r--r--src/fe-common/irc/fe-irc-server.c3
-rw-r--r--src/fe-common/irc/fe-modes.c2
-rw-r--r--src/fe-common/irc/fe-whois.c6
-rw-r--r--src/fe-text/gui-readline.c2
-rw-r--r--src/fe-text/irssi.c3
-rw-r--r--src/fe-text/lastlog.c31
-rw-r--r--src/fe-text/mainwindows-layout.c3
-rw-r--r--src/fe-text/module-formats.c1
-rw-r--r--src/fe-text/module-formats.h1
-rw-r--r--src/fe-text/statusbar-config.c24
-rw-r--r--src/fe-text/statusbar.c4
-rw-r--r--src/fe-text/terminfo-core.c6
-rw-r--r--src/irc/core/bans.c4
-rw-r--r--src/irc/core/channel-events.c2
-rw-r--r--src/irc/core/irc-commands.c20
-rw-r--r--src/irc/core/irc-queries.c6
-rw-r--r--src/irc/core/irc-servers.c4
-rw-r--r--src/irc/core/irc-session.c4
-rw-r--r--src/irc/core/modes.c4
-rw-r--r--src/irc/core/servers-redirect.c6
-rw-r--r--src/irc/dcc/dcc-autoget.c2
-rw-r--r--src/irc/dcc/dcc-chat.c4
-rw-r--r--src/irc/dcc/dcc-get.c2
-rw-r--r--src/irc/dcc/dcc.c4
-rw-r--r--src/irc/notifylist/notify-setup.c6
-rw-r--r--src/irc/notifylist/notifylist.c2
-rw-r--r--src/irc/proxy/dump.c2
-rw-r--r--src/irc/proxy/listen.c44
-rw-r--r--src/lib-config/get.c60
-rw-r--r--src/lib-config/iconfig.h4
-rw-r--r--src/lib-config/parse.c4
-rw-r--r--src/lib-config/set.c8
-rw-r--r--src/perl/perl-core.c6
-rw-r--r--src/perl/perl-fe.c2
-rw-r--r--src/perl/perl-signals.c40
95 files changed, 542 insertions, 496 deletions
diff --git a/docs/help/in/connect.in b/docs/help/in/connect.in
index 3330966e..df50d1b9 100644
--- a/docs/help/in/connect.in
+++ b/docs/help/in/connect.in
@@ -15,6 +15,7 @@
-ssl_verify: Verifies the SSL certificate of the server.
-ssl_cafile: The file with the list of CA certificates.
-ssl_capath: The directory which contains the CA certificates.
+ -ssl_ciphers: SSL cipher suite preference lists.
-noproxy: Ignores the global proxy configuration.
-network: The network this connection belongs to.
-host: The hostname you would like to connect from.
diff --git a/docs/help/in/lastlog.in b/docs/help/in/lastlog.in
index 3815f5d2..e96e2ed5 100644
--- a/docs/help/in/lastlog.in
+++ b/docs/help/in/lastlog.in
@@ -14,6 +14,7 @@
-clear: Removes the previous results from the active window.
-count: Displays how many lines match.
-case: Performs a case-sensitive matching.
+ -date: Prepends each row with the message's date
-regexp: The given text pattern is a regular expression.
-word: The text must match full words.
-force: Forces to display the lastlog, even if it exceeds 1000 lines.
@@ -34,7 +35,7 @@
/LASTLOG holiday
/LASTLOG 'is on vacation' 10
- /LASTLOG -file -force ~/mike.log 'mike'
+ /LASTLOG -force -file ~/mike.log 'mike'
/LASTLOG -hilight
/LASTLOG -5 searchterm
diff --git a/docs/help/in/list.in b/docs/help/in/list.in
index 14858337..33f05e8b 100644
--- a/docs/help/in/list.in
+++ b/docs/help/in/list.in
@@ -7,8 +7,8 @@
-yes: Confirms that you want to receive a large amount of data.
- The text a channel must match; if no argument is given, the list of all
- channels will be displayed.
+ If the exact name of a channel is given, the only information about this
+ channel is requested; otherwise, a list of all channels will be displayed.
%9Description:%9
@@ -19,7 +19,16 @@
/LIST
/LIST -yes
- /LIST -yes *ubuntu*
+ /LIST #ubuntu
+ /LIST #*ubuntu*,>1
+
+%9Remarks:%9
+
+ Not all networks support server-side filtering and may provide a network
+ service instead; on IRCnet, you may use the ALIS service:
+
+ /QUOTE SQUERY ALIS :HELP
+ /MSG ALIS HELP
%9See also:%9 QUOTE, STATS, WHOIS
diff --git a/docs/help/in/server.in b/docs/help/in/server.in
index f6706daf..e407b6a9 100644
--- a/docs/help/in/server.in
+++ b/docs/help/in/server.in
@@ -22,6 +22,7 @@
-ssl_verify: Verifies the SSL certificate of the server.
-ssl_cafile: The file with the list of CA certificates.
-ssl_capath: The directory which contains the CA certificates.
+ -ssl_ciphers: SSL cipher suite preference lists.
-auto: Automatically connects to the server on startup.
-noauto: Doesn't connect to the server on startup.
-network: The network the server belongs to.
diff --git a/docs/irssi.1 b/docs/irssi.1
index e86be7ca..f38b639e 100644
--- a/docs/irssi.1
+++ b/docs/irssi.1
@@ -1,12 +1,13 @@
-.TH Irssi 1 "September 2002" "Irssi IRC client"
+.TH Irssi 1 "June 2015" "Irssi IRC client"
.SH NAME
Irssi \- a modular IRC client for UNIX
.SH SYNOPSIS
.B irssi
-[-dv!?] [-c server] [-p port] [-n nickname] [-w password] [-h hostname]
+[--config=PATH] [--home=PATH] [-dv!?] [-c server] [-p port] [-n nickname]
+[-w password] [-h hostname]
.SH DESCRIPTION
.B Irssi
-is a modular Internet Relay Chat client. It is highly extensible and
+is a modular Internet Relay Chat client; it is highly extensible and
very secure. Being a fullscreen, termcap based client with many
features,
.B Irssi
@@ -16,16 +17,15 @@ is easily extensible through scripts and modules.
.BI "\-\-config="FILE
use
.I FILE
-instead of ~/.irssi/config.
+instead of ~/.irssi/config
.TP
.BI "\-\-home="PATH
.I PATH
-specifies the home directory of Irssi.
-Default is
+specifies the home directory of Irssi; default is
.BR ~/.irssi
.TP
.BI "\-c, \-\-connect="SERVER
-connects to
+connect to
.I SERVER
.TP
.BI "\-w, \-\-password="PASSWORD
@@ -39,71 +39,53 @@ automatically connect to
on server.
.TP
.BI "\-!, \-\-noconnect"
-disables autoconnecting.
+disable autoconnecting of servers
.TP
.BI "\-n, \-\-nick="NICKNAME
specify
.I NICKNAME
-as your nick.
+as your nick
.TP
.BI "\-h, \-\-hostname="HOSTNAME
use
.I HOSTNAME
-for your irc session.
+for your irc session
.TP
.BI "\-d, \-\-dummy"
-use dummy terminal mode.
+use dummy terminal mode
.TP
.BI "\-v, \-\-version"
-display the version of Irssi.
+display the version of Irssi
.TP
.BI "\-?, \-\-help"
-show a help message.
+show a help message
.SH SEE ALSO
.B Irssi
-has been supplied with a huge amount of documentation. Check /help or look
-at the files contained by /usr/share/doc/irssi*
+has a solid amount of documentation available; check /HELP or look online
+at http://www.irssi.org
.SH FILES
.TP
-.I /etc/irssi.conf
-Global configuration file
-.TP
.I ~/.irssi/config
-Personal configuration file
+personal configuration file
.TP
.I ~/.irssi/config.autosave
-Automatic save of the personal config file when it was changed externally
+automatic save of the personal config file when it was changed externally
.TP
.I ~/.irssi/default.theme
-Default irssi theme
+default irssi theme
.TP
.I ~/.irssi/away.log
-Logged messages in away status
-.TP
-.I /usr/share/irssi/help/
-Directory including many help files
-.TP
-.I /usr/share/irssi/scripts/
-Global scripts directory
-.TP
-.I /usr/share/irssi/themes/
-Global themes directory
+logged messages in away status
.TP
.I ~/.irssi/scripts/
-Default scripts directory
+default scripts directory
.TP
.I ~/.irssi/scripts/autorun/
-Directory containing links to scripts that should be loaded
+directory containing links to scripts that should be loaded
automatically on startup
.TP
.I ~/.irssi/startup
-File containing a list of commands to execute on startup
+file containing a list of commands to execute on startup
.SH AUTHORS/CREDITS
.B Irssi
-was written by Timo Sirainen
-.B <cras@irssi.org>
-.sp
-This manpage was written by Istvan Sebestyen
-.BR <stevee@alphanet.ch>
-and Stefan Tomanek
-.BR <stefan@pico.ruhr.de>
+was written by Timo Sirainen; this manpage was written by Istvan Sebestyen, Stefan Tomanek, Geert Hauwaerts.
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 23eb7198..cd795153 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -11,7 +11,6 @@ script_DATA = \
mail.pl \
mlock.pl \
quitmsg.pl \
- sb_search.pl \
scriptassist.pl \
usercount.pl
diff --git a/scripts/autoop.pl b/scripts/autoop.pl
index f7182999..b72def15 100644
--- a/scripts/autoop.pl
+++ b/scripts/autoop.pl
@@ -5,13 +5,13 @@ use Irssi;
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = "1.00";
+$VERSION = "1.10";
%IRSSI = (
- authors => 'Timo Sirainen',
+ authors => 'Timo Sirainen & Jostein Kjønigsen',
name => 'autoop',
description => 'Simple auto-op script',
license => 'Public Domain',
- changed => 'Sun Mar 10 23:18 EET 2002'
+ changed => 'Fri Nov 24 12:55 GMT+1 2014'
);
my (%opnicks, %temp_opped);
@@ -64,7 +64,7 @@ sub autoop {
if (!$temp_opped{$nick} &&
$server->masks_match($masks, $nick, $host)) {
- $channel->command("op $nick");
+ $channel->command("/op $nick");
$temp_opped{$nick} = 1;
}
}
@@ -89,3 +89,68 @@ sub event_massjoin {
Irssi::command_bind('autoop', 'cmd_autoop');
Irssi::signal_add_last('massjoin', 'event_massjoin');
+
+sub load_autoops {
+ my($file) = Irssi::get_irssi_dir."/autoop";
+ my($count) = 0;
+ local(*CONF);
+
+ %opnicks = ();
+ open(CONF, "<", "$file") or return;
+ while (my $line = <CONF>) {
+ if ($line !=~ /^\s*$/) {
+ cmd_autoop($line);
+ $count++;
+ }
+ }
+ close(CONF);
+
+ Irssi::print("Loaded $count channels from $file");
+}
+
+# --------[ save_autoops ]------------------------------------------------
+
+sub save_autoops {
+ my($auto) = @_;
+ my($file) = Irssi::get_irssi_dir."/autoop";
+ my($count) = 0;
+ my($channel) = "";
+ local(*CONF);
+
+ return if $auto;
+
+ open(CONF, ">", "$file");
+ foreach $channel (keys %opnicks) {
+ my $masks = $opnicks{$channel};
+ print CONF "$channel\t$masks\n";
+ $count++;
+ }
+ close(CONF);
+
+ Irssi::print("Saved $count channels to $file")
+ unless $auto;
+}
+
+
+# --------[ sig_setup_reread ]------------------------------------------
+
+# main setup is reread, so let us do it too
+sub sig_setup_reread {
+ load_autoops;
+}
+
+# --------[ sig_setup_save ]--------------------------------------------
+
+# main config is saved, and so we should save too
+sub sig_setup_save {
+ my($mainconf,$auto) = @_;
+ save_autoops($auto);
+}
+
+# persistance
+
+Irssi::signal_add('setup saved', 'sig_setup_save');
+Irssi::signal_add('setup reread', 'sig_setup_reread');
+
+# ensure we load persisted values on start
+load_autoops;
diff --git a/scripts/autorejoin.pl b/scripts/autorejoin.pl
index 2d23449f..42c97da7 100644
--- a/scripts/autorejoin.pl
+++ b/scripts/autorejoin.pl
@@ -1,6 +1,5 @@
-# automatically rejoin to channel after kicked
-
-# /SET autorejoin_channels #channel1 #channel2 ...
+# automatically rejoin to channel after kick
+# delayed rejoin: Lam 28.10.2001 (lam@lac.pl)
# NOTE: I personally don't like this feature, in most channels I'm in it
# will just result as ban. You've probably misunderstood the idea of /KICK
@@ -10,43 +9,49 @@ use Irssi;
use Irssi::Irc;
use strict;
use vars qw($VERSION %IRSSI);
-
-$VERSION = "1.00";
+$VERSION = "1.0.0";
%IRSSI = (
- authors => 'Timo Sirainen',
- name => 'autorejoin',
- description => 'Automatically rejoin to channel after kicked',
- license => 'Public Domain',
- changed => 'Sun Mar 10 23:18 EET 2002'
+ authors => "Timo 'cras' Sirainen, Leszek Matok",
+ contact => "lam\@lac.pl",
+ name => "autorejoin",
+ description => "Automatically rejoin to channel after being kick, after a (short) user-defined delay",
+ license => "GPLv2",
+ changed => "10.3.2002 14:00"
);
-sub channel_rejoin {
- my ($server, $channel) = @_;
- # check if channel has password
- my $chanrec = $server->channel_find($channel);
- my $password = $chanrec->{key} if ($chanrec);
+# How many seconds to wait before the rejoin?
+# TODO: make this a /setting
+my $delay = 5;
+
+my @tags;
+my $acttag = 0;
+
+sub rejoin {
+ my ( $data ) = @_;
+ my ( $tag, $servtag, $channel, $pass ) = split( / +/, $data );
- # We have to use send_raw() because the channel record still
- # exists and irssi won't even try to join to it with command()
- $server->send_raw("JOIN $channel $password");
+ my $server = Irssi::server_find_tag( $servtag );
+ $server->send_raw( "JOIN $channel $pass" ) if ( $server );
+ Irssi::timeout_remove( $tags[$tag] );
}
sub event_rejoin_kick {
- my ($server, $data) = @_;
- my ($channel, $nick) = split(/ +/, $data);
-
- return if ($server->{nick} ne $nick);
-
- # check if we want to autorejoin this channel
- my @chans = split(/[ ,]+/, Irssi::settings_get_str('autorejoin_channels'));
- foreach my $chan (@chans) {
- if (lc($chan) eq lc($channel)) {
- channel_rejoin($server, $channel);
- last;
- }
- }
+ my ( $server, $data ) = @_;
+ my ( $channel, $nick ) = split( / +/, $data );
+
+ return if ( $server->{ nick } ne $nick );
+
+ # check if channel has password
+ my $chanrec = $server->channel_find( $channel );
+ my $password = $chanrec->{ key } if ( $chanrec );
+ my $rejoinchan = $chanrec->{ name } if ( $chanrec );
+ my $servtag = $server->{ tag };
+
+ Irssi::print "Rejoining $rejoinchan in $delay seconds.";
+ $tags[$acttag] = Irssi::timeout_add( $delay * 1000, "rejoin", "$acttag $servtag $rejoinchan $password" );
+ $acttag++;
+ $acttag = 0 if ( $acttag > 60 );
}
-Irssi::settings_add_str('misc', 'autorejoin_channels', '');
-Irssi::signal_add('event kick', 'event_rejoin_kick');
+Irssi::signal_add( 'event kick', 'event_rejoin_kick' );
diff --git a/scripts/buf.pl b/scripts/buf.pl
index 43b4b3dd..da50e821 100644
--- a/scripts/buf.pl
+++ b/scripts/buf.pl
@@ -40,7 +40,7 @@ use Data::Dumper;
my %suppress;
sub upgrade {
- open BUF, sprintf('>%s/scrollbuffer', get_irssi_dir) or die $!;
+ open BUF, q{>}, sprintf('%s/scrollbuffer', get_irssi_dir) or die $!;
print BUF join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
for my $window (windows) {
next unless defined $window;
@@ -66,7 +66,7 @@ sub upgrade {
}
sub restore {
- open BUF, sprintf('<%s/scrollbuffer', get_irssi_dir) or die $!;
+ open BUF, q{<}, sprintf('%s/scrollbuffer', get_irssi_dir) or die $!;
my @suppress = split /\0/, <BUF>;
if (settings_get_bool 'upgrade_suppress_join') {
chomp $suppress[-1];
@@ -98,14 +98,13 @@ sub restore {
sub suppress {
my ($first, $second) = @_;
- return
- unless scalar keys %suppress
- and settings_get_bool 'upgrade_suppress_join';
- my $key = $first->{address} .
- (grep { (s/^://, /^[#!+&]/) } split ' ', $second)[0];
+ return unless scalar keys %suppress and settings_get_bool 'upgrade_suppress_join';
+ my $key_part = (grep { /^:?[#!+&]/ } split ' ', $second)[0];
+ $key_part =~ s/^://;
+ my $key = $first->{address} . $key_part;
if (exists $suppress{$key} and $suppress{$key}--) {
- signal_stop();
- delete $suppress{$key} unless $suppress{$key};
+ signal_stop();
+ delete $suppress{$key} unless $suppress{$key};
}
}
diff --git a/scripts/dns.pl b/scripts/dns.pl
index 612fab0e..989cdc3e 100644
--- a/scripts/dns.pl
+++ b/scripts/dns.pl
@@ -1,18 +1,24 @@
# /DNS <nick>|<host>|<ip> ...
+# version 2.1.1
+#
+# updated the script to fix a bug where the script would let
+# a trailing whitespace go through (ex: tab completion)
+# - inch <inch@stmpd.net>
-use Irssi;
use strict;
use Socket;
use POSIX;
use vars qw($VERSION %IRSSI);
-$VERSION = "2.1";
+$VERSION = "2.1.1";
%IRSSI = (
- authors => 'Timo Sirainen',
- name => 'dns',
- description => '/DNS <nick>|<host>|<ip> ...',
- license => 'Public Domain',
- changed => 'Sun Mar 10 23:23 EET 2002'
+ authors => "Timo \'cras\' Sirainen",
+ contact => "tss\@iki.fi",
+ name => "dns",
+ description => "/DNS <nick>|<host>|<ip> ...",
+ license => "Public Domain",
+ url => "http://irssi.org/",
+ changed => "2002-03-04T22:47+0100"
);
my (%resolve_hosts, %resolve_nicks, %resolve_print); # resolve queues
@@ -28,7 +34,7 @@ my $pipe_tag;
sub cmd_dns {
my ($nicks, $server) = @_;
return if !$nicks;
-
+ $nicks =~ s/\s+$//;
# get list of nicks/hosts we want to know
my $tag = !$server ? undef : $server->{tag};
my $ask_nicks = "";
diff --git a/scripts/kills.pl b/scripts/kills.pl
index 7ed2d533..50d9383d 100644
--- a/scripts/kills.pl
+++ b/scripts/kills.pl
@@ -10,6 +10,7 @@
# There's a pretty good explanation of (ircnet) ircd's server kills in
# http://www.irc.org/tech_docs/ircnet/kills.html
+use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
@@ -47,13 +48,13 @@ sub msg_quit {
my @printargs = ();
if ($killmsg =~ /([^ ]*) != (.*)/) {
# 1 != 2
- my $server1 = $1, $server2 = $2;
+ my $server1 = $1, my $server2 = $2;
$server1 =~ s/([^\[]*)\[([^\]]*)\]/\1/;
$msg .= "$2 != $server2";
} elsif ($killmsg =~ /([^ ]*) <- (.*)/) {
# 1 <- 2
- my $server1 = $1, $server2 = $2;
+ my $server1 = $1, my $server2 = $2;
if ($server1 =~ /^\(/) {
# (addr1)server1 <- (add2)server2
@@ -84,9 +85,9 @@ sub msg_quit {
$msg = $killmsg;
}
- @list = $server->nicks_get_same($nick);
+ my @list = $server->nicks_get_same($nick);
while (@list) {
- $channel = $list[0];
+ my $channel = $list[0];
shift @list;
# skip nick record
shift @list;
diff --git a/scripts/mail.pl b/scripts/mail.pl
index 33b3c22e..190c33af 100644
--- a/scripts/mail.pl
+++ b/scripts/mail.pl
@@ -1,3 +1,5 @@
+use strict;
+use vars qw($VERSION %IRSSI);
$VERSION = "2.92";
%IRSSI = (
authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei",
@@ -114,7 +116,7 @@ sub mbox_count {
$last_mtime = $mtime;
my $f = gensym;
- return 0 if (!open($f, $mailfile));
+ return 0 if (!open($f, "<", $mailfile));
# count new mails only
my $internal_removed = 0;
diff --git a/scripts/mlock.pl b/scripts/mlock.pl
index ed2fe52b..bf2fd002 100644
--- a/scripts/mlock.pl
+++ b/scripts/mlock.pl
@@ -113,7 +113,7 @@ sub mlock_check_mode {
}
if ($modecmd ne "") {
- $channel->{server}->command("mode $channame $modecmd$extracmd");
+ $channel->{server}->command("/mode $channame $modecmd$extracmd");
}
}
diff --git a/scripts/quitmsg.pl b/scripts/quitmsg.pl
index 41bddaa8..e289468c 100644
--- a/scripts/quitmsg.pl
+++ b/scripts/quitmsg.pl
@@ -21,7 +21,7 @@ sub cmd_quit {
my ($data, $server, $channel) = @_;
return if ($data ne "");
- open (f, $quitfile) || return;
+ open (f, "<", $quitfile) || return;
my $lines = 0; while(<f>) { $lines++; };
my $line = int(rand($lines))+1;
@@ -38,7 +38,7 @@ sub cmd_quit {
close(f);
foreach my $server (Irssi::servers) {
- $server->command("disconnect ".$server->{tag}." $quitmsg");
+ $server->command("/disconnect ".$server->{tag}." $quitmsg");
}
}
diff --git a/scripts/sb_search.pl b/scripts/sb_search.pl
deleted file mode 100644
index 43fc7b55..00000000
--- a/scripts/sb_search.pl
+++ /dev/null
@@ -1,142 +0,0 @@
-# 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.0';
-%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>]
-
- -level: only search for lines with the given level. see /help levels
- -regexp: the pattern is a regular expression
- -case: search case sensitive
- -word: pattern must match to full words
- -forward: search forwards (default is backwards)
- -all: search in all windows
- <pattern>: text to search for
-SCRIPTHELP_EOF
- ,MSGLEVEL_CLIENTCRAP);
- }
-}
-
-
-sub cmd_sb_search ($$$) {
- my ($args, $server, $witem) = @_;
-
- ### handle options
-
- my ($options, $pattern) = Irssi::command_parse_options('scrollback search', $args);
-
- my $level;
- if (defined($options->{level})) {
- $level = $options->{level};
- $level =~ y/,/ /;
- $level = Irssi::combine_level(0, $level);
- } else {
- return if (!$pattern);
- $level = MSGLEVEL_ALL;
- }
-
- my $regex;
- if ($pattern) {
- my $flags = defined($options->{case}) ? '' : '(?i)';
- my $b = defined($options->{word}) ? '\b' : '';
- if (defined($options->{regexp})) {
- $regex = qr/$flags$b$pattern$b/;
- } else {
- $regex = qr/$flags$b\Q$pattern\E$b/;
- }
- }
-
- my $forward = defined($options->{forward});
- my $all = defined($options->{all});
-
- ### 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->{startline};
- while ($line->next) {
- $line = $line->next
- }
- }
- } else { # 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');
diff --git a/scripts/usercount.pl b/scripts/usercount.pl
index 46dc0b46..613da1de 100644
--- a/scripts/usercount.pl
+++ b/scripts/usercount.pl
@@ -1,4 +1,6 @@
+use strict;
use Irssi 20040119.2359 ();
+use vars qw($VERSION %IRSSI);
$VERSION = "1.19";
%IRSSI = (
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
@@ -29,7 +31,6 @@ $VERSION = "1.19";
# sb_uc_space = " ";
-use strict;
use Irssi::TextUI;
my ($ircops, $ops, $halfops, $voices, $normal, $total);
diff --git a/src/common.h b/src/common.h
index bb246962..1b99753b 100644
--- a/src/common.h
+++ b/src/common.h
@@ -52,6 +52,10 @@
#define g_slice_free(type, mem) g_free(mem)
#endif
+#if !GLIB_CHECK_VERSION(2,16,0)
+#define g_strcmp0(a, b) (!a ? -(a != b) : (!b ? (a != b) : strcmp(a, b)))
+#endif
+
#ifdef USE_GC
# define g_free(x) G_STMT_START { (x) = NULL; } G_STMT_END
#endif
diff --git a/src/core/channels-setup.c b/src/core/channels-setup.c
index e1289c23..b2d971dd 100644
--- a/src/core/channels-setup.c
+++ b/src/core/channels-setup.c
@@ -40,7 +40,7 @@ static void channel_setup_save(CHANNEL_SETUP_REC *channel)
parentnode = iconfig_node_traverse("(channels", TRUE);
node = config_node_nth(parentnode, index);
if (node == NULL)
- node = config_node_section(parentnode, NULL, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(parentnode, NULL, NODE_TYPE_BLOCK);
iconfig_node_clear(node);
iconfig_node_set_str(node, "name", channel->name);
diff --git a/src/core/channels.c b/src/core/channels.c
index 8235a4c7..9af8b844 100644
--- a/src/core/channels.c
+++ b/src/core/channels.c
@@ -167,7 +167,7 @@ static GSList *servers_find_chatnet_except(SERVER_REC *server)
SERVER_REC *rec = tmp->data;
if (server != rec && rec->connrec->chatnet != NULL &&
- strcmp(server->connrec->chatnet,
+ g_strcmp0(server->connrec->chatnet,
rec->connrec->chatnet) == 0) {
/* chatnets match */
list = g_slist_append(list, rec);
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c
index 8d1ac3eb..8e881679 100644
--- a/src/core/chat-commands.c
+++ b/src/core/chat-commands.c
@@ -58,7 +58,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
return NULL;
}
- if (strcmp(password, "-") == 0)
+ if (g_strcmp0(password, "-") == 0)
*password = '\0';
/* check if -<chatnet> option is used to specify chat protocol */
@@ -106,6 +106,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
conn->ssl_cafile = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "ssl_capath")) != NULL)
conn->ssl_capath = g_strdup(tmp);
+ if ((tmp = g_hash_table_lookup(optlist, "ssl_ciphers")) != NULL)
+ conn->ssl_ciphers = g_strdup(tmp);
if ((conn->ssl_capath != NULL && conn->ssl_capath[0] != '\0')
|| (conn->ssl_cafile != NULL && conn->ssl_cafile[0] != '\0'))
conn->ssl_verify = TRUE;
@@ -138,6 +140,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
/* SYNTAX: CONNECT [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
+ [-ssl_ciphers <list>]
[-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>]
@@ -244,6 +247,7 @@ static void sig_default_command_server(const char *data, SERVER_REC *server,
/* SYNTAX: SERVER [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
+ [-ssl_ciphers <list>]
[-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>]
@@ -283,7 +287,7 @@ static void cmd_disconnect(const char *data, SERVER_REC *server)
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg))
return;
- if (*tag != '\0' && strcmp(tag, "*") != 0) {
+ if (*tag != '\0' && g_strcmp0(tag, "*") != 0) {
server = server_find_tag(tag);
if (server == NULL)
server = server_find_lookup_tag(tag);
@@ -343,7 +347,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
origtarget = target;
free_ret = FALSE;
- if (strcmp(target, ",") == 0 || strcmp(target, ".") == 0) {
+ if (g_strcmp0(target, ",") == 0 || g_strcmp0(target, ".") == 0) {
target = parse_special(&target, server, item,
NULL, &free_ret, NULL, 0);
if (target != NULL && *target == '\0') {
@@ -355,7 +359,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
}
if (target != NULL) {
- if (strcmp(target, "*") == 0) {
+ if (g_strcmp0(target, "*") == 0) {
/* send to active channel/query */
if (item == NULL)
cmd_param_error(CMDERR_NOT_JOINED);
@@ -483,7 +487,7 @@ void chat_commands_init(void)
signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server);
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg);
- command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +host noproxy -rawlog noautosendcmd");
+ command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +host noproxy -rawlog noautosendcmd");
command_set_options("msg", "channel nick");
}
diff --git a/src/core/chatnets.c b/src/core/chatnets.c
index 3c794ab4..dd4d94b3 100644
--- a/src/core/chatnets.c
+++ b/src/core/chatnets.c
@@ -36,7 +36,7 @@ static void chatnet_config_save(CHATNET_REC *chatnet)
CONFIG_NODE *node;
node = iconfig_node_traverse("chatnets", TRUE);
- node = config_node_section(node, chatnet->name, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, chatnet->name, NODE_TYPE_BLOCK);
iconfig_node_clear(node);
iconfig_node_set_str(node, "type", chat_protocol_find_id(chatnet->chat_type)->name);
diff --git a/src/core/commands.c b/src/core/commands.c
index ed82f44e..9e451bc8 100644
--- a/src/core/commands.c
+++ b/src/core/commands.c
@@ -674,7 +674,7 @@ get_optional_channel(WI_ITEM_REC *active_item, char **data, int require_name)
origtmp = tmp = g_strdup(*data);
channel = cmd_get_param(&tmp);
- if (strcmp(channel, "*") == 0 && !require_name) {
+ if (g_strcmp0(channel, "*") == 0 && !require_name) {
/* "*" means active channel */
cmd_get_param(data);
ret = window_item_get_target(active_item);
diff --git a/src/core/ignore.c b/src/core/ignore.c
index 68fae11f..e70b741b 100644
--- a/src/core/ignore.c
+++ b/src/core/ignore.c
@@ -201,10 +201,10 @@ IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask,
char **chan;
int ignore_servertag;
- if (mask != NULL && (*mask == '\0' || strcmp(mask, "*") == 0))
+ if (mask != NULL && (*mask == '\0' || g_strcmp0(mask, "*") == 0))
mask = NULL;
- ignore_servertag = servertag != NULL && strcmp(servertag, "*") == 0;
+ ignore_servertag = servertag != NULL && g_strcmp0(servertag, "*") == 0;
for (tmp = ignores; tmp != NULL; tmp = tmp->next) {
IGNORE_REC *rec = tmp->data;
@@ -232,7 +232,7 @@ IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask,
if ((channels == NULL && rec->channels == NULL))
return rec; /* no channels - ok */
- if (channels != NULL && strcmp(*channels, "*") == 0)
+ if (channels != NULL && g_strcmp0(*channels, "*") == 0)
return rec; /* ignore channels */
if (channels == NULL || rec->channels == NULL)
@@ -263,7 +263,7 @@ static void ignore_set_config(IGNORE_REC *rec)
return;
node = iconfig_node_traverse("(ignores", TRUE);
- node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, NULL, NODE_TYPE_BLOCK);
if (rec->mask != NULL) iconfig_node_set_str(node, "mask", rec->mask);
if (rec->level) {
@@ -281,7 +281,7 @@ static void ignore_set_config(IGNORE_REC *rec)
iconfig_node_set_str(node, "servertag", rec->servertag);
if (rec->channels != NULL && *rec->channels != NULL) {
- node = config_node_section(node, "channels", NODE_TYPE_LIST);
+ node = iconfig_node_section(node, "channels", NODE_TYPE_LIST);
iconfig_node_add_list(node, rec->channels);
}
}
@@ -436,7 +436,7 @@ static void read_ignores(void)
rec->unignore_time = config_node_get_int(node, "unignore_time", 0);
rec->servertag = g_strdup(config_node_get_str(node, "servertag", 0));
- node = config_node_section(node, "channels", -1);
+ node = iconfig_node_section(node, "channels", -1);
if (node != NULL) rec->channels = config_node_get_list(node);
ignore_init_rec(rec);
diff --git a/src/core/levels.c b/src/core/levels.c
index 7997ba98..e623c4de 100644
--- a/src/core/levels.c
+++ b/src/core/levels.c
@@ -54,7 +54,7 @@ int level_get(const char *level)
{
int n, len, match;
- if (g_ascii_strcasecmp(level, "ALL") == 0 || strcmp(level, "*") == 0)
+ if (g_ascii_strcasecmp(level, "ALL") == 0 || g_strcmp0(level, "*") == 0)
return MSGLEVEL_ALL;
if (g_ascii_strcasecmp(level, "NEVER") == 0)
@@ -177,7 +177,7 @@ int combine_level(int dest, const char *src)
itemname = *item + (**item == '+' || **item == '-' ? 1 : 0);
itemlevel = level_get(itemname);
- if (strcmp(itemname, "NONE") == 0)
+ if (g_strcmp0(itemname, "NONE") == 0)
dest = 0;
else if (**item == '-')
dest &= ~(itemlevel);
diff --git a/src/core/log.c b/src/core/log.c
index d4d3853e..8306d2df 100644
--- a/src/core/log.c
+++ b/src/core/log.c
@@ -110,7 +110,7 @@ int log_start_logging(LOG_REC *log)
log->real_fname = log_filename(log);
if (log->real_fname != NULL &&
- strcmp(log->real_fname, log->fname) != 0) {
+ g_strcmp0(log->real_fname, log->fname) != 0) {
/* path may contain variables (%time, $vars),
make sure the directory is created */
dir = g_path_get_dirname(log->real_fname);
@@ -181,7 +181,7 @@ static void log_rotate_check(LOG_REC *log)
return;
new_fname = log_filename(log);
- if (strcmp(new_fname, log->real_fname) != 0) {
+ if (g_strcmp0(new_fname, log->real_fname) != 0) {
/* rotate log */
log_stop_logging(log);
signal_emit("log rotated", 1, log);
@@ -245,7 +245,7 @@ static int itemcmp(const char *patt, const char *item)
{
/* returns 0 on match, nonzero otherwise */
- if (!strcmp(patt, "*"))
+ if (!g_strcmp0(patt, "*"))
return 0;
return item ? g_ascii_strcasecmp(patt, item) : 1;
}
@@ -320,7 +320,7 @@ LOG_REC *log_find(const char *fname)
for (tmp = logs; tmp != NULL; tmp = tmp->next) {
LOG_REC *rec = tmp->data;
- if (strcmp(rec->fname, fname) == 0)
+ if (g_strcmp0(rec->fname, fname) == 0)
return rec;
}
@@ -332,11 +332,11 @@ static void log_items_update_config(LOG_REC *log, CONFIG_NODE *parent)
GSList *tmp;
CONFIG_NODE *node;
- parent = config_node_section(parent, "items", NODE_TYPE_LIST);
+ parent = iconfig_node_section(parent, "items", NODE_TYPE_LIST);
for (tmp = log->items; tmp != NULL; tmp = tmp->next) {
LOG_ITEM_REC *rec = tmp->data;
- node = config_node_section(parent, NULL, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(parent, NULL, NODE_TYPE_BLOCK);
iconfig_node_set_str(node, "type", log_item_types[rec->type]);
iconfig_node_set_str(node, "name", rec->name);
iconfig_node_set_str(node, "server", rec->servertag);
@@ -352,7 +352,7 @@ static void log_update_config(LOG_REC *log)
return;
node = iconfig_node_traverse("logs", TRUE);
- node = config_node_section(node, log->fname, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, log->fname, NODE_TYPE_BLOCK);
if (log->autoopen)
iconfig_node_set_bool(node, "auto_open", TRUE);
@@ -544,7 +544,7 @@ static void log_read_config(void)
signal_emit("log config read", 2, log, node);
- node = config_node_section(node, "items", -1);
+ node = iconfig_node_section(node, "items", -1);
if (node != NULL)
log_items_read_config(node, log);
diff --git a/src/core/misc.c b/src/core/misc.c
index 586e4f7c..ef8501d5 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -184,7 +184,7 @@ int strarray_find(char **array, const char *item)
GSList *gslist_find_string(GSList *list, const char *key)
{
for (; list != NULL; list = list->next)
- if (strcmp(list->data, key) == 0) return list;
+ if (g_strcmp0(list->data, key) == 0) return list;
return NULL;
}
@@ -269,7 +269,7 @@ GSList *hashtable_get_keys(GHashTable *hash)
GList *glist_find_string(GList *list, const char *key)
{
for (; list != NULL; list = list->next)
- if (strcmp(list->data, key) == 0) return list;
+ if (g_strcmp0(list->data, key) == 0) return list;
return NULL;
}
diff --git a/src/core/modules-load.c b/src/core/modules-load.c
index 49f811de..6086d9ae 100644
--- a/src/core/modules-load.c
+++ b/src/core/modules-load.c
@@ -78,7 +78,7 @@ static char *module_get_root(const char *name, char **prefixes)
/* skip the _core part */
len = strlen(name);
- if (len > 5 && strcmp(name+len-5, "_core") == 0)
+ if (len > 5 && g_strcmp0(name+len-5, "_core") == 0)
return g_strndup(name, len-5);
return g_strdup(name);
@@ -94,11 +94,11 @@ static char *module_get_sub(const char *name, const char *root)
g_return_val_if_fail(namelen >= rootlen, g_strdup(name));
if (strncmp(name, root, rootlen) == 0 &&
- strcmp(name+rootlen, "_core") == 0)
+ g_strcmp0(name+rootlen, "_core") == 0)
return g_strdup("core");
if (namelen > rootlen && name[namelen-rootlen-1] == '_' &&
- strcmp(name+namelen-rootlen, root) == 0)
+ g_strcmp0(name+namelen-rootlen, root) == 0)
return g_strndup(name, namelen-rootlen-1);
return g_strdup(name);
@@ -140,10 +140,10 @@ static GModule *module_open(const char *name, int *found)
static char *module_get_func(const char *rootmodule, const char *submodule,
const char *function)
{
- if (strcmp(submodule, "core") == 0)
+ if (g_strcmp0(submodule, "core") == 0)
return g_strconcat(rootmodule, "_core_", function, NULL);
- if (strcmp(rootmodule, submodule) == 0)
+ if (g_strcmp0(rootmodule, submodule) == 0)
return g_strconcat(rootmodule, "_", function, NULL);
return g_strconcat(submodule, "_", rootmodule, "_", function, NULL);
@@ -200,7 +200,7 @@ static int module_load_name(const char *path, const char *rootmodule,
module = module_find(rootmodule);
rec = module == NULL ? NULL :
- strcmp(rootmodule, submodule) == 0 ?
+ g_strcmp0(rootmodule, submodule) == 0 ?
module_file_find(module, "core") :
module_file_find(module, submodule);
if (rec == NULL) {
@@ -277,7 +277,7 @@ static int module_load_full(const char *path, const char *rootmodule,
return FALSE;
module = module_find(rootmodule);
- if (module != NULL && (strcmp(submodule, rootmodule) == 0 ||
+ if (module != NULL && (g_strcmp0(submodule, rootmodule) == 0 ||
module_file_find(module, submodule) != NULL)) {
/* module is already loaded */
module_error(MODULE_ERROR_ALREADY_LOADED, NULL,
@@ -286,7 +286,7 @@ static int module_load_full(const char *path, const char *rootmodule,
}
/* check if the given module exists.. */
- try_prefixes = strcmp(rootmodule, submodule) == 0;
+ try_prefixes = g_strcmp0(rootmodule, submodule) == 0;
status = module_load_name(path, rootmodule, submodule, try_prefixes);
if (status == -1 && try_prefixes) {
/* nope, try loading the module_core,
@@ -340,7 +340,7 @@ int module_load_sub(const char *path, const char *submodule, char **prefixes)
g_free(name);
full_path = g_string_new(exppath);
- if (strcmp(submodule, "core") == 0)
+ if (g_strcmp0(submodule, "core") == 0)
g_string_insert(full_path, end, "_core");
else {
g_string_insert_c(full_path, start, '_');
diff --git a/src/core/modules.c b/src/core/modules.c
index b002819b..a2542c84 100644
--- a/src/core/modules.c
+++ b/src/core/modules.c
@@ -44,7 +44,7 @@ void *module_check_cast_module(void *object, int type_pos,
str = module_find_id_str(module,
G_STRUCT_MEMBER(int, object, type_pos));
- return str == NULL || strcmp(str, id) != 0 ? NULL : object;
+ return str == NULL || g_strcmp0(str, id) != 0 ? NULL : object;
}
/* return unique number across all modules for `id' */
@@ -251,7 +251,7 @@ MODULE_FILE_REC *module_file_find(MODULE_REC *module, const char *name)
for (tmp = module->files; tmp != NULL; tmp = tmp->next) {
MODULE_FILE_REC *rec = tmp->data;
- if (strcmp(rec->name, name) == 0)
+ if (g_strcmp0(rec->name, name) == 0)
return rec;
}
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c
index e16403ec..465c4154 100644
--- a/src/core/network-openssl.c
+++ b/src/core/network-openssl.c
@@ -460,6 +460,7 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_
const char *mypass = server->connrec->ssl_pass;
const char *cafile = server->connrec->ssl_cafile;
const char *capath = server->connrec->ssl_capath;
+ const char *ciphers = server->connrec->ssl_ciphers;
gboolean verify = server->connrec->ssl_verify;
g_return_val_if_fail(handle != NULL, NULL);
@@ -478,6 +479,10 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3);
SSL_CTX_set_default_passwd_cb(ctx, get_pem_password_callback);
SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)mypass);
+ if (ciphers && *ciphers) {
+ if (SSL_CTX_set_cipher_list(ctx, ciphers) != 1)
+ g_warning("No valid SSL cipher suite could be selected");
+ }
if (mycert && *mycert) {
char *scert = NULL, *spkey = NULL;
@@ -531,6 +536,10 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_
return NULL;
}
+#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
+ SSL_set_tlsext_host_name(ssl, server->connrec->address);
+#endif
+
SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE |
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
diff --git a/src/core/nicklist.c b/src/core/nicklist.c
index b1c9ecef..a96b8a9e 100644
--- a/src/core/nicklist.c
+++ b/src/core/nicklist.c
@@ -478,7 +478,7 @@ static NICK_REC *nick_nfind(CHANNEL_REC *channel, const char *nick, int len)
if (rec != NULL) {
/* if there's multiple, get the one with identical case */
while (rec->next != NULL) {
- if (strcmp(rec->nick, tmpnick) == 0)
+ if (g_strcmp0(rec->nick, tmpnick) == 0)
break;
rec = rec->next;
}
diff --git a/src/core/server-connect-rec.h b/src/core/server-connect-rec.h
index 17537508..80c5761b 100644
--- a/src/core/server-connect-rec.h
+++ b/src/core/server-connect-rec.h
@@ -28,6 +28,7 @@ char *ssl_pkey;
char *ssl_pass;
char *ssl_cafile;
char *ssl_capath;
+char *ssl_ciphers;
GIOChannel *connect_handle; /* connect using this handle */
diff --git a/src/core/server-setup-rec.h b/src/core/server-setup-rec.h
index ae797559..ecdde3f3 100644
--- a/src/core/server-setup-rec.h
+++ b/src/core/server-setup-rec.h
@@ -13,6 +13,7 @@ char *ssl_pkey;
char *ssl_pass;
char *ssl_cafile;
char *ssl_capath;
+char *ssl_ciphers;
char *own_host; /* address to use when connecting this server */
IPADDR *own_ip4, *own_ip6; /* resolved own_address if not NULL */
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c
index d99a5405..ae97ecd2 100644
--- a/src/core/servers-reconnect.c
+++ b/src/core/servers-reconnect.c
@@ -197,6 +197,7 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
dest->ssl_verify = src->ssl_verify;
dest->ssl_cafile = g_strdup(src->ssl_cafile);
dest->ssl_capath = g_strdup(src->ssl_capath);
+ dest->ssl_ciphers = g_strdup(src->ssl_ciphers);
return dest;
}
@@ -384,7 +385,7 @@ static void cmd_reconnect(const char *data, SERVER_REC *server)
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg))
return;
- if (*tag != '\0' && strcmp(tag, "*") != 0)
+ if (*tag != '\0' && g_strcmp0(tag, "*") != 0)
server = server_find_tag(tag);
if (server != NULL) {
diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c
index 27d9f1f0..90a447d4 100644
--- a/src/core/servers-setup.c
+++ b/src/core/servers-setup.c
@@ -179,6 +179,8 @@ static void server_setup_fill_server(SERVER_CONNECT_REC *conn,
conn->ssl_cafile = g_strdup(sserver->ssl_cafile);
if (conn->ssl_capath == NULL && sserver->ssl_capath != NULL && sserver->ssl_capath[0] != '\0')
conn->ssl_capath = g_strdup(sserver->ssl_capath);
+ if (conn->ssl_ciphers == NULL && sserver->ssl_ciphers != NULL && sserver->ssl_ciphers[0] != '\0')
+ conn->ssl_ciphers = g_strdup(sserver->ssl_ciphers);
server_setup_fill_reconn(conn, sserver);
@@ -405,6 +407,7 @@ static SERVER_SETUP_REC *server_setup_read(CONFIG_NODE *node)
rec->ssl_verify = config_node_get_bool(node, "ssl_verify", FALSE);
rec->ssl_cafile = g_strdup(config_node_get_str(node, "ssl_cafile", NULL));
rec->ssl_capath = g_strdup(config_node_get_str(node, "ssl_capath", NULL));
+ rec->ssl_ciphers = g_strdup(config_node_get_str(node, "ssl_ciphers", NULL));
if (rec->ssl_cafile || rec->ssl_capath)
rec->ssl_verify = TRUE;
if (rec->ssl_cert != NULL || rec->ssl_verify)
@@ -430,7 +433,7 @@ static void server_setup_save(SERVER_SETUP_REC *rec)
parentnode = iconfig_node_traverse("(servers", TRUE);
node = config_node_nth(parentnode, index);
if (node == NULL)
- node = config_node_section(parentnode, NULL, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(parentnode, NULL, NODE_TYPE_BLOCK);
iconfig_node_clear(node);
iconfig_node_set_str(node, "address", rec->address);
@@ -445,6 +448,7 @@ static void server_setup_save(SERVER_SETUP_REC *rec)
iconfig_node_set_bool(node, "ssl_verify", rec->ssl_verify);
iconfig_node_set_str(node, "ssl_cafile", rec->ssl_cafile);
iconfig_node_set_str(node, "ssl_capath", rec->ssl_capath);
+ iconfig_node_set_str(node, "ssl_ciphers", rec->ssl_ciphers);
iconfig_node_set_str(node, "own_host", rec->own_host);
iconfig_node_set_str(node, "family",
@@ -486,6 +490,7 @@ static void server_setup_destroy(SERVER_SETUP_REC *rec)
g_free_not_null(rec->ssl_pass);
g_free_not_null(rec->ssl_cafile);
g_free_not_null(rec->ssl_capath);
+ g_free_not_null(rec->ssl_ciphers);
g_free(rec->address);
g_free(rec);
}
@@ -526,7 +531,7 @@ static void read_servers(void)
static void read_settings(void)
{
if (old_source_host == NULL ||
- strcmp(old_source_host, settings_get_str("hostname")) != 0) {
+ g_strcmp0(old_source_host, settings_get_str("hostname")) != 0) {
g_free_not_null(old_source_host);
old_source_host = g_strdup(settings_get_str("hostname"));
diff --git a/src/core/servers.c b/src/core/servers.c
index 6eaad191..3342304e 100644
--- a/src/core/servers.c
+++ b/src/core/servers.c
@@ -636,6 +636,7 @@ void server_connect_unref(SERVER_CONNECT_REC *conn)
g_free_not_null(conn->ssl_pass);
g_free_not_null(conn->ssl_cafile);
g_free_not_null(conn->ssl_capath);
+ g_free_not_null(conn->ssl_ciphers);
g_free_not_null(conn->channels);
g_free_not_null(conn->away_reason);
diff --git a/src/core/session.c b/src/core/session.c
index b3002632..17d80076 100644
--- a/src/core/session.c
+++ b/src/core/session.c
@@ -92,7 +92,7 @@ static void cmd_upgrade(const char *data)
static void session_save_nick(CHANNEL_REC *channel, NICK_REC *nick,
CONFIG_REC *config, CONFIG_NODE *node)
{
- node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ node = config_node_section(config, node, NULL, NODE_TYPE_BLOCK);
config_node_set_str(config, node, "nick", nick->nick);
config_node_set_bool(config, node, "op", nick->op);
@@ -109,7 +109,7 @@ static void session_save_channel_nicks(CHANNEL_REC *channel, CONFIG_REC *config,
{
GSList *tmp, *nicks;
- node = config_node_section(node, "nicks", NODE_TYPE_LIST);
+ node = config_node_section(config, node, "nicks", NODE_TYPE_LIST);
nicks = nicklist_getnicks(channel);
for (tmp = nicks; tmp != NULL; tmp = tmp->next)
session_save_nick(channel, tmp->data, config, node);
@@ -119,7 +119,7 @@ static void session_save_channel_nicks(CHANNEL_REC *channel, CONFIG_REC *config,
static void session_save_channel(CHANNEL_REC *channel, CONFIG_REC *config,
CONFIG_NODE *node)
{
- node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ node = config_node_section(config, node, NULL, NODE_TYPE_BLOCK);
config_node_set_str(config, node, "name", channel->name);
config_node_set_str(config, node, "visible_name", channel->visible_name);
@@ -138,7 +138,7 @@ static void session_save_server_channels(SERVER_REC *server,
GSList *tmp;
/* save channels */
- node = config_node_section(node, "channels", NODE_TYPE_LIST);
+ node = config_node_section(config, node, "channels", NODE_TYPE_LIST);
for (tmp = server->channels; tmp != NULL; tmp = tmp->next)
session_save_channel(tmp->data, config, node);
}
@@ -148,7 +148,7 @@ static void session_save_server(SERVER_REC *server, CONFIG_REC *config,
{
int handle;
- node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ node = config_node_section(config, node, NULL, NODE_TYPE_BLOCK);
config_node_set_str(config, node, "chat_type",
chat_protocol_find_id(server->chat_type)->name);
@@ -165,6 +165,7 @@ static void session_save_server(SERVER_REC *server, CONFIG_REC *config,
config_node_set_bool(config, node, "ssl_verify", server->connrec->ssl_verify);
config_node_set_str(config, node, "ssl_cafile", server->connrec->ssl_cafile);
config_node_set_str(config, node, "ssl_capath", server->connrec->ssl_capath);
+ config_node_set_str(config, node, "ssl_ciphers", server->connrec->ssl_ciphers);
handle = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
config_node_set_int(config, node, "handle", handle);
@@ -187,7 +188,7 @@ static void session_restore_channel_nicks(CHANNEL_REC *channel,
GSList *tmp;
/* restore nicks */
- node = config_node_section(node, "nicks", -1);
+ node = config_node_section(NULL, node, "nicks", -1);
if (node != NULL && node->type == NODE_TYPE_LIST) {
tmp = config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp)) {
@@ -223,7 +224,7 @@ static void session_restore_server_channels(SERVER_REC *server,
GSList *tmp;
/* restore channels */
- node = config_node_section(node, "channels", -1);
+ node = config_node_section(NULL, node, "channels", -1);
if (node != NULL && node->type == NODE_TYPE_LIST) {
tmp = config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp))
diff --git a/src/core/settings.c b/src/core/settings.c
index 2296909e..b34a5766 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -77,7 +77,7 @@ settings_get_str_type(const char *key, SettingType type)
if (rec == NULL) return NULL;
node = iconfig_node_traverse("settings", FALSE);
- node = node == NULL ? NULL : config_node_section(node, rec->module, -1);
+ node = node == NULL ? NULL : iconfig_node_section(node, rec->module, -1);
return node == NULL ? rec->default_value.v_string :
config_node_get_str(node, key, rec->default_value.v_string);
@@ -97,7 +97,7 @@ int settings_get_int(const char *key)
if (rec == NULL) return 0;
node = iconfig_node_traverse("settings", FALSE);
- node = node == NULL ? NULL : config_node_section(node, rec->module, -1);
+ node = node == NULL ? NULL : iconfig_node_section(node, rec->module, -1);
return node == NULL ? rec->default_value.v_int :
config_node_get_int(node, key, rec->default_value.v_int);
@@ -112,7 +112,7 @@ int settings_get_bool(const char *key)
if (rec == NULL) return FALSE;
node = iconfig_node_traverse("settings", FALSE);
- node = node == NULL ? NULL : config_node_section(node, rec->module, -1);
+ node = node == NULL ? NULL : iconfig_node_section(node, rec->module, -1);
return node == NULL ? rec->default_value.v_bool :
config_node_get_bool(node, key, rec->default_value.v_bool);
@@ -295,7 +295,7 @@ void settings_remove(const char *key)
static int settings_remove_hash(const char *key, SETTINGS_REC *rec,
const char *module)
{
- if (strcmp(rec->module, module) == 0) {
+ if (g_strcmp0(rec->module, module) == 0) {
settings_unref(rec, FALSE);
return TRUE;
}
@@ -324,7 +324,7 @@ static CONFIG_NODE *settings_get_node(const char *key)
}
node = iconfig_node_traverse("settings", TRUE);
- return config_node_section(node, rec->module, NODE_TYPE_BLOCK);
+ return iconfig_node_section(node, rec->module, NODE_TYPE_BLOCK);
}
void settings_set_str(const char *key, const char *value)
@@ -420,7 +420,7 @@ static void settings_clean_invalid_module(const char *module)
node = iconfig_node_traverse("settings", FALSE);
if (node == NULL) return;
- node = config_node_section(node, module, -1);
+ node = iconfig_node_section(node, module, -1);
if (node == NULL) return;
for (tmp = config_node_first(node->value); tmp != NULL; tmp = next) {
@@ -428,7 +428,7 @@ static void settings_clean_invalid_module(const char *module)
next = config_node_next(tmp);
set = g_hash_table_lookup(settings, subnode->key);
- if (set == NULL || strcmp(set->module, module) != 0)
+ if (set == NULL || g_strcmp0(set->module, module) != 0)
iconfig_node_remove(node, subnode);
}
}
@@ -458,7 +458,7 @@ static int backwards_compatibility(const char *module, CONFIG_NODE *node,
new_value = NULL; new_key = NULL; new_module = NULL;
/* fe-text term_type -> fe-common/core term_charset - for 0.8.10-> */
- if (strcmp(module, "fe-text") == 0) {
+ if (g_strcmp0(module, "fe-text") == 0) {
if (g_ascii_strcasecmp(node->key, "term_type") == 0 ||
/* kludge for cvs-version where term_charset was in fe-text */
g_ascii_strcasecmp(node->key, "term_charset") == 0) {
@@ -468,7 +468,7 @@ static int backwards_compatibility(const char *module, CONFIG_NODE *node,
g_strdup(node->value);
new_node = iconfig_node_traverse("settings", FALSE);
new_node = new_node == NULL ? NULL :
- config_node_section(new_node, new_module, -1);
+ iconfig_node_section(new_node, new_module, -1);
config_node_set_str(mainconfig, new_node,
new_key, new_value);
@@ -502,7 +502,7 @@ void settings_check_module(const char *module)
g_return_if_fail(module != NULL);
node = iconfig_node_traverse("settings", FALSE);
- node = node == NULL ? NULL : config_node_section(node, module, -1);
+ node = node == NULL ? NULL : iconfig_node_section(node, module, -1);
if (node == NULL) return;
errors = g_string_new(NULL);
@@ -520,7 +520,7 @@ void settings_check_module(const char *module)
if (backwards_compatibility(module, node, parent))
continue;
- if (set == NULL || strcmp(set->module, module) != 0) {
+ if (set == NULL || g_strcmp0(set->module, module) != 0) {
g_string_append_printf(errors, " %s", node->key);
count++;
}
@@ -548,9 +548,9 @@ void settings_check_module(const char *module)
static int settings_compare(SETTINGS_REC *v1, SETTINGS_REC *v2)
{
- int cmp = strcmp(v1->section, v2->section);
+ int cmp = g_strcmp0(v1->section, v2->section);
if (!cmp)
- cmp = strcmp(v1->key, v2->key);
+ cmp = g_strcmp0(v1->key, v2->key);
return cmp;
}
diff --git a/src/core/settings.h b/src/core/settings.h
index f8d9f68f..af00cc80 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -36,6 +36,8 @@ typedef struct {
#define iconfig_set_int(a, b, c) config_set_int(mainconfig, a, b, c)
#define iconfig_set_bool(a, b, c) config_set_bool(mainconfig, a, b, c)
+#define iconfig_node_section(a, b, c) config_node_section(mainconfig, a, b, c)
+#define iconfig_node_section_index(a, b, c, d) config_node_section_index(mainconfig, a, b, c, d)
#define iconfig_node_traverse(a, b) config_node_traverse(mainconfig, a, b)
#define iconfig_node_set_str(a, b, c) config_node_set_str(mainconfig, a, b, c)
#define iconfig_node_set_int(a, b, c) config_node_set_int(mainconfig, a, b, c)
diff --git a/src/fe-common/core/command-history.c b/src/fe-common/core/command-history.c
index 37405c43..f9c3884c 100644
--- a/src/fe-common/core/command-history.c
+++ b/src/fe-common/core/command-history.c
@@ -42,7 +42,7 @@ void command_history_add(HISTORY_REC *history, const char *text)
g_return_if_fail(text != NULL);
link = g_list_last(history->list);
- if (link != NULL && strcmp(link->data, text) == 0)
+ if (link != NULL && g_strcmp0(link->data, text) == 0)
return; /* same as previous entry */
if (settings_get_int("max_command_history") < 1 ||
@@ -121,7 +121,7 @@ const char *command_history_prev(WINDOW_REC *window, const char *text)
}
if (*text != '\0' &&
- (pos == NULL || strcmp(pos->data, text) != 0)) {
+ (pos == NULL || g_strcmp0(pos->data, text) != 0)) {
/* save the old entry to history */
command_history_add(history, text);
}
@@ -145,7 +145,7 @@ const char *command_history_next(WINDOW_REC *window, const char *text)
}
if (*text != '\0' &&
- (pos == NULL || strcmp(pos->data, text) != 0)) {
+ (pos == NULL || g_strcmp0(pos->data, text) != 0)) {
/* save the old entry to history */
command_history_add(history, text);
}
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 31d62e10..312e417c 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -51,7 +51,7 @@ static const char *completion_find(const char *key, int automatic)
if (node == NULL || node->type != NODE_TYPE_BLOCK)
return NULL;
- node = config_node_section(node, key, -1);
+ node = iconfig_node_section(node, key, -1);
if (node == NULL)
return NULL;
@@ -141,7 +141,7 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i
g_return_val_if_fail(pos != NULL, NULL);
continue_complete = complist != NULL && *pos == last_line_pos &&
- strcmp(line, last_line) == 0;
+ g_strcmp0(line, last_line) == 0;
if (erase && !continue_complete)
return NULL;
@@ -681,7 +681,7 @@ static void sig_complete_set(GList **list, WINDOW_REC *window,
g_return_if_fail(line != NULL);
if (*line == '\0' ||
- !strcmp("-clear", line) || !strcmp("-default", line))
+ !g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
*list = completion_get_settings(word, -1);
else if (*line != '\0' && *word == '\0') {
SETTINGS_REC *rec = settings_get_record(line);
@@ -785,7 +785,7 @@ static void cmd_completion(const char *data)
} else if (*key != '\0' && *value != '\0') {
int automatic = g_hash_table_lookup(optlist, "auto") != NULL;
- node = config_node_section(node, key, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, key, NODE_TYPE_BLOCK);
iconfig_node_set_str(node, "value", value);
if (automatic)
iconfig_node_set_bool(node, "auto", TRUE);
diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c
index aefd1034..a171596d 100644
--- a/src/fe-common/core/fe-channels.c
+++ b/src/fe-common/core/fe-channels.c
@@ -287,7 +287,7 @@ static void cmd_channel_add(const char *data)
if (g_hash_table_lookup(optlist, "noauto")) rec->autojoin = FALSE;
if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg);
if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg);
- if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password);
+ if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
signal_emit("channel add fill", 2, rec, optlist);
@@ -523,7 +523,7 @@ static void cmd_names(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
"names", &optlist, &channel))
return;
- if (strcmp(channel, "*") == 0 || *channel == '\0') {
+ if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
if (!IS_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
@@ -561,7 +561,7 @@ static void cmd_names(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
if (unknowns->len > 1)
g_string_truncate(unknowns, unknowns->len-1);
- if (unknowns->len > 0 && strcmp(channel, unknowns->str) != 0)
+ if (unknowns->len > 0 && g_strcmp0(channel, unknowns->str) != 0)
signal_emit("command names", 3, unknowns->str, server, item);
g_string_free(unknowns, TRUE);
diff --git a/src/fe-common/core/fe-exec.c b/src/fe-common/core/fe-exec.c
index 9249f432..b5f289ce 100644
--- a/src/fe-common/core/fe-exec.c
+++ b/src/fe-common/core/fe-exec.c
@@ -161,7 +161,7 @@ static PROCESS_REC *process_find(const char *name, int verbose)
for (tmp = processes; tmp != NULL; tmp = tmp->next) {
PROCESS_REC *rec = tmp->data;
- if (rec->name != NULL && strcmp(rec->name, name) == 0)
+ if (rec->name != NULL && g_strcmp0(rec->name, name) == 0)
return rec;
}
diff --git a/src/fe-common/core/fe-help.c b/src/fe-common/core/fe-help.c
index 4ea7c89f..23a6e701 100644
--- a/src/fe-common/core/fe-help.c
+++ b/src/fe-common/core/fe-help.c
@@ -37,12 +37,12 @@ static int commands_equal(COMMAND_REC *rec, COMMAND_REC *rec2)
if (rec2->category == NULL && rec->category != NULL)
return 1;
if (rec->category != NULL && rec2->category != NULL) {
- i = strcmp(rec->category, rec2->category);
+ i = g_strcmp0(rec->category, rec2->category);
if (i != 0)
return i;
}
- return strcmp(rec->cmd, rec2->cmd);
+ return g_strcmp0(rec->cmd, rec2->cmd);
}
static int get_cmd_length(void *data)
@@ -176,7 +176,7 @@ static void show_help(const char *data)
if (last != NULL && rec->category != NULL &&
(last->category == NULL ||
- strcmp(rec->category, last->category) != 0)) {
+ g_strcmp0(rec->category, last->category) != 0)) {
/* category changed */
if (items > 0) {
if (!header) {
diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c
index 1a0b8339..533cda31 100644
--- a/src/fe-common/core/fe-ignore.c
+++ b/src/fe-common/core/fe-ignore.c
@@ -165,7 +165,7 @@ static void cmd_ignore(const char *data)
rec = g_new0(IGNORE_REC, 1);
rec->mask = mask == NULL || *mask == '\0' ||
- strcmp(mask, "*") == 0 ? NULL : g_strdup(mask);
+ g_strcmp0(mask, "*") == 0 ? NULL : g_strdup(mask);
rec->channels = channels;
} else {
g_free_and_null(rec->pattern);
diff --git a/src/fe-common/core/fe-log.c b/src/fe-common/core/fe-log.c
index 9d68faf9..a39623d2 100644
--- a/src/fe-common/core/fe-log.c
+++ b/src/fe-common/core/fe-log.c
@@ -485,7 +485,7 @@ static void autolog_open_check(TEXT_DEST_REC *dest)
return;
if (target != NULL)
- autolog_open(server, server_tag, strcmp(target, "*") ? target : deftarget);
+ autolog_open(server, server_tag, g_strcmp0(target, "*") ? target : deftarget);
}
static void log_single_line(WINDOW_REC *window, const char *server_tag,
@@ -629,7 +629,7 @@ static void sig_log_create_failed(LOG_REC *log)
static void sig_log_new(LOG_REC *log)
{
if (!settings_get_bool("awaylog_colors") &&
- strcmp(log->fname, settings_get_str("awaylog_file")) == 0)
+ g_strcmp0(log->fname, settings_get_str("awaylog_file")) == 0)
log->colorizer = log_colorizer_strip;
}
diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c
index 1d44bdd9..3bd2b666 100644
--- a/src/fe-common/core/fe-messages.c
+++ b/src/fe-common/core/fe-messages.c
@@ -249,7 +249,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
int level = MSGLEVEL_MSGS;
/* own message returned by bouncer? */
- int own = (!strcmp(nick, server->nick));
+ int own = (!g_strcmp0(nick, server->nick));
query = query_find(server, own ? target : nick);
@@ -323,8 +323,8 @@ static void sig_message_own_private(SERVER_REC *server, const char *msg,
/* this should only happen if some special target failed and
we should display some error message. currently the special
targets are only ',' and '.'. */
- g_return_if_fail(strcmp(origtarget, ",") == 0 ||
- strcmp(origtarget, ".") == 0);
+ g_return_if_fail(g_strcmp0(origtarget, ",") == 0 ||
+ g_strcmp0(origtarget, ".") == 0);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
*origtarget == ',' ? TXT_NO_MSGS_GOT :
@@ -569,7 +569,7 @@ static int printnick_exists(NICK_REC *first, NICK_REC *ignore,
while (first != NULL) {
if (first != ignore) {
printnick = g_hash_table_lookup(printnicks, first);
- if (printnick != NULL && strcmp(printnick, nick) == 0)
+ if (printnick != NULL && g_strcmp0(printnick, nick) == 0)
return TRUE;
}
diff --git a/src/fe-common/core/fe-queries.c b/src/fe-common/core/fe-queries.c
index 5cdf87ee..121417e4 100644
--- a/src/fe-common/core/fe-queries.c
+++ b/src/fe-common/core/fe-queries.c
@@ -331,7 +331,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
QUERY_REC *query;
/* own message returned by bouncer? */
- int own = (!strcmp(nick, server->nick));
+ int own = (!g_strcmp0(nick, server->nick));
/* create query window if needed */
query = privmsg_get_query(server, own ? target : nick, FALSE, MSGLEVEL_MSGS);
diff --git a/src/fe-common/core/fe-recode.c b/src/fe-common/core/fe-recode.c
index dbc43574..829c89e7 100644
--- a/src/fe-common/core/fe-recode.c
+++ b/src/fe-common/core/fe-recode.c
@@ -45,7 +45,7 @@ static const char *fe_recode_get_target (WI_ITEM_REC *witem)
static int fe_recode_compare_func (CONFIG_NODE *node1, CONFIG_NODE *node2)
{
- return strcmp(node1->key, node2->key);
+ return g_strcmp0(node1->key, node2->key);
}
/* SYNTAX: RECODE */
diff --git a/src/fe-common/core/fe-server.c b/src/fe-common/core/fe-server.c
index 2dec1d8a..429e6dac 100644
--- a/src/fe-common/core/fe-server.c
+++ b/src/fe-common/core/fe-server.c
@@ -173,6 +173,10 @@ static void cmd_server_add(const char *data)
if (value != NULL && *value != '\0')
rec->ssl_capath = g_strdup(value);
+ value = g_hash_table_lookup(optlist, "ssl_ciphers");
+ if (value != NULL && *value != '\0')
+ rec->ssl_ciphers = g_strdup(value);
+
if ((rec->ssl_cafile != NULL && rec->ssl_cafile[0] != '\0')
|| (rec->ssl_capath != NULL && rec->ssl_capath[0] != '\0'))
rec->ssl_verify = TRUE;
@@ -185,7 +189,7 @@ static void cmd_server_add(const char *data)
if (g_hash_table_lookup(optlist, "proxy")) rec->no_proxy = FALSE;
if (g_hash_table_lookup(optlist, "noproxy")) rec->no_proxy = TRUE;
- if (*password != '\0' && strcmp(password, "-") != 0) rec->password = g_strdup(password);
+ if (*password != '\0' && g_strcmp0(password, "-") != 0) rec->password = g_strdup(password);
value = g_hash_table_lookup(optlist, "host");
if (value != NULL && *value != '\0') {
rec->own_host = g_strdup(value);
@@ -264,7 +268,7 @@ static void cmd_server_connect(const char *data)
"connect", &optlist, &addr))
return;
- if (*addr == '\0' || strcmp(addr, "+") == 0)
+ if (*addr == '\0' || g_strcmp0(addr, "+") == 0)
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*addr == '+') window_create(NULL, FALSE);
@@ -387,7 +391,7 @@ void fe_server_init(void)
command_bind("server remove", NULL, (SIGNAL_FUNC) cmd_server_remove);
command_bind_first("server", NULL, (SIGNAL_FUNC) server_command);
command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command);
- command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath auto noauto proxy noproxy -host -port noautosendcmd");
+ command_set_options("server add", "4 6 !! ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers auto noauto proxy noproxy -host -port noautosendcmd");
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c
index 96e03ceb..9c370838 100644
--- a/src/fe-common/core/fe-settings.c
+++ b/src/fe-common/core/fe-settings.c
@@ -53,7 +53,7 @@ static void set_print_pattern(const char *pattern)
if (stristr(rec->key, pattern) == NULL)
continue;
- if (strcmp(last_section, rec->section) != 0) {
+ if (g_strcmp0(last_section, rec->section) != 0) {
/* print section */
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
TXT_SET_TITLE, rec->section);
diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c
index 4b914517..87c5d467 100644
--- a/src/fe-common/core/hilight-text.c
+++ b/src/fe-common/core/hilight-text.c
@@ -66,7 +66,7 @@ static void hilight_add_config(HILIGHT_REC *rec)
g_return_if_fail(rec != NULL);
node = iconfig_node_traverse("(hilights", TRUE);
- node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, NULL, NODE_TYPE_BLOCK);
iconfig_node_set_str(node, "text", rec->text);
if (rec->level > 0) iconfig_node_set_int(node, "level", rec->level);
@@ -81,7 +81,7 @@ static void hilight_add_config(HILIGHT_REC *rec)
if (rec->servertag) iconfig_node_set_str(node, "servertag", rec->servertag);
if (rec->channels != NULL && *rec->channels != NULL) {
- node = config_node_section(node, "channels", NODE_TYPE_LIST);
+ node = iconfig_node_section(node, "channels", NODE_TYPE_LIST);
iconfig_node_add_list(node, rec->channels);
}
}
@@ -168,7 +168,7 @@ static HILIGHT_REC *hilight_find(const char *text, char **channels)
if ((channels == NULL && rec->channels == NULL))
return rec; /* no channels - ok */
- if (channels != NULL && strcmp(*channels, "*") == 0)
+ if (channels != NULL && g_strcmp0(*channels, "*") == 0)
return rec; /* ignore channels */
if (channels == NULL || rec->channels == NULL)
@@ -306,7 +306,7 @@ void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
dest->hilight_priority = rec->priority;
g_free_and_null(dest->hilight_color);
- if (rec->act_color != NULL && strcmp(rec->act_color, "%n") == 0)
+ if (rec->act_color != NULL && g_strcmp0(rec->act_color, "%n") == 0)
dest->level |= MSGLEVEL_NO_ACT;
else
dest->hilight_color = hilight_get_act_color(rec);
@@ -337,14 +337,14 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
old_level = dest->level;
if (!nick_match || (dest->level & MSGLEVEL_HILIGHT)) {
- /* update the level / hilight info */
- hilight_update_text_dest(dest, hilight);
/* Remove NO_ACT, this means explicitly defined hilights will bypass
* /IGNORE ... NO_ACT.
* (It's still possible to use /hilight -actcolor %n to hide
* hilight/beep).
*/
dest->level &= ~MSGLEVEL_NO_ACT;
+ /* update the level / hilight info */
+ hilight_update_text_dest(dest, hilight);
}
if (nick_match)
@@ -471,7 +471,7 @@ static void read_hilight_config(void)
rec->servertag = config_node_get_str(node, "servertag", NULL);
hilight_init_rec(rec);
- node = config_node_section(node, "channels", -1);
+ node = iconfig_node_section(node, "channels", -1);
if (node != NULL) rec->channels = config_node_get_list(node);
}
diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c
index bec1502e..f138d4e2 100644
--- a/src/fe-common/core/keyboard.c
+++ b/src/fe-common/core/keyboard.c
@@ -118,7 +118,7 @@ static CONFIG_NODE *key_config_find(const char *key)
for (; tmp != NULL; tmp = config_node_next(tmp)) {
node = tmp->data;
- if (strcmp(config_node_get_str(node, "key", ""), key) == 0)
+ if (g_strcmp0(config_node_get_str(node, "key", ""), key) == 0)
return node;
}
@@ -135,7 +135,7 @@ static void keyconfig_save(const char *id, const char *key, const char *data)
node = key_config_find(key);
if (node == NULL) {
node = iconfig_node_traverse("(keyboard", TRUE);
- node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, NULL, NODE_TYPE_BLOCK);
}
iconfig_node_set_str(node, "key", key);
@@ -211,7 +211,7 @@ static int expand_combo(const char *start, const char *end, GSList **out)
for (tmp = info->keys; tmp != NULL; tmp = tmp->next) {
KEY_REC *rec = tmp->data;
- if (strcmp(rec->data, str) == 0)
+ if (g_strcmp0(rec->data, str) == 0)
list = g_slist_append(list, rec);
}
@@ -347,7 +347,7 @@ static void key_states_scan_key(const char *key, KEY_REC *rec)
{
GSList *tmp, *out;
- if (strcmp(rec->info->id, "key") == 0)
+ if (g_strcmp0(rec->info->id, "key") == 0)
return;
out = g_slist_append(NULL, g_string_new(NULL));
@@ -383,7 +383,7 @@ static void key_states_rescan(void)
g_tree_foreach(key_states, (GTraverseFunc) key_state_destroy,
NULL);
g_tree_destroy(key_states);
- key_states = g_tree_new((GCompareFunc) strcmp);
+ key_states = g_tree_new((GCompareFunc) g_strcmp0);
temp = g_string_new(NULL);
g_hash_table_foreach(keys, (GHFunc) key_states_scan_key, temp);
@@ -860,7 +860,7 @@ void keyboard_init(void)
default_keys = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
keyinfos = NULL;
- key_states = g_tree_new((GCompareFunc) strcmp);
+ key_states = g_tree_new((GCompareFunc) g_strcmp0);
key_config_frozen = 0;
memset(used_keys, 0, sizeof(used_keys));
diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c
index db11fae1..4ae26950 100644
--- a/src/fe-common/core/module-formats.c
+++ b/src/fe-common/core/module-formats.c
@@ -42,8 +42,8 @@ FORMAT_REC fecommon_core_formats[] = {
{ "window_set_immortal", "Window is now immortal", 0 },
{ "window_unset_immortal", "Window isn't immortal anymore", 0 },
{ "window_immortal_error", "Window is immortal, if you really want to close it, say /WINDOW IMMORTAL OFF", 0 },
- { "windowlist_header", "%#Ref Name Active item Server Level", 0 },
- { "windowlist_line", "%#$[3]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } },
+ { "windowlist_header", "%#Ref Name Active item Server Level", 0 },
+ { "windowlist_line", "%#$[4]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } },
{ "windowlist_footer", "", 0 },
{ "windows_layout_saved", "Layout of windows is now remembered", 0 },
{ "windows_layout_reset", "Layout of windows reset to defaults", 0 },
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index c0741cef..58e7b557 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -739,7 +739,7 @@ static void theme_read_formats(THEME_REC *theme, const char *module,
node = config_node_traverse(config, "formats", FALSE);
if (node == NULL) return;
- node = config_node_section(node, module, -1);
+ node = config_node_section(config, node, module, -1);
if (node == NULL) return;
for (tmp = node->value; tmp != NULL; tmp = tmp->next) {
@@ -895,7 +895,7 @@ THEME_REC *theme_load(const char *setname)
name = g_strdup(setname);
p = strrchr(name, '.');
- if (p != NULL && strcmp(p, ".theme") == 0) {
+ if (p != NULL && g_strcmp0(p, ".theme") == 0) {
/* remove the trailing .theme */
*p = '\0';
}
@@ -1177,7 +1177,7 @@ static void module_save(const char *module, MODULE_THEME_REC *rec,
fnode = config_node_traverse(data->config, "formats", TRUE);
- node = config_node_section(fnode, rec->name, NODE_TYPE_BLOCK);
+ node = config_node_section(data->config, fnode, rec->name, NODE_TYPE_BLOCK);
for (n = 1; formats[n].def != NULL; n++) {
if (rec->formats[n] != NULL) {
config_node_set_str(data->config, node, formats[n].tag,
@@ -1358,9 +1358,9 @@ static void read_settings(void)
theme = settings_get_str("theme");
len = strlen(current_theme->name);
- if (strcmp(current_theme->name, theme) != 0 &&
+ if (g_strcmp0(current_theme->name, theme) != 0 &&
(strncmp(current_theme->name, theme, len) != 0 ||
- strcmp(theme+len, ".theme") != 0))
+ g_strcmp0(theme+len, ".theme") != 0))
change_theme(theme, TRUE);
}
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c
index 61357324..c6ab68c0 100644
--- a/src/fe-common/core/window-commands.c
+++ b/src/fe-common/core/window-commands.c
@@ -127,7 +127,7 @@ static void cmd_window_info(WINDOW_REC *win)
win->active_server->tag : "NONE");
} else {
if (win->active_server != NULL &&
- strcmp(win->active_server->tag, win->servertag) != 0)
+ g_strcmp0(win->active_server->tag, win->servertag) != 0)
g_warning("Active server isn't the sticky server!");
printformat_window(win, MSGLEVEL_CLIENTCRAP,
@@ -609,7 +609,7 @@ static void cmd_window_name(const char *data)
if (win == NULL || win == active_win)
window_set_name(active_win, data);
else if (active_win->name == NULL ||
- strcmp(active_win->name, data) != 0) {
+ g_strcmp0(active_win->name, data) != 0) {
printformat_window(active_win, MSGLEVEL_CLIENTERROR,
TXT_WINDOW_NAME_NOT_UNIQUE, data);
}
diff --git a/src/fe-common/core/windows-layout.c b/src/fe-common/core/windows-layout.c
index 54d7dcbf..8ebcc12d 100644
--- a/src/fe-common/core/windows-layout.c
+++ b/src/fe-common/core/windows-layout.c
@@ -127,6 +127,7 @@ static void sig_layout_restore(void)
for (; tmp != NULL; tmp = config_node_next(tmp)) {
CONFIG_NODE *node = tmp->data;
+ if (node->key == NULL) continue;
window = window_find_refnum(atoi(node->key));
if (window == NULL)
window = window_create(NULL, TRUE);
@@ -143,7 +144,7 @@ static void sig_layout_restore(void)
if (window->theme_name != NULL)
window->theme = theme_load(window->theme_name);
- window_add_items(window, config_node_section(node, "items", -1));
+ window_add_items(window, iconfig_node_section(node, "items", -1));
signal_emit("layout restore window", 2, window, node);
}
}
@@ -160,7 +161,7 @@ static void sig_layout_save_item(WINDOW_REC *window, WI_ITEM_REC *item,
if (type == NULL)
return;
- subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
+ subnode = iconfig_node_section(node, NULL, NODE_TYPE_BLOCK);
iconfig_node_set_str(subnode, "type", type);
proto = item->chat_type == 0 ? NULL :
@@ -185,7 +186,7 @@ static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
{
GSList *tmp;
- node = config_node_section(node, "items", NODE_TYPE_LIST);
+ node = iconfig_node_section(node, "items", NODE_TYPE_LIST);
for (tmp = window->items; tmp != NULL; tmp = tmp->next)
signal_emit("layout save item", 3, window, tmp->data, node);
}
@@ -195,7 +196,7 @@ static void window_save(WINDOW_REC *window, CONFIG_NODE *node)
char refnum[MAX_INT_STRLEN];
ltoa(refnum, window->refnum);
- node = config_node_section(node, refnum, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, refnum, NODE_TYPE_BLOCK);
if (window->sticky_refnum)
iconfig_node_set_bool(node, "sticky_refnum", TRUE);
diff --git a/src/fe-common/irc/dcc/fe-dcc-chat.c b/src/fe-common/irc/dcc/fe-dcc-chat.c
index 101aeb31..e2706ba3 100644
--- a/src/fe-common/irc/dcc/fe-dcc-chat.c
+++ b/src/fe-common/irc/dcc/fe-dcc-chat.c
@@ -243,7 +243,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
return;
/* handle only DCC messages */
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
dcc = item_get_dcc(item);
else if (*target == '=')
dcc = dcc_chat_find_id(target+1);
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index d6c02d9f..ec7669ab 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -427,7 +427,7 @@ static void event_no_such_nick(IRC_SERVER_REC *server, const char *data,
g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &unick);
- if (!strcmp(unick, "*"))
+ if (!g_strcmp0(unick, "*"))
/* more information will be in the description,
* e.g. * :Target left IRC. Failed to deliver: [hi] */
print_event_received(server, data, nick, FALSE);
@@ -605,7 +605,7 @@ static void print_event_received(IRC_SERVER_REC *server, const char *data,
recoded = recode_in(SERVER(server), args, NULL);
format = nick == NULL || server->real_address == NULL ||
- strcmp(nick, server->real_address) == 0 ?
+ g_strcmp0(nick, server->real_address) == 0 ?
IRCTXT_DEFAULT_EVENT : IRCTXT_DEFAULT_EVENT_SERVER;
printformat(server, target, MSGLEVEL_CRAP, format,
nick, recoded, current_server_event);
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index b380c214..a23facbd 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -110,7 +110,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &msg))
return;
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
target = item == NULL ? "" : window_item_get_target(item);
if (*target == '\0' || *msg == '\0')
@@ -133,7 +133,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata))
return;
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
target = item == NULL ? "" : window_item_get_target(item);
if (*target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
@@ -162,7 +162,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &text))
return;
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
target = item == NULL ? "" : window_item_get_target(item);
if (*target == '\0' || *text == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
@@ -262,7 +262,7 @@ static void cmd_ban(const char *data, IRC_SERVER_REC *server,
if (chanrec == NULL && *channel == '\0')
cmd_param_error(CMDERR_NOT_JOINED);
- if (*channel != '\0' && strcmp(channel, "*") != 0)
+ if (*channel != '\0' && g_strcmp0(channel, "*") != 0)
chanrec = irc_channel_find(server, channel);
if (chanrec == NULL || !chanrec->synced) {
diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c
index 314f4f53..94d1ad4a 100644
--- a/src/fe-common/irc/fe-irc-messages.c
+++ b/src/fe-common/irc/fe-irc-messages.c
@@ -178,7 +178,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
if (ischannel(*target)) {
item = irc_channel_find(server, target);
} else {
- own = (!strcmp(nick, server->nick));
+ own = (!g_strcmp0(nick, server->nick));
item = privmsg_get_query(SERVER(server), own ? target : nick, FALSE, level);
}
diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c
index abde1112..2cb99a2f 100644
--- a/src/fe-common/irc/fe-irc-server.c
+++ b/src/fe-common/irc/fe-irc-server.c
@@ -52,6 +52,7 @@ const char *get_visible_target(IRC_SERVER_REC *server, const char *target)
}
/* SYNTAX: SERVER ADD [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
+ [-ssl_ciphers <list>]
[-auto | -noauto] [-network <network>] [-host <hostname>]
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>]
<address> [<port> [<password>]] */
@@ -121,6 +122,8 @@ static void cmd_server_list(const char *data)
g_string_append_printf(str, "ssl_cafile: %s, ", rec->ssl_cafile);
if (rec->ssl_capath)
g_string_append_printf(str, "ssl_capath: %s, ", rec->ssl_capath);
+ if (rec->ssl_ciphers)
+ g_string_append_printf(str, "ssl_ciphers: %s, ", rec->ssl_ciphers);
}
if (rec->max_cmds_at_once > 0)
diff --git a/src/fe-common/irc/fe-modes.c b/src/fe-common/irc/fe-modes.c
index 027d7a76..e5317c0f 100644
--- a/src/fe-common/irc/fe-modes.c
+++ b/src/fe-common/irc/fe-modes.c
@@ -135,7 +135,7 @@ static void msg_multi_mode(IRC_CHANNEL_REC *channel, const char *sender,
signal_add("print starting", (SIGNAL_FUNC) sig_print_starting);
rec = mode_find_channel(channel);
- if (rec != NULL && strcmp(rec->mode, mode) != 0) {
+ if (rec != NULL && g_strcmp0(rec->mode, mode) != 0) {
/* different mode than last time, show and remove the old */
print_mode(rec);
mode_destroy(rec);
diff --git a/src/fe-common/irc/fe-whois.c b/src/fe-common/irc/fe-whois.c
index a9c3775e..117df120 100644
--- a/src/fe-common/irc/fe-whois.c
+++ b/src/fe-common/irc/fe-whois.c
@@ -134,8 +134,8 @@ static void event_whois_realhost(IRC_SERVER_REC *server, const char *data)
/* <yournick> real hostname <nick> <hostname> */
params = event_get_params(data, 5, NULL, &nick, &txt_real,
&txt_hostname, &hostname);
- if (strcmp(txt_real, "real") != 0 ||
- strcmp(txt_hostname, "hostname") != 0) {
+ if (g_strcmp0(txt_real, "real") != 0 ||
+ g_strcmp0(txt_hostname, "hostname") != 0) {
/* <yournick> <nick> :... from <hostname> */
g_free(params);
params = event_get_params(data, 3, NULL, &nick, &hostname);
@@ -219,7 +219,7 @@ static void event_whois_usermode(IRC_SERVER_REC *server, const char *data)
params = event_get_params(data, 4, NULL, &txt_usermodes,
&nick, &usermode);
- if (strcmp(txt_usermodes, "usermodes") == 0) {
+ if (g_strcmp0(txt_usermodes, "usermodes") == 0) {
/* <yournick> usermodes <nick> usermode */
printformat(server, nick, MSGLEVEL_CRAP,
IRCTXT_WHOIS_USERMODE, nick, usermode);
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index e93f2293..edc4c55d 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -392,7 +392,7 @@ static void sig_gui_key_pressed(gpointer keyp)
str[g_unichar_to_utf8(key, str)] = '\0';
}
- if (strcmp(str, "^") == 0) {
+ if (g_strcmp0(str, "^") == 0) {
/* change it as ^-, that is an invalid control char */
str[1] = '-';
str[2] = '\0';
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index 77033d7a..6d5b9b13 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -310,6 +310,7 @@ int main(int argc, char **argv)
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL },
{ NULL }
};
+ int loglev;
#ifdef USE_GC
g_mem_set_vtable(&gc_mem_table);
@@ -352,6 +353,7 @@ int main(int argc, char **argv)
you have to call setlocale(LC_ALL, "") */
setlocale(LC_ALL, "");
+ loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL);
textui_init();
if (!dummy && !term_init()) {
@@ -360,6 +362,7 @@ int main(int argc, char **argv)
return 1;
}
+ g_log_set_always_fatal(loglev);
textui_finish_init();
main_loop = g_main_new(TRUE);
diff --git a/src/fe-text/lastlog.c b/src/fe-text/lastlog.c
index 417eb484..166d2847 100644
--- a/src/fe-text/lastlog.c
+++ b/src/fe-text/lastlog.c
@@ -74,6 +74,25 @@ int cmd_options_get_level(const char *cmd, GHashTable *optlist)
return retlevel;
}
+static void prepend_date(WINDOW_REC *window, LINE_REC *rec, GString *line)
+{
+ THEME_REC *theme = NULL;
+ TEXT_DEST_REC dest = {0};
+ char *format = NULL, datestamp[20] = {0};
+ struct tm *tm = localtime(&rec->info.time);
+ int ret = 0;
+
+ theme = window->theme != NULL ? window->theme : current_theme;
+ format_create_dest(&dest, NULL, NULL, MSGLEVEL_LASTLOG, window);
+ format = format_get_text_theme(theme, MODULE_NAME, &dest, TXT_LASTLOG_DATE);
+
+ ret = strftime(datestamp, sizeof(datestamp), format, tm);
+ g_free(format);
+ if (ret <= 0) return;
+
+ g_string_prepend(line, datestamp);
+}
+
static void show_lastlog(const char *searchtext, GHashTable *optlist,
int start, int count, FILE *fhandle)
{
@@ -82,7 +101,7 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
GList *list, *tmp;
GString *line;
char *str;
- int level, before, after, len;
+ int level, before, after, len, date = FALSE;
level = cmd_options_get_level("lastlog", optlist);
if (level == -1) return; /* error in options */
@@ -132,6 +151,9 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
atoi(str) : DEFAULT_LASTLOG_AFTER;
}
+ if (g_hash_table_lookup(optlist, "date") != NULL)
+ date = TRUE;
+
list = textbuffer_find_text(WINDOW_GUI(window)->view->buffer, startline,
level, MSGLEVEL_LASTLOG,
searchtext, before, after,
@@ -199,6 +221,9 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
g_string_prepend(line, timestamp);
}
+ if (date == TRUE)
+ prepend_date(window, rec, line);
+
/* write to file/window */
if (fhandle != NULL) {
fwrite(line->str, line->len, 1, fhandle);
@@ -223,7 +248,7 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
}
/* SYNTAX: LASTLOG [-] [-file <filename>] [-window <ref#|name>] [-new | -away]
- [-<level> -<level...>] [-clear] [-count] [-case]
+ [-<level> -<level...>] [-clear] [-count] [-case] [-date]
[-regexp | -word] [-before [<#>]] [-after [<#>]]
[-<# before+after>] [<pattern>] [<count> [<start>]] */
static void cmd_lastlog(const char *data)
@@ -285,7 +310,7 @@ void lastlog_init(void)
{
command_bind("lastlog", NULL, (SIGNAL_FUNC) cmd_lastlog);
- command_set_options("lastlog", "!- # force clear -file -window new away word regexp case count @a @after @before");
+ command_set_options("lastlog", "!- # force clear -file -window new away word regexp case count date @a @after @before");
}
void lastlog_deinit(void)
diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c
index 28fae924..020969e6 100644
--- a/src/fe-text/mainwindows-layout.c
+++ b/src/fe-text/mainwindows-layout.c
@@ -70,7 +70,7 @@ static void main_window_save(MAIN_WINDOW_REC *window, CONFIG_NODE *node)
char num[MAX_INT_STRLEN];
ltoa(num, window->active->refnum);
- node = config_node_section(node, num, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, num, NODE_TYPE_BLOCK);
iconfig_node_set_int(node, "first_line", window->first_line);
iconfig_node_set_int(node, "lines", window->height);
@@ -179,6 +179,7 @@ static void sig_layout_restore(void)
lower_window = NULL; lower_size = 0;
for (i = 0, tmp = sorted_config; i < windows_count; tmp = tmp->next, i++) {
CONFIG_NODE *node = tmp->data;
+ if (node->key == NULL) continue;
/* create a new window + mainwindow */
signal_emit("gui window create override", 1,
diff --git a/src/fe-text/module-formats.c b/src/fe-text/module-formats.c
index 1d905095..899827c2 100644
--- a/src/fe-text/module-formats.c
+++ b/src/fe-text/module-formats.c
@@ -33,6 +33,7 @@ FORMAT_REC gui_text_formats[] =
{ "lastlog_start", "{hilight Lastlog}:", 0 },
{ "lastlog_end", "{hilight End of Lastlog}", 0 },
{ "lastlog_separator", "--", 0 },
+ { "lastlog_date", "%%F ", 0 },
/* ---- */
{ NULL, "Windows", 0 },
diff --git a/src/fe-text/module-formats.h b/src/fe-text/module-formats.h
index 4eebfc3e..3fa8c511 100644
--- a/src/fe-text/module-formats.h
+++ b/src/fe-text/module-formats.h
@@ -10,6 +10,7 @@ enum {
TXT_LASTLOG_START,
TXT_LASTLOG_END,
TXT_LASTLOG_SEPARATOR,
+ TXT_LASTLOG_DATE,
TXT_FILL_2,
diff --git a/src/fe-text/statusbar-config.c b/src/fe-text/statusbar-config.c
index deaa1b5d..a47a709e 100644
--- a/src/fe-text/statusbar-config.c
+++ b/src/fe-text/statusbar-config.c
@@ -95,7 +95,7 @@ statusbar_config_find(STATUSBAR_GROUP_REC *group, const char *name)
for (tmp = group->config_bars; tmp != NULL; tmp = tmp->next) {
STATUSBAR_CONFIG_REC *config = tmp->data;
- if (strcmp(config->name, name) == 0)
+ if (g_strcmp0(config->name, name) == 0)
return config;
}
@@ -137,7 +137,7 @@ static void statusbar_read_item(STATUSBAR_CONFIG_REC *bar, CONFIG_NODE *node)
int priority, right_alignment;
priority = config_node_get_int(node, "priority", 0);
- right_alignment = strcmp(config_node_get_str(node, "alignment", ""), "right") == 0;
+ right_alignment = g_strcmp0(config_node_get_str(node, "alignment", ""), "right") == 0;
statusbar_item_config_create(bar, node->key,
priority, right_alignment);
}
@@ -177,7 +177,7 @@ static void statusbar_read(STATUSBAR_GROUP_REC *group, CONFIG_NODE *node)
bar->placement = STATUSBAR_TOP;
bar->position = config_node_get_int(node, "position", 0);
- node = config_node_section(node, "items", -1);
+ node = iconfig_node_section(node, "items", -1);
if (node != NULL) {
/* we're overriding the items - destroy the old */
while (bar->items != NULL)
@@ -227,7 +227,7 @@ static void read_statusbar_config_from_node(CONFIG_NODE *node)
CONFIG_NODE *items;
GSList *tmp;
- items = config_node_section(node, "items", -1);
+ items = iconfig_node_section(node, "items", -1);
if (items != NULL)
statusbar_read_items(items);
@@ -369,7 +369,7 @@ static void cmd_statusbar_reset(const char *data, void *server,
CONFIG_NODE *parent;
parent = iconfig_node_traverse("statusbar", TRUE);
- parent = config_node_section(parent, active_statusbar_group->name,
+ parent = iconfig_node_section(parent, active_statusbar_group->name,
NODE_TYPE_BLOCK);
iconfig_node_set_str(parent, node->key, NULL);
@@ -432,7 +432,7 @@ static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent)
CONFIG_NODE *node;
GSList *tmp;
- node = config_node_section(parent, "items", -1);
+ node = iconfig_node_section(parent, "items", -1);
if (node != NULL)
return node;
@@ -446,11 +446,11 @@ static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent)
/* since items list in config file overrides defaults,
we'll need to copy the whole list. */
- parent = config_node_section(parent, "items", NODE_TYPE_BLOCK);
+ parent = iconfig_node_section(parent, "items", NODE_TYPE_BLOCK);
for (tmp = bar->items; tmp != NULL; tmp = tmp->next) {
SBAR_ITEM_CONFIG_REC *rec = tmp->data;
- node = config_node_section(parent, rec->name,
+ node = iconfig_node_section(parent, rec->name,
NODE_TYPE_BLOCK);
if (rec->priority != 0)
iconfig_node_set_int(node, "priority", rec->priority);
@@ -487,7 +487,7 @@ static void cmd_statusbar_add(const char *data, void *server,
if (value != NULL) index = config_node_index(node, value)+1;
/* create/move item */
- node = config_node_section_index(node, name, index, NODE_TYPE_BLOCK);
+ node = iconfig_node_section_index(node, name, index, NODE_TYPE_BLOCK);
/* set the options */
value = g_hash_table_lookup(optlist, "priority");
@@ -511,7 +511,7 @@ static void cmd_statusbar_remove(const char *data, void *server,
if (node == NULL)
return;
- if (config_node_section(node, data, -1) != NULL)
+ if (iconfig_node_section(node, data, -1) != NULL)
iconfig_node_set_str(node, data, NULL);
else {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
@@ -545,9 +545,9 @@ static void cmd_statusbar(const char *data)
/* lookup/create the statusbar node */
node = iconfig_node_traverse("statusbar", TRUE);
- node = config_node_section(node, active_statusbar_group->name,
+ node = iconfig_node_section(node, active_statusbar_group->name,
NODE_TYPE_BLOCK);
- node = config_node_section(node, name, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, name, NODE_TYPE_BLOCK);
/* call the subcommand */
signal = g_strconcat("command statusbar ", cmd, NULL);
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c
index b340553f..5448243a 100644
--- a/src/fe-text/statusbar.c
+++ b/src/fe-text/statusbar.c
@@ -129,7 +129,7 @@ STATUSBAR_GROUP_REC *statusbar_group_find(const char *name)
for (tmp = statusbar_groups; tmp != NULL; tmp = tmp->next) {
STATUSBAR_GROUP_REC *rec = tmp->data;
- if (strcmp(rec->name, name) == 0)
+ if (g_strcmp0(rec->name, name) == 0)
return rec;
}
@@ -617,7 +617,7 @@ STATUSBAR_REC *statusbar_find(STATUSBAR_GROUP_REC *group, const char *name,
STATUSBAR_REC *rec = tmp->data;
if (rec->parent_window == window &&
- strcmp(rec->config->name, name) == 0)
+ g_strcmp0(rec->config->name, name) == 0)
return rec;
}
diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c
index d16987fe..0516cc5f 100644
--- a/src/fe-text/terminfo-core.c
+++ b/src/fe-text/terminfo-core.c
@@ -646,11 +646,11 @@ static int term_setup(TERM_REC *term)
str = g_string_new(NULL);
if (term->TI_sgr0)
g_string_append(str, term->TI_sgr0);
- if (term->TI_rmul && (term->TI_sgr0 == NULL || strcmp(term->TI_rmul, term->TI_sgr0) != 0))
+ if (term->TI_rmul && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmul, term->TI_sgr0) != 0))
g_string_append(str, term->TI_rmul);
- if (term->TI_rmso && (term->TI_sgr0 == NULL || strcmp(term->TI_rmso, term->TI_sgr0) != 0))
+ if (term->TI_rmso && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmso, term->TI_sgr0) != 0))
g_string_append(str, term->TI_rmso);
- if (term->TI_ritm && (term->TI_sgr0 == NULL || strcmp(term->TI_ritm, term->TI_sgr0) != 0))
+ if (term->TI_ritm && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0))
g_string_append(str, term->TI_ritm);
term->TI_normal = str->str;
g_string_free(str, FALSE);
diff --git a/src/irc/core/bans.c b/src/irc/core/bans.c
index 38c81aab..b60e681b 100644
--- a/src/irc/core/bans.c
+++ b/src/irc/core/bans.c
@@ -188,7 +188,7 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server,
item, &channel, &nicks)) return;
if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED);
if (*nicks == '\0') {
- if (strcmp(data, "*") != 0)
+ if (g_strcmp0(data, "*") != 0)
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
/* /BAN * or /UNBAN * - ban/unban everyone */
nicks = (char *) data;
@@ -318,7 +318,7 @@ static void cmd_unban(const char *data, IRC_SERVER_REC *server, void *item)
static void read_settings(void)
{
if (default_ban_type_str != NULL &&
- strcmp(default_ban_type_str, settings_get_str("ban_type")) == 0)
+ g_strcmp0(default_ban_type_str, settings_get_str("ban_type")) == 0)
return;
g_free_not_null(default_ban_type_str);
diff --git a/src/irc/core/channel-events.c b/src/irc/core/channel-events.c
index 6fdfeef3..6cb9b088 100644
--- a/src/irc/core/channel-events.c
+++ b/src/irc/core/channel-events.c
@@ -270,7 +270,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data, const char *nic
}
chanrec->joined = TRUE;
- if (strcmp(chanrec->name, channel) != 0) {
+ if (g_strcmp0(chanrec->name, channel) != 0) {
g_free(chanrec->name);
chanrec->name = g_strdup(channel);
}
diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c
index 7c3d3f5f..e7fb5067 100644
--- a/src/irc/core/irc-commands.c
+++ b/src/irc/core/irc-commands.c
@@ -72,7 +72,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &msg))
return;
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
target = item == NULL ? NULL : window_item_get_target(item);
if (target == NULL || *target == '\0' || *msg == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
@@ -99,7 +99,7 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata))
return;
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
target = item == NULL ? NULL : window_item_get_target(item);
if (target == NULL || *target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
@@ -133,7 +133,7 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata))
return;
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
target = item == NULL ? NULL : window_item_get_target(item);
if (target == NULL || *target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
@@ -238,7 +238,7 @@ static void cmd_invite(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *it
return;
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
- if (*channame == '\0' || strcmp(channame, "*") == 0) {
+ if (*channame == '\0' || g_strcmp0(channame, "*") == 0) {
if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
@@ -284,13 +284,13 @@ static void cmd_who(const char *data, IRC_SERVER_REC *server,
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
return;
- if (strcmp(channel, "*") == 0 || *channel == '\0') {
+ if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
channel = IRC_CHANNEL(item)->name;
}
- if (strcmp(channel, "**") == 0) {
+ if (g_strcmp0(channel, "**") == 0) {
/* ** displays all nicks.. */
*channel = '\0';
}
@@ -313,14 +313,14 @@ static void cmd_names(const char *data, IRC_SERVER_REC *server,
PARAM_FLAG_GETREST, "names", &optlist, &channel))
return;
- if (strcmp(channel, "*") == 0 || *channel == '\0') {
+ if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED);
channel = IRC_CHANNEL(item)->name;
}
- if (strcmp(channel, "**") == 0) {
+ if (g_strcmp0(channel, "**") == 0) {
/* ** displays all nicks.. */
irc_send_cmd(server, "NAMES");
} else {
@@ -409,7 +409,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
query = qserver = queryitem->name;
}
- if (strcmp(query, "*") == 0 &&
+ if (g_strcmp0(query, "*") == 0 &&
g_hash_table_lookup(optlist, "yes") == NULL)
cmd_param_error(CMDERR_NOT_GOOD_IDEA);
@@ -810,7 +810,7 @@ static void cmd_knockout(const char *data, IRC_SERVER_REC *server,
for (ptr = server->knockoutlist; ptr != NULL; ptr = ptr->next) {
rec = ptr->data;
if (channel == rec->channel &&
- !strcmp(rec->ban, banmasks))
+ !g_strcmp0(rec->ban, banmasks))
break;
}
if (ptr == NULL) {
diff --git a/src/irc/core/irc-queries.c b/src/irc/core/irc-queries.c
index ac1a72a1..72c17df1 100644
--- a/src/irc/core/irc-queries.c
+++ b/src/irc/core/irc-queries.c
@@ -67,13 +67,13 @@ static void check_query_changes(IRC_SERVER_REC *server, const char *nick,
if (query == NULL)
return;
- if (strcmp(query->name, nick) != 0) {
+ if (g_strcmp0(query->name, nick) != 0) {
/* upper/lowercase chars in nick changed */
query_change_nick(query, nick);
}
if (address != NULL && (query->address == NULL ||
- strcmp(query->address, address) != 0)) {
+ g_strcmp0(query->address, address) != 0)) {
/* host changed */
query_change_address(query, address);
}
@@ -109,7 +109,7 @@ static void event_nick(SERVER_REC *server, const char *data,
query = query_find(server, orignick);
if (query != NULL) {
params = event_get_params(data, 1, &nick);
- if (strcmp(query->name, nick) != 0)
+ if (g_strcmp0(query->name, nick) != 0)
query_change_nick(query, nick);
g_free(params);
}
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index baf8a0d2..c5e1e318 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -314,6 +314,8 @@ SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn)
void irc_server_connect(SERVER_REC *server)
{
+ g_return_if_fail(server != NULL);
+
if (!server_start_connect(server)) {
server_connect_unref(server->connrec);
g_free(server);
@@ -638,7 +640,7 @@ static void event_connected(IRC_SERVER_REC *server, const char *data, const char
params = event_get_params(data, 1, &nick);
- if (strcmp(server->nick, nick) != 0) {
+ if (g_strcmp0(server->nick, nick) != 0) {
/* nick changed unexpectedly .. connected via proxy, etc. */
g_free(server->nick);
server->nick = g_strdup(nick);
diff --git a/src/irc/core/irc-session.c b/src/irc/core/irc-session.c
index 42d82734..ea65d8a5 100644
--- a/src/irc/core/irc-session.c
+++ b/src/irc/core/irc-session.c
@@ -66,7 +66,7 @@ static void sig_session_save_server(IRC_SERVER_REC *server, CONFIG_REC *config,
config_node_set_bool(config, node, "emode_known", server->emode_known);
config_node_set_bool(config, node, "isupport_sent", server->isupport_sent);
- isupport = config_node_section(node, "isupport", NODE_TYPE_BLOCK);
+ isupport = config_node_section(config, node, "isupport", NODE_TYPE_BLOCK);
isupport_data.config = config;
isupport_data.node = isupport;
@@ -95,7 +95,7 @@ static void sig_session_restore_server(IRC_SERVER_REC *server,
(GCompareFunc) g_istr_equal);
}
- node = config_node_section(node, "isupport", -1);
+ node = config_node_section(NULL, node, "isupport", -1);
tmp = node == NULL ? NULL : config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp)) {
diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c
index ebaf4b8f..a812691c 100644
--- a/src/irc/core/modes.c
+++ b/src/irc/core/modes.c
@@ -398,7 +398,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
old_key = NULL;
}
- if (strcmp(newmode->str, channel->mode) != 0) {
+ if (g_strcmp0(newmode->str, channel->mode) != 0) {
g_free(channel->mode);
channel->mode = g_strdup(newmode->str);
@@ -842,7 +842,7 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server,
return;
}
- if (strcmp(target, "*") == 0) {
+ if (g_strcmp0(target, "*") == 0) {
if (!IS_IRC_CHANNEL(channel))
cmd_param_error(CMDERR_NOT_JOINED);
diff --git a/src/irc/core/servers-redirect.c b/src/irc/core/servers-redirect.c
index 518248cb..f0a285df 100644
--- a/src/irc/core/servers-redirect.c
+++ b/src/irc/core/servers-redirect.c
@@ -339,7 +339,7 @@ static GSList *redirect_cmd_list_find(GSList *list, const char *event)
while (list != NULL) {
const char *str = list->data;
- if (strcmp(str, event) == 0)
+ if (g_strcmp0(str, event) == 0)
break;
list = list->next->next;
}
@@ -365,7 +365,7 @@ static const char *redirect_match(REDIRECT_REC *redirect, const char *event,
use the default signal */
signal = NULL;
for (tmp = redirect->signals; tmp != NULL; tmp = tmp->next->next) {
- if (strcmp(tmp->data, event) == 0) {
+ if (g_strcmp0(tmp->data, event) == 0) {
signal = tmp->next->data;
break;
}
@@ -527,7 +527,7 @@ server_redirect_get(IRC_SERVER_REC *server, const char *prefix,
next = ptr->next;
r = ptr->data;
if (prefix != NULL && r->prefix != NULL &&
- strcmp(prefix, r->prefix)) {
+ g_strcmp0(prefix, r->prefix)) {
/* not from this server */
continue;
}
diff --git a/src/irc/dcc/dcc-autoget.c b/src/irc/dcc/dcc-autoget.c
index 4768641b..38170c56 100644
--- a/src/irc/dcc/dcc-autoget.c
+++ b/src/irc/dcc/dcc-autoget.c
@@ -57,7 +57,7 @@ static void sig_dcc_request(GET_DCC_REC *dcc, const char *nickaddr)
/* don't autoget files beginning with a dot, if download dir is
our home dir (stupid kludge for stupid people) */
if (*dcc->arg == '.' &&
- strcmp(settings_get_str("dcc_download_path"), "~") == 0)
+ g_strcmp0(settings_get_str("dcc_download_path"), "~") == 0)
return;
/* check file size limit, NOTE: it's still possible to send a
diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c
index 8ee4decd..e3dbe72d 100644
--- a/src/irc/dcc/dcc-chat.c
+++ b/src/irc/dcc/dcc-chat.c
@@ -191,7 +191,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
return;
/* handle only DCC messages */
- if (strcmp(target, "*") == 0)
+ if (g_strcmp0(target, "*") == 0)
dcc = item_get_dcc(item);
else if (*target == '=')
dcc = dcc_chat_find_id(target+1);
@@ -625,7 +625,7 @@ static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data,
g_strfreev(params);
return;
}
- passive = paramcount == 4 && strcmp(params[2], "0") == 0;
+ passive = paramcount == 4 && g_strcmp0(params[2], "0") == 0;
dcc = DCC_CHAT(dcc_find_request(DCC_CHAT_TYPE, nick, NULL));
if (dcc != NULL) {
diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c
index 69fdc746..1208b5c5 100644
--- a/src/irc/dcc/dcc-get.c
+++ b/src/irc/dcc/dcc-get.c
@@ -554,7 +554,7 @@ void cmd_dcc_receive(const char *data, DCC_GET_FUNC accept_func,
next = tmp->next;
if (IS_DCC_GET(dcc) && g_ascii_strcasecmp(dcc->nick, nick) == 0 &&
(dcc_is_waiting_user(dcc) || dcc->from_dccserver) &&
- (*fname == '\0' || strcmp(dcc->arg, fname) == 0)) {
+ (*fname == '\0' || g_strcmp0(dcc->arg, fname) == 0)) {
found = TRUE;
if (!dcc_is_passive(dcc))
accept_func(dcc);
diff --git a/src/irc/dcc/dcc.c b/src/irc/dcc/dcc.c
index 6f0d5c81..17f6c477 100644
--- a/src/irc/dcc/dcc.c
+++ b/src/irc/dcc/dcc.c
@@ -149,7 +149,7 @@ DCC_REC *dcc_find_request(int type, const char *nick, const char *arg)
if (dcc->type == type && !dcc_is_connected(dcc) &&
g_ascii_strcasecmp(dcc->nick, nick) == 0 &&
- (arg == NULL || strcmp(dcc->arg, arg) == 0))
+ (arg == NULL || g_strcmp0(dcc->arg, arg) == 0))
return dcc;
}
@@ -516,7 +516,7 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
next = tmp->next;
if (dcc->type == type && g_ascii_strcasecmp(dcc->nick, nick) == 0 &&
- (*arg == '\0' || strcmp(dcc->arg, arg) == 0)) {
+ (*arg == '\0' || g_strcmp0(dcc->arg, arg) == 0)) {
dcc_reject(dcc, server);
found = TRUE;
}
diff --git a/src/irc/notifylist/notify-setup.c b/src/irc/notifylist/notify-setup.c
index d6f91361..9ea481ca 100644
--- a/src/irc/notifylist/notify-setup.c
+++ b/src/irc/notifylist/notify-setup.c
@@ -30,7 +30,7 @@ void notifylist_add_config(NOTIFYLIST_REC *rec)
CONFIG_NODE *node;
node = iconfig_node_traverse("notifies", TRUE);
- node = config_node_section(node, rec->mask, NODE_TYPE_BLOCK);
+ node = iconfig_node_section(node, rec->mask, NODE_TYPE_BLOCK);
if (rec->away_check)
iconfig_node_set_bool(node, "away_check", TRUE);
@@ -39,7 +39,7 @@ void notifylist_add_config(NOTIFYLIST_REC *rec)
iconfig_node_set_str(node, "ircnets", NULL);
if (rec->ircnets != NULL && *rec->ircnets != NULL) {
- node = config_node_section(node, "ircnets", NODE_TYPE_LIST);
+ node = iconfig_node_section(node, "ircnets", NODE_TYPE_LIST);
iconfig_node_add_list(node, rec->ircnets);
}
}
@@ -73,7 +73,7 @@ void notifylist_read_config(void)
rec->mask = g_strdup(node->key);
rec->away_check = config_node_get_bool(node, "away_check", FALSE);
- node = config_node_section(node, "ircnets", -1);
+ node = iconfig_node_section(node, "ircnets", -1);
if (node != NULL) rec->ircnets = config_node_get_list(node);
}
}
diff --git a/src/irc/notifylist/notifylist.c b/src/irc/notifylist/notifylist.c
index b0b7ee1c..573f7a7f 100644
--- a/src/irc/notifylist/notifylist.c
+++ b/src/irc/notifylist/notifylist.c
@@ -91,7 +91,7 @@ int notifylist_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet)
if (rec->ircnets == NULL) return TRUE;
if (ircnet == NULL) return FALSE;
- if (strcmp(ircnet, "*") == 0) return TRUE;
+ if (g_strcmp0(ircnet, "*") == 0) return TRUE;
for (tmp = rec->ircnets; *tmp != NULL; tmp++) {
if (g_ascii_strcasecmp(*tmp, ircnet) == 0)
diff --git a/src/irc/proxy/dump.c b/src/irc/proxy/dump.c
index 80fd7c2e..3d7bf546 100644
--- a/src/irc/proxy/dump.c
+++ b/src/irc/proxy/dump.c
@@ -209,7 +209,7 @@ static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client)
void proxy_client_reset_nick(CLIENT_REC *client)
{
if (client->server == NULL ||
- strcmp(client->nick, client->server->nick) == 0)
+ g_strcmp0(client->nick, client->server->nick) == 0)
return;
proxy_outdata(client, ":%s!proxy NICK :%s\n",
diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c
index a1cda250..a560801d 100644
--- a/src/irc/proxy/listen.c
+++ b/src/irc/proxy/listen.c
@@ -84,7 +84,7 @@ static void grab_who(CLIENT_REC *client, const char *channel)
arg = g_string_new(channel);
for (tmp = list, count = 0; *tmp != NULL; tmp++, count++) {
- if (strcmp(*tmp, "0") == 0) {
+ if (g_strcmp0(*tmp, "0") == 0) {
/* /who 0 displays everyone */
**tmp = '*';
}
@@ -108,18 +108,18 @@ static void handle_client_connect_cmd(CLIENT_REC *client,
password = settings_get_str("irssiproxy_password");
- if (password != NULL && strcmp(cmd, "PASS") == 0) {
- if (strcmp(password, args) == 0)
+ if (password != NULL && g_strcmp0(cmd, "PASS") == 0) {
+ if (g_strcmp0(password, args) == 0)
client->pass_sent = TRUE;
else {
/* wrong password! */
remove_client(client);
return;
}
- } else if (strcmp(cmd, "NICK") == 0) {
+ } else if (g_strcmp0(cmd, "NICK") == 0) {
g_free_not_null(client->nick);
client->nick = g_strdup(args);
- } else if (strcmp(cmd, "USER") == 0) {
+ } else if (g_strcmp0(cmd, "USER") == 0) {
client->user_sent = TRUE;
}
@@ -147,12 +147,12 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
return;
}
- if (strcmp(cmd, "QUIT") == 0) {
+ if (g_strcmp0(cmd, "QUIT") == 0) {
remove_client(client);
return;
}
- if (strcmp(cmd, "PING") == 0) {
+ if (g_strcmp0(cmd, "PING") == 0) {
/* Reply to PING, if the target parameter is either
proxy_adress, our own nick or empty. */
char *params, *origin, *target;
@@ -170,7 +170,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
g_free(params);
}
- if (strcmp(cmd, "PROXY") == 0) {
+ if (g_strcmp0(cmd, "PROXY") == 0) {
if (g_ascii_strcasecmp(args, "CTCP ON") == 0) {
/* client wants all ctcps */
client->want_ctcp = 1;
@@ -206,11 +206,11 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
}
/* check if the command could be redirected */
- if (strcmp(cmd, "WHO") == 0)
+ if (g_strcmp0(cmd, "WHO") == 0)
grab_who(client, args);
- else if (strcmp(cmd, "WHOWAS") == 0)
+ else if (g_strcmp0(cmd, "WHOWAS") == 0)
proxy_redirect_event(client, "whowas", 1, args, -1);
- else if (strcmp(cmd, "WHOIS") == 0) {
+ else if (g_strcmp0(cmd, "WHOIS") == 0) {
char *p;
/* convert dots to spaces */
@@ -218,11 +218,11 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
if (*p == ',') *p = ' ';
proxy_redirect_event(client, "whois", 1, args, TRUE);
- } else if (strcmp(cmd, "ISON") == 0)
+ } else if (g_strcmp0(cmd, "ISON") == 0)
proxy_redirect_event(client, "ison", 1, args, -1);
- else if (strcmp(cmd, "USERHOST") == 0)
+ else if (g_strcmp0(cmd, "USERHOST") == 0)
proxy_redirect_event(client, "userhost", 1, args, -1);
- else if (strcmp(cmd, "MODE") == 0) {
+ else if (g_strcmp0(cmd, "MODE") == 0) {
/* convert dots to spaces */
char *slist, *str, mode, *p;
int argc;
@@ -258,7 +258,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
}
g_free(str);
g_free(slist);
- } else if (strcmp(cmd, "PRIVMSG") == 0) {
+ } else if (g_strcmp0(cmd, "PRIVMSG") == 0) {
/* send the message to other clients as well */
char *params, *target, *msg;
@@ -289,9 +289,9 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
}
ignore_next = FALSE;
g_free(params);
- } else if (strcmp(cmd, "PING") == 0) {
+ } else if (g_strcmp0(cmd, "PING") == 0) {
proxy_redirect_event(client, "ping", 1, NULL, TRUE);
- } else if (strcmp(cmd, "AWAY") == 0) {
+ } else if (g_strcmp0(cmd, "AWAY") == 0) {
/* set the away reason */
if (args != NULL) {
g_free(client->server->away_reason);
@@ -354,7 +354,7 @@ static void sig_listen(LISTEN_REC *listen)
rec->handle = sendbuf;
rec->host = g_strdup(host);
rec->port = port;
- if (strcmp(listen->ircnet, "*") == 0) {
+ if (g_strcmp0(listen->ircnet, "*") == 0) {
rec->proxy_address = g_strdup("irc.proxy");
rec->server = servers == NULL ? NULL : IRC_SERVER(servers->data);
} else {
@@ -423,7 +423,7 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line,
}
}
- if (strcmp(event, "event privmsg") == 0 &&
+ if (g_strcmp0(event, "event privmsg") == 0 &&
strstr(args, " :\001") != NULL &&
strstr(args, " :\001ACTION") == NULL) {
/* CTCP - either answer ourself or forward it to one client */
@@ -443,8 +443,8 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line,
return;
}
- if (strcmp(event, "event ping") == 0 ||
- strcmp(event, "event pong") == 0) {
+ if (g_strcmp0(event, "event ping") == 0 ||
+ g_strcmp0(event, "event pong") == 0) {
/* We want to answer ourself to PINGs and CTCPs.
Also hide PONGs from clients. */
g_free(event);
@@ -470,7 +470,7 @@ static void event_connected(IRC_SERVER_REC *server)
CLIENT_REC *rec = tmp->data;
if (rec->connected && rec->server == NULL &&
- (strcmp(rec->listen->ircnet, "*") == 0 ||
+ (g_strcmp0(rec->listen->ircnet, "*") == 0 ||
(chatnet != NULL &&
g_ascii_strcasecmp(chatnet, rec->listen->ircnet) == 0))) {
proxy_outdata(rec, ":%s NOTICE %s :Connected to server\n",
diff --git a/src/lib-config/get.c b/src/lib-config/get.c
index af02b048..a83686fd 100644
--- a/src/lib-config/get.c
+++ b/src/lib-config/get.c
@@ -38,12 +38,12 @@ CONFIG_NODE *config_node_find(CONFIG_NODE *node, const char *key)
return NULL;
}
-CONFIG_NODE *config_node_section(CONFIG_NODE *parent, const char *key, int new_type)
+CONFIG_NODE *config_node_section(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, int new_type)
{
- return config_node_section_index(parent, key, -1, new_type);
+ return config_node_section_index(rec, parent, key, -1, new_type);
}
-CONFIG_NODE *config_node_section_index(CONFIG_NODE *parent, const char *key,
+CONFIG_NODE *config_node_section_index(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key,
int index, int new_type)
{
CONFIG_NODE *node;
@@ -54,7 +54,6 @@ CONFIG_NODE *config_node_section_index(CONFIG_NODE *parent, const char *key,
node = key == NULL ? NULL : config_node_find(parent, key);
if (node != NULL) {
- g_return_val_if_fail(new_type == -1 || new_type == node->type, NULL);
nindex = g_slist_index(parent->value, node);
if (index >= 0 && nindex != index &&
nindex <= g_slist_length(parent->value)) {
@@ -62,7 +61,25 @@ CONFIG_NODE *config_node_section_index(CONFIG_NODE *parent, const char *key,
parent->value = g_slist_remove(parent->value, node);
parent->value = g_slist_insert(parent->value, node, index);
}
- return node;
+ if (!is_node_list(node)) {
+ int show_error = 0;
+
+ if (new_type != -1) {
+ config_node_remove(rec, parent, node);
+ node = NULL;
+ show_error = 1;
+ } else if (!g_hash_table_lookup_extended(rec->cache_nodes, node, NULL, NULL)) {
+ g_hash_table_insert(rec->cache_nodes, node, NULL);
+ show_error = 1;
+ }
+ if (show_error)
+ g_critical("Expected %s node at `..%s/%s' was of scalar type. Corrupt config?",
+ new_type == NODE_TYPE_LIST ? "list" : new_type == NODE_TYPE_BLOCK ? "block" : "section",
+ parent->key, key);
+ } else {
+ g_return_val_if_fail(new_type == -1 || new_type == node->type, NULL);
+ return node;
+ }
}
if (new_type == -1)
@@ -91,7 +108,21 @@ CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int crea
/* check if it already exists in cache */
node = g_hash_table_lookup(rec->cache, section);
- if (node != NULL) return node;
+ if (node != NULL) {
+ if (create) {
+ const char *path = strrchr(section, '/');
+ if (path == NULL) path = section;
+ else path++;
+ new_type = *path == '(' ? NODE_TYPE_LIST : NODE_TYPE_BLOCK;
+ if (node->type != new_type) {
+ g_critical("Expected %s node at `%s' was of %s type. Corrupt config?",
+ new_type == NODE_TYPE_LIST ? "list" : "block", section,
+ node->type == NODE_TYPE_LIST ? "list" : "block");
+ node->type = new_type;
+ }
+ }
+ return node;
+ }
new_type = -1;
@@ -99,9 +130,18 @@ CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int crea
list = g_strsplit(section, "/", -1);
for (tmp = list; *tmp != NULL; tmp++) {
is_list = **tmp == '(';
- if (create) new_type = is_list ? NODE_TYPE_LIST : NODE_TYPE_BLOCK;
+ if (create) {
+ CONFIG_NODE *tmpnode;
+
+ new_type = is_list ? NODE_TYPE_LIST : NODE_TYPE_BLOCK;
+ tmpnode = config_node_find(node, *tmp + is_list);
+ if (tmpnode != NULL && tmpnode->type != new_type) {
+ g_critical("Expected %s node at `%s' was of scalar type. Corrupt config?", is_list ? "list" : "block", section);
+ config_node_remove(rec, node, tmpnode);
+ }
+ }
- node = config_node_section(node, *tmp + is_list, new_type);
+ node = config_node_section(rec, node, *tmp + is_list, new_type);
if (node == NULL) {
g_strfreev(list);
return NULL;
@@ -109,9 +149,9 @@ CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int crea
}
g_strfreev(list);
- if (!is_node_list(node)) {
+ if (!is_node_list(node)) {
/* Will die. Better to not corrupt the config further in this case. */
- g_error("Attempt to use non-list node as list. Corrupt config?");
+ g_critical("Attempt to use non-list node `%s' as list. Corrupt config?", section);
return NULL;
}
diff --git a/src/lib-config/iconfig.h b/src/lib-config/iconfig.h
index 3d9eb931..91583e40 100644
--- a/src/lib-config/iconfig.h
+++ b/src/lib-config/iconfig.h
@@ -116,8 +116,8 @@ int config_set_bool(CONFIG_REC *rec, const char *section, const char *key, int v
CONFIG_NODE *config_node_find(CONFIG_NODE *node, const char *key);
/* Find the section from node - if not found create it unless new_type is -1.
You can also specify in new_type if it's NODE_TYPE_LIST or NODE_TYPE_BLOCK */
-CONFIG_NODE *config_node_section(CONFIG_NODE *parent, const char *key, int new_type);
-CONFIG_NODE *config_node_section_index(CONFIG_NODE *parent, const char *key,
+CONFIG_NODE *config_node_section(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, int new_type);
+CONFIG_NODE *config_node_section_index(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key,
int index, int new_type);
/* Find the section with the whole path.
Create the path if necessary if `create' is TRUE. */
diff --git a/src/lib-config/parse.c b/src/lib-config/parse.c
index 1b20195a..c106fc46 100644
--- a/src/lib-config/parse.c
+++ b/src/lib-config/parse.c
@@ -173,7 +173,7 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
if (key == NULL && node->type != NODE_TYPE_LIST)
return G_TOKEN_ERROR;
- newnode = config_node_section(node, key, NODE_TYPE_BLOCK);
+ newnode = config_node_section(rec, node, key, NODE_TYPE_BLOCK);
config_parse_loop(rec, newnode, (GTokenType) '}');
g_free_not_null(key);
@@ -188,7 +188,7 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
/* list */
if (key == NULL)
return G_TOKEN_ERROR;
- newnode = config_node_section(node, key, NODE_TYPE_LIST);
+ newnode = config_node_section(rec, node, key, NODE_TYPE_LIST);
config_parse_loop(rec, newnode, (GTokenType) ')');
g_free_not_null(key);
diff --git a/src/lib-config/set.c b/src/lib-config/set.c
index 61a101fb..7ca55871 100644
--- a/src/lib-config/set.c
+++ b/src/lib-config/set.c
@@ -104,8 +104,14 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key,
return;
}
+ if (node != NULL && !has_node_value(node)) {
+ g_critical("Expected scalar node at `..%s/%s' was of complex type. Corrupt config?",
+ parent->key, key);
+ config_node_remove(rec, parent, node);
+ node = NULL;
+ }
if (node != NULL) {
- if (strcmp(node->value, value) == 0)
+ if (g_strcmp0(node->value, value) == 0)
return;
g_free(node->value);
} else {
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index eb1bddee..793f9375 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -44,7 +44,7 @@ static int print_script_errors;
static char *perl_args[] = {"", "-e", "0"};
#define IS_PERL_SCRIPT(file) \
- (strlen(file) > 3 && strcmp(file+strlen(file)-3, ".pl") == 0)
+ (strlen(file) > 3 && g_strcmp0(file+strlen(file)-3, ".pl") == 0)
static void perl_script_destroy_package(PERL_SCRIPT_REC *script)
{
@@ -314,7 +314,7 @@ PERL_SCRIPT_REC *perl_script_find(const char *name)
for (tmp = perl_scripts; tmp != NULL; tmp = tmp->next) {
PERL_SCRIPT_REC *rec = tmp->data;
- if (strcmp(rec->name, name) == 0)
+ if (g_strcmp0(rec->name, name) == 0)
return rec;
}
@@ -331,7 +331,7 @@ PERL_SCRIPT_REC *perl_script_find_package(const char *package)
for (tmp = perl_scripts; tmp != NULL; tmp = tmp->next) {
PERL_SCRIPT_REC *rec = tmp->data;
- if (strcmp(rec->package, package) == 0)
+ if (g_strcmp0(rec->package, package) == 0)
return rec;
}
diff --git a/src/perl/perl-fe.c b/src/perl/perl-fe.c
index 8e8469e9..2abc75c0 100644
--- a/src/perl/perl-fe.c
+++ b/src/perl/perl-fe.c
@@ -170,7 +170,7 @@ static void cmd_load(const char *data, SERVER_REC *server, void *item)
return;
len = strlen(rootmodule);
- if (len > 3 && strcmp(rootmodule + len - 3, ".pl") == 0) {
+ if (len > 3 && g_strcmp0(rootmodule + len - 3, ".pl") == 0) {
/* make /LOAD script.pl work as expected */
signal_stop();
cmd_script_load(data);
diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c
index 1f602c66..007f7ad5 100644
--- a/src/perl/perl-signals.c
+++ b/src/perl/perl-signals.c
@@ -99,14 +99,14 @@ void perl_signal_args_to_c(
if (!SvOK(arg)) {
c_arg = NULL;
- } else if (strcmp(rec->args[n], "string") == 0) {
+ } else if (g_strcmp0(rec->args[n], "string") == 0) {
c_arg = SvPV_nolen(arg);
- } else if (strcmp(rec->args[n], "int") == 0) {
+ } else if (g_strcmp0(rec->args[n], "int") == 0) {
c_arg = (void *)SvIV(arg);
- } else if (strcmp(rec->args[n], "ulongptr") == 0) {
+ } else if (g_strcmp0(rec->args[n], "ulongptr") == 0) {
saved_args[n].v_ulong = SvUV(arg);
c_arg = &saved_args[n].v_ulong;
- } else if (strcmp(rec->args[n], "intptr") == 0) {
+ } else if (g_strcmp0(rec->args[n], "intptr") == 0) {
saved_args[n].v_int = SvIV(SvRV(arg));
c_arg = &saved_args[n].v_int;
} else if (strncmp(rec->args[n], "glistptr_", 9) == 0) {
@@ -122,7 +122,7 @@ void perl_signal_args_to_c(
}
av = (AV *)t;
- is_str = strcmp(rec->args[n]+9, "char*") == 0;
+ is_str = g_strcmp0(rec->args[n]+9, "char*") == 0;
gl = NULL;
count = av_len(av) + 1;
@@ -181,7 +181,7 @@ void perl_signal_args_to_c(
continue;
}
- if (strcmp(rec->args[n], "intptr") == 0) {
+ if (g_strcmp0(rec->args[n], "intptr") == 0) {
SV *t = SvRV(arg);
SvIOK_only(t);
SvIV_set(t, saved_args[n].v_int);
@@ -192,8 +192,8 @@ void perl_signal_args_to_c(
AV *av;
GList *gl, *tmp;
- is_iobject = strcmp(rec->args[n]+9, "iobject") == 0;
- is_str = strcmp(rec->args[n]+9, "char*") == 0;
+ is_iobject = g_strcmp0(rec->args[n]+9, "iobject") == 0;
+ is_str = g_strcmp0(rec->args[n]+9, "char*") == 0;
av = (AV *)SvRV(arg);
av_clear(av);
@@ -245,8 +245,8 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
GList *tmp, **ptr;
int is_iobject, is_str;
- is_iobject = strcmp(rec->args[n]+9, "iobject") == 0;
- is_str = strcmp(rec->args[n]+9, "char*") == 0;
+ is_iobject = g_strcmp0(rec->args[n]+9, "iobject") == 0;
+ is_str = g_strcmp0(rec->args[n]+9, "char*") == 0;
av = newAV();
ptr = arg;
@@ -258,22 +258,22 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
}
saved_args[n] = perlarg = newRV_noinc((SV *) av);
- } else if (strcmp(rec->args[n], "int") == 0)
+ } else if (g_strcmp0(rec->args[n], "int") == 0)
perlarg = newSViv((IV)arg);
else if (arg == NULL)
perlarg = &PL_sv_undef;
- else if (strcmp(rec->args[n], "string") == 0)
+ else if (g_strcmp0(rec->args[n], "string") == 0)
perlarg = new_pv(arg);
- else if (strcmp(rec->args[n], "ulongptr") == 0)
+ else if (g_strcmp0(rec->args[n], "ulongptr") == 0)
perlarg = newSViv(*(unsigned long *) arg);
- else if (strcmp(rec->args[n], "intptr") == 0)
+ else if (g_strcmp0(rec->args[n], "intptr") == 0)
saved_args[n] = perlarg = newRV_noinc(newSViv(*(int *) arg));
else if (strncmp(rec->args[n], "gslist_", 7) == 0) {
/* linked list - push as AV */
GSList *tmp;
int is_iobject;
- is_iobject = strcmp(rec->args[n]+7, "iobject") == 0;
+ is_iobject = g_strcmp0(rec->args[n]+7, "iobject") == 0;
av = newAV();
for (tmp = arg; tmp != NULL; tmp = tmp->next) {
sv = is_iobject ? iobject_bless((SERVER_REC *) tmp->data) :
@@ -282,12 +282,12 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
}
perlarg = newRV_noinc((SV *) av);
- } else if (strcmp(rec->args[n], "iobject") == 0) {
+ } else if (g_strcmp0(rec->args[n], "iobject") == 0) {
/* "irssi object" - any struct that has
"int type; int chat_type" as it's first
variables (server, channel, ..) */
perlarg = iobject_bless((SERVER_REC *) arg);
- } else if (strcmp(rec->args[n], "siobject") == 0) {
+ } else if (g_strcmp0(rec->args[n], "siobject") == 0) {
/* "simple irssi object" - any struct that has
int type; as it's first variable (dcc) */
perlarg = simple_iobject_bless((SERVER_REC *) arg);
@@ -317,7 +317,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
if (saved_args[n] == NULL)
continue;
- if (strcmp(rec->args[n], "intptr") == 0) {
+ if (g_strcmp0(rec->args[n], "intptr") == 0) {
int *val = arg;
*val = SvIV(SvRV(saved_args[n]));
} else if (strncmp(rec->args[n], "glistptr_", 9) == 0) {
@@ -338,7 +338,7 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
out = g_list_append(out, val);
}
- if (strcmp(rec->args[n]+9, "char*") == 0)
+ if (g_strcmp0(rec->args[n]+9, "char*") == 0)
g_list_foreach(*ret, (GFunc) g_free, NULL);
g_list_free(*ret);
*ret = out;
@@ -434,7 +434,7 @@ static void perl_signal_remove_list_one(GSList **siglist, PERL_SIGNAL_REC *rec)
#define sv_func_cmp(f1, f2) \
(f1 == f2 || (SvPOK(f1) && SvPOK(f2) && \
- strcmp(SvPV_nolen(f1), SvPV_nolen(f2)) == 0))
+ g_strcmp0(SvPV_nolen(f1), SvPV_nolen(f2)) == 0))
static void perl_signal_remove_list(GSList **list, SV *func)
{