1
0
mirror of https://github.com/irssi/irssi.git synced 2025-01-03 14:56:47 -05:00

Merge branch 'master' into irssiproxy

Conflicts:
	src/irc/proxy/listen.c
This commit is contained in:
dequis 2015-06-14 10:42:41 -03:00
commit 29fb0d9802
95 changed files with 540 additions and 494 deletions

View File

@ -15,6 +15,7 @@
-ssl_verify: Verifies the SSL certificate of the server. -ssl_verify: Verifies the SSL certificate of the server.
-ssl_cafile: The file with the list of CA certificates. -ssl_cafile: The file with the list of CA certificates.
-ssl_capath: The directory which contains the CA certificates. -ssl_capath: The directory which contains the CA certificates.
-ssl_ciphers: SSL cipher suite preference lists.
-noproxy: Ignores the global proxy configuration. -noproxy: Ignores the global proxy configuration.
-network: The network this connection belongs to. -network: The network this connection belongs to.
-host: The hostname you would like to connect from. -host: The hostname you would like to connect from.

View File

@ -14,6 +14,7 @@
-clear: Removes the previous results from the active window. -clear: Removes the previous results from the active window.
-count: Displays how many lines match. -count: Displays how many lines match.
-case: Performs a case-sensitive matching. -case: Performs a case-sensitive matching.
-date: Prepends each row with the message's date
-regexp: The given text pattern is a regular expression. -regexp: The given text pattern is a regular expression.
-word: The text must match full words. -word: The text must match full words.
-force: Forces to display the lastlog, even if it exceeds 1000 lines. -force: Forces to display the lastlog, even if it exceeds 1000 lines.
@ -34,7 +35,7 @@
/LASTLOG holiday /LASTLOG holiday
/LASTLOG 'is on vacation' 10 /LASTLOG 'is on vacation' 10
/LASTLOG -file -force ~/mike.log 'mike' /LASTLOG -force -file ~/mike.log 'mike'
/LASTLOG -hilight /LASTLOG -hilight
/LASTLOG -5 searchterm /LASTLOG -5 searchterm

View File

@ -7,8 +7,8 @@
-yes: Confirms that you want to receive a large amount of data. -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 If the exact name of a channel is given, the only information about this
channels will be displayed. channel is requested; otherwise, a list of all channels will be displayed.
%9Description:%9 %9Description:%9
@ -19,7 +19,16 @@
/LIST /LIST
/LIST -yes /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 %9See also:%9 QUOTE, STATS, WHOIS

View File

@ -22,6 +22,7 @@
-ssl_verify: Verifies the SSL certificate of the server. -ssl_verify: Verifies the SSL certificate of the server.
-ssl_cafile: The file with the list of CA certificates. -ssl_cafile: The file with the list of CA certificates.
-ssl_capath: The directory which contains the 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. -auto: Automatically connects to the server on startup.
-noauto: Doesn't connect to the server on startup. -noauto: Doesn't connect to the server on startup.
-network: The network the server belongs to. -network: The network the server belongs to.

View File

@ -1,12 +1,13 @@
.TH Irssi 1 "September 2002" "Irssi IRC client" .TH Irssi 1 "June 2015" "Irssi IRC client"
.SH NAME .SH NAME
Irssi \- a modular IRC client for UNIX Irssi \- a modular IRC client for UNIX
.SH SYNOPSIS .SH SYNOPSIS
.B irssi .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 .SH DESCRIPTION
.B Irssi .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 very secure. Being a fullscreen, termcap based client with many
features, features,
.B Irssi .B Irssi
@ -16,16 +17,15 @@ is easily extensible through scripts and modules.
.BI "\-\-config="FILE .BI "\-\-config="FILE
use use
.I FILE .I FILE
instead of ~/.irssi/config. instead of ~/.irssi/config
.TP .TP
.BI "\-\-home="PATH .BI "\-\-home="PATH
.I PATH .I PATH
specifies the home directory of Irssi. specifies the home directory of Irssi; default is
Default is
.BR ~/.irssi .BR ~/.irssi
.TP .TP
.BI "\-c, \-\-connect="SERVER .BI "\-c, \-\-connect="SERVER
connects to connect to
.I SERVER .I SERVER
.TP .TP
.BI "\-w, \-\-password="PASSWORD .BI "\-w, \-\-password="PASSWORD
@ -39,71 +39,53 @@ automatically connect to
on server. on server.
.TP .TP
.BI "\-!, \-\-noconnect" .BI "\-!, \-\-noconnect"
disables autoconnecting. disable autoconnecting of servers
.TP .TP
.BI "\-n, \-\-nick="NICKNAME .BI "\-n, \-\-nick="NICKNAME
specify specify
.I NICKNAME .I NICKNAME
as your nick. as your nick
.TP .TP
.BI "\-h, \-\-hostname="HOSTNAME .BI "\-h, \-\-hostname="HOSTNAME
use use
.I HOSTNAME .I HOSTNAME
for your irc session. for your irc session
.TP .TP
.BI "\-d, \-\-dummy" .BI "\-d, \-\-dummy"
use dummy terminal mode. use dummy terminal mode
.TP .TP
.BI "\-v, \-\-version" .BI "\-v, \-\-version"
display the version of Irssi. display the version of Irssi
.TP .TP
.BI "\-?, \-\-help" .BI "\-?, \-\-help"
show a help message. show a help message
.SH SEE ALSO .SH SEE ALSO
.B Irssi .B Irssi
has been supplied with a huge amount of documentation. Check /help or look has a solid amount of documentation available; check /HELP or look online
at the files contained by /usr/share/doc/irssi* at http://www.irssi.org
.SH FILES .SH FILES
.TP .TP
.I /etc/irssi.conf
Global configuration file
.TP
.I ~/.irssi/config .I ~/.irssi/config
Personal configuration file personal configuration file
.TP .TP
.I ~/.irssi/config.autosave .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 .TP
.I ~/.irssi/default.theme .I ~/.irssi/default.theme
Default irssi theme default irssi theme
.TP .TP
.I ~/.irssi/away.log .I ~/.irssi/away.log
Logged messages in away status 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
.TP .TP
.I ~/.irssi/scripts/ .I ~/.irssi/scripts/
Default scripts directory default scripts directory
.TP .TP
.I ~/.irssi/scripts/autorun/ .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 automatically on startup
.TP .TP
.I ~/.irssi/startup .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 .SH AUTHORS/CREDITS
.B Irssi .B Irssi
was written by Timo Sirainen was written by Timo Sirainen; this manpage was written by Istvan Sebestyen, Stefan Tomanek, Geert Hauwaerts.
.B <cras@irssi.org>
.sp
This manpage was written by Istvan Sebestyen
.BR <stevee@alphanet.ch>
and Stefan Tomanek
.BR <stefan@pico.ruhr.de>

View File

@ -11,7 +11,6 @@ script_DATA = \
mail.pl \ mail.pl \
mlock.pl \ mlock.pl \
quitmsg.pl \ quitmsg.pl \
sb_search.pl \
scriptassist.pl \ scriptassist.pl \
usercount.pl usercount.pl

View File

@ -5,13 +5,13 @@ use Irssi;
use strict; use strict;
use vars qw($VERSION %IRSSI); use vars qw($VERSION %IRSSI);
$VERSION = "1.00"; $VERSION = "1.10";
%IRSSI = ( %IRSSI = (
authors => 'Timo Sirainen', authors => 'Timo Sirainen & Jostein Kjønigsen',
name => 'autoop', name => 'autoop',
description => 'Simple auto-op script', description => 'Simple auto-op script',
license => 'Public Domain', license => 'Public Domain',
changed => 'Sun Mar 10 23:18 EET 2002' changed => 'Fri Nov 24 12:55 GMT+1 2014'
); );
my (%opnicks, %temp_opped); my (%opnicks, %temp_opped);
@ -64,7 +64,7 @@ sub autoop {
if (!$temp_opped{$nick} && if (!$temp_opped{$nick} &&
$server->masks_match($masks, $nick, $host)) { $server->masks_match($masks, $nick, $host)) {
$channel->command("op $nick"); $channel->command("/op $nick");
$temp_opped{$nick} = 1; $temp_opped{$nick} = 1;
} }
} }
@ -89,3 +89,68 @@ sub event_massjoin {
Irssi::command_bind('autoop', 'cmd_autoop'); Irssi::command_bind('autoop', 'cmd_autoop');
Irssi::signal_add_last('massjoin', 'event_massjoin'); 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;

View File

@ -1,6 +1,5 @@
# automatically rejoin to channel after kicked # automatically rejoin to channel after kick
# delayed rejoin: Lam 28.10.2001 (lam@lac.pl)
# /SET autorejoin_channels #channel1 #channel2 ...
# NOTE: I personally don't like this feature, in most channels I'm in it # 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 # will just result as ban. You've probably misunderstood the idea of /KICK
@ -10,26 +9,31 @@ use Irssi;
use Irssi::Irc; use Irssi::Irc;
use strict; use strict;
use vars qw($VERSION %IRSSI); use vars qw($VERSION %IRSSI);
$VERSION = "1.0.0";
$VERSION = "1.00";
%IRSSI = ( %IRSSI = (
authors => 'Timo Sirainen', authors => "Timo 'cras' Sirainen, Leszek Matok",
name => 'autorejoin', contact => "lam\@lac.pl",
description => 'Automatically rejoin to channel after kicked', name => "autorejoin",
license => 'Public Domain', description => "Automatically rejoin to channel after being kick, after a (short) user-defined delay",
changed => 'Sun Mar 10 23:18 EET 2002' license => "GPLv2",
changed => "10.3.2002 14:00"
); );
sub channel_rejoin {
my ($server, $channel) = @_;
# check if channel has password # How many seconds to wait before the rejoin?
my $chanrec = $server->channel_find($channel); # TODO: make this a /setting
my $password = $chanrec->{key} if ($chanrec); my $delay = 5;
# We have to use send_raw() because the channel record still my @tags;
# exists and irssi won't even try to join to it with command() my $acttag = 0;
$server->send_raw("JOIN $channel $password");
sub rejoin {
my ( $data ) = @_;
my ( $tag, $servtag, $channel, $pass ) = split( / +/, $data );
my $server = Irssi::server_find_tag( $servtag );
$server->send_raw( "JOIN $channel $pass" ) if ( $server );
Irssi::timeout_remove( $tags[$tag] );
} }
sub event_rejoin_kick { sub event_rejoin_kick {
@ -38,15 +42,16 @@ sub event_rejoin_kick {
return if ( $server->{ nick } ne $nick ); return if ( $server->{ nick } ne $nick );
# check if we want to autorejoin this channel # check if channel has password
my @chans = split(/[ ,]+/, Irssi::settings_get_str('autorejoin_channels')); my $chanrec = $server->channel_find( $channel );
foreach my $chan (@chans) { my $password = $chanrec->{ key } if ( $chanrec );
if (lc($chan) eq lc($channel)) { my $rejoinchan = $chanrec->{ name } if ( $chanrec );
channel_rejoin($server, $channel); my $servtag = $server->{ tag };
last;
} 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' );

View File

@ -40,7 +40,7 @@ use Data::Dumper;
my %suppress; my %suppress;
sub upgrade { 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"; print BUF join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
for my $window (windows) { for my $window (windows) {
next unless defined $window; next unless defined $window;
@ -66,7 +66,7 @@ sub upgrade {
} }
sub restore { 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>; my @suppress = split /\0/, <BUF>;
if (settings_get_bool 'upgrade_suppress_join') { if (settings_get_bool 'upgrade_suppress_join') {
chomp $suppress[-1]; chomp $suppress[-1];
@ -98,11 +98,10 @@ sub restore {
sub suppress { sub suppress {
my ($first, $second) = @_; my ($first, $second) = @_;
return return unless scalar keys %suppress and settings_get_bool 'upgrade_suppress_join';
unless scalar keys %suppress my $key_part = (grep { /^:?[#!+&]/ } split ' ', $second)[0];
and settings_get_bool 'upgrade_suppress_join'; $key_part =~ s/^://;
my $key = $first->{address} . my $key = $first->{address} . $key_part;
(grep { (s/^://, /^[#!+&]/) } split ' ', $second)[0];
if (exists $suppress{$key} and $suppress{$key}--) { if (exists $suppress{$key} and $suppress{$key}--) {
signal_stop(); signal_stop();
delete $suppress{$key} unless $suppress{$key}; delete $suppress{$key} unless $suppress{$key};

View File

@ -1,18 +1,24 @@
# /DNS <nick>|<host>|<ip> ... # /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 strict;
use Socket; use Socket;
use POSIX; use POSIX;
use vars qw($VERSION %IRSSI); use vars qw($VERSION %IRSSI);
$VERSION = "2.1"; $VERSION = "2.1.1";
%IRSSI = ( %IRSSI = (
authors => 'Timo Sirainen', authors => "Timo \'cras\' Sirainen",
name => 'dns', contact => "tss\@iki.fi",
description => '/DNS <nick>|<host>|<ip> ...', name => "dns",
license => 'Public Domain', description => "/DNS <nick>|<host>|<ip> ...",
changed => 'Sun Mar 10 23:23 EET 2002' license => "Public Domain",
url => "http://irssi.org/",
changed => "2002-03-04T22:47+0100"
); );
my (%resolve_hosts, %resolve_nicks, %resolve_print); # resolve queues my (%resolve_hosts, %resolve_nicks, %resolve_print); # resolve queues
@ -28,7 +34,7 @@ my $pipe_tag;
sub cmd_dns { sub cmd_dns {
my ($nicks, $server) = @_; my ($nicks, $server) = @_;
return if !$nicks; return if !$nicks;
$nicks =~ s/\s+$//;
# get list of nicks/hosts we want to know # get list of nicks/hosts we want to know
my $tag = !$server ? undef : $server->{tag}; my $tag = !$server ? undef : $server->{tag};
my $ask_nicks = ""; my $ask_nicks = "";

View File

@ -10,6 +10,7 @@
# There's a pretty good explanation of (ircnet) ircd's server kills in # There's a pretty good explanation of (ircnet) ircd's server kills in
# http://www.irc.org/tech_docs/ircnet/kills.html # http://www.irc.org/tech_docs/ircnet/kills.html
use strict;
use Irssi; use Irssi;
use vars qw($VERSION %IRSSI); use vars qw($VERSION %IRSSI);
@ -47,13 +48,13 @@ sub msg_quit {
my @printargs = (); my @printargs = ();
if ($killmsg =~ /([^ ]*) != (.*)/) { if ($killmsg =~ /([^ ]*) != (.*)/) {
# 1 != 2 # 1 != 2
my $server1 = $1, $server2 = $2; my $server1 = $1, my $server2 = $2;
$server1 =~ s/([^\[]*)\[([^\]]*)\]/\1/; $server1 =~ s/([^\[]*)\[([^\]]*)\]/\1/;
$msg .= "$2 != $server2"; $msg .= "$2 != $server2";
} elsif ($killmsg =~ /([^ ]*) <- (.*)/) { } elsif ($killmsg =~ /([^ ]*) <- (.*)/) {
# 1 <- 2 # 1 <- 2
my $server1 = $1, $server2 = $2; my $server1 = $1, my $server2 = $2;
if ($server1 =~ /^\(/) { if ($server1 =~ /^\(/) {
# (addr1)server1 <- (add2)server2 # (addr1)server1 <- (add2)server2
@ -84,9 +85,9 @@ sub msg_quit {
$msg = $killmsg; $msg = $killmsg;
} }
@list = $server->nicks_get_same($nick); my @list = $server->nicks_get_same($nick);
while (@list) { while (@list) {
$channel = $list[0]; my $channel = $list[0];
shift @list; shift @list;
# skip nick record # skip nick record
shift @list; shift @list;

View File

@ -1,3 +1,5 @@
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "2.92"; $VERSION = "2.92";
%IRSSI = ( %IRSSI = (
authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei", authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei",
@ -114,7 +116,7 @@ sub mbox_count {
$last_mtime = $mtime; $last_mtime = $mtime;
my $f = gensym; my $f = gensym;
return 0 if (!open($f, $mailfile)); return 0 if (!open($f, "<", $mailfile));
# count new mails only # count new mails only
my $internal_removed = 0; my $internal_removed = 0;

View File

@ -113,7 +113,7 @@ sub mlock_check_mode {
} }
if ($modecmd ne "") { if ($modecmd ne "") {
$channel->{server}->command("mode $channame $modecmd$extracmd"); $channel->{server}->command("/mode $channame $modecmd$extracmd");
} }
} }

View File

@ -21,7 +21,7 @@ sub cmd_quit {
my ($data, $server, $channel) = @_; my ($data, $server, $channel) = @_;
return if ($data ne ""); return if ($data ne "");
open (f, $quitfile) || return; open (f, "<", $quitfile) || return;
my $lines = 0; while(<f>) { $lines++; }; my $lines = 0; while(<f>) { $lines++; };
my $line = int(rand($lines))+1; my $line = int(rand($lines))+1;
@ -38,7 +38,7 @@ sub cmd_quit {
close(f); close(f);
foreach my $server (Irssi::servers) { foreach my $server (Irssi::servers) {
$server->command("disconnect ".$server->{tag}." $quitmsg"); $server->command("/disconnect ".$server->{tag}." $quitmsg");
} }
} }

View File

@ -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');

View File

@ -1,4 +1,6 @@
use strict;
use Irssi 20040119.2359 (); use Irssi 20040119.2359 ();
use vars qw($VERSION %IRSSI);
$VERSION = "1.19"; $VERSION = "1.19";
%IRSSI = ( %IRSSI = (
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas', authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
@ -29,7 +31,6 @@ $VERSION = "1.19";
# sb_uc_space = " "; # sb_uc_space = " ";
use strict;
use Irssi::TextUI; use Irssi::TextUI;
my ($ircops, $ops, $halfops, $voices, $normal, $total); my ($ircops, $ops, $halfops, $voices, $normal, $total);

View File

@ -52,6 +52,10 @@
#define g_slice_free(type, mem) g_free(mem) #define g_slice_free(type, mem) g_free(mem)
#endif #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 #ifdef USE_GC
# define g_free(x) G_STMT_START { (x) = NULL; } G_STMT_END # define g_free(x) G_STMT_START { (x) = NULL; } G_STMT_END
#endif #endif

View File

@ -40,7 +40,7 @@ static void channel_setup_save(CHANNEL_SETUP_REC *channel)
parentnode = iconfig_node_traverse("(channels", TRUE); parentnode = iconfig_node_traverse("(channels", TRUE);
node = config_node_nth(parentnode, index); node = config_node_nth(parentnode, index);
if (node == NULL) 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_clear(node);
iconfig_node_set_str(node, "name", channel->name); iconfig_node_set_str(node, "name", channel->name);

View File

@ -167,7 +167,7 @@ static GSList *servers_find_chatnet_except(SERVER_REC *server)
SERVER_REC *rec = tmp->data; SERVER_REC *rec = tmp->data;
if (server != rec && rec->connrec->chatnet != NULL && if (server != rec && rec->connrec->chatnet != NULL &&
strcmp(server->connrec->chatnet, g_strcmp0(server->connrec->chatnet,
rec->connrec->chatnet) == 0) { rec->connrec->chatnet) == 0) {
/* chatnets match */ /* chatnets match */
list = g_slist_append(list, rec); list = g_slist_append(list, rec);

View File

@ -58,7 +58,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
return NULL; return NULL;
} }
if (strcmp(password, "-") == 0) if (g_strcmp0(password, "-") == 0)
*password = '\0'; *password = '\0';
/* check if -<chatnet> option is used to specify chat protocol */ /* 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); conn->ssl_cafile = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "ssl_capath")) != NULL) if ((tmp = g_hash_table_lookup(optlist, "ssl_capath")) != NULL)
conn->ssl_capath = g_strdup(tmp); 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') if ((conn->ssl_capath != NULL && conn->ssl_capath[0] != '\0')
|| (conn->ssl_cafile != NULL && conn->ssl_cafile[0] != '\0')) || (conn->ssl_cafile != NULL && conn->ssl_cafile[0] != '\0'))
conn->ssl_verify = TRUE; 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>] /* SYNTAX: CONNECT [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>] [-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
[-ssl_ciphers <list>]
[-!] [-noautosendcmd] [-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>] [-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>] [-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>] /* SYNTAX: SERVER [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>] [-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
[-ssl_ciphers <list>]
[-!] [-noautosendcmd] [-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>] [-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>] [-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)) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg))
return; return;
if (*tag != '\0' && strcmp(tag, "*") != 0) { if (*tag != '\0' && g_strcmp0(tag, "*") != 0) {
server = server_find_tag(tag); server = server_find_tag(tag);
if (server == NULL) if (server == NULL)
server = server_find_lookup_tag(tag); 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; origtarget = target;
free_ret = FALSE; 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, target = parse_special(&target, server, item,
NULL, &free_ret, NULL, 0); NULL, &free_ret, NULL, 0);
if (target != NULL && *target == '\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 (target != NULL) {
if (strcmp(target, "*") == 0) { if (g_strcmp0(target, "*") == 0) {
/* send to active channel/query */ /* send to active channel/query */
if (item == NULL) if (item == NULL)
cmd_param_error(CMDERR_NOT_JOINED); 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("default command server", (SIGNAL_FUNC) sig_default_command_server);
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg); 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"); command_set_options("msg", "channel nick");
} }

View File

@ -36,7 +36,7 @@ static void chatnet_config_save(CHATNET_REC *chatnet)
CONFIG_NODE *node; CONFIG_NODE *node;
node = iconfig_node_traverse("chatnets", TRUE); 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_clear(node);
iconfig_node_set_str(node, "type", chat_protocol_find_id(chatnet->chat_type)->name); iconfig_node_set_str(node, "type", chat_protocol_find_id(chatnet->chat_type)->name);

View File

@ -674,7 +674,7 @@ get_optional_channel(WI_ITEM_REC *active_item, char **data, int require_name)
origtmp = tmp = g_strdup(*data); origtmp = tmp = g_strdup(*data);
channel = cmd_get_param(&tmp); channel = cmd_get_param(&tmp);
if (strcmp(channel, "*") == 0 && !require_name) { if (g_strcmp0(channel, "*") == 0 && !require_name) {
/* "*" means active channel */ /* "*" means active channel */
cmd_get_param(data); cmd_get_param(data);
ret = window_item_get_target(active_item); ret = window_item_get_target(active_item);

View File

@ -201,10 +201,10 @@ IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask,
char **chan; char **chan;
int ignore_servertag; int ignore_servertag;
if (mask != NULL && (*mask == '\0' || strcmp(mask, "*") == 0)) if (mask != NULL && (*mask == '\0' || g_strcmp0(mask, "*") == 0))
mask = NULL; 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) { for (tmp = ignores; tmp != NULL; tmp = tmp->next) {
IGNORE_REC *rec = tmp->data; 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)) if ((channels == NULL && rec->channels == NULL))
return rec; /* no channels - ok */ return rec; /* no channels - ok */
if (channels != NULL && strcmp(*channels, "*") == 0) if (channels != NULL && g_strcmp0(*channels, "*") == 0)
return rec; /* ignore channels */ return rec; /* ignore channels */
if (channels == NULL || rec->channels == NULL) if (channels == NULL || rec->channels == NULL)
@ -263,7 +263,7 @@ static void ignore_set_config(IGNORE_REC *rec)
return; return;
node = iconfig_node_traverse("(ignores", TRUE); 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->mask != NULL) iconfig_node_set_str(node, "mask", rec->mask);
if (rec->level) { if (rec->level) {
@ -281,7 +281,7 @@ static void ignore_set_config(IGNORE_REC *rec)
iconfig_node_set_str(node, "servertag", rec->servertag); iconfig_node_set_str(node, "servertag", rec->servertag);
if (rec->channels != NULL && *rec->channels != NULL) { 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); 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->unignore_time = config_node_get_int(node, "unignore_time", 0);
rec->servertag = g_strdup(config_node_get_str(node, "servertag", 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); if (node != NULL) rec->channels = config_node_get_list(node);
ignore_init_rec(rec); ignore_init_rec(rec);

View File

@ -54,7 +54,7 @@ int level_get(const char *level)
{ {
int n, len, match; 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; return MSGLEVEL_ALL;
if (g_ascii_strcasecmp(level, "NEVER") == 0) 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); itemname = *item + (**item == '+' || **item == '-' ? 1 : 0);
itemlevel = level_get(itemname); itemlevel = level_get(itemname);
if (strcmp(itemname, "NONE") == 0) if (g_strcmp0(itemname, "NONE") == 0)
dest = 0; dest = 0;
else if (**item == '-') else if (**item == '-')
dest &= ~(itemlevel); dest &= ~(itemlevel);

View File

@ -110,7 +110,7 @@ int log_start_logging(LOG_REC *log)
log->real_fname = log_filename(log); log->real_fname = log_filename(log);
if (log->real_fname != NULL && 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), /* path may contain variables (%time, $vars),
make sure the directory is created */ make sure the directory is created */
dir = g_path_get_dirname(log->real_fname); dir = g_path_get_dirname(log->real_fname);
@ -181,7 +181,7 @@ static void log_rotate_check(LOG_REC *log)
return; return;
new_fname = log_filename(log); new_fname = log_filename(log);
if (strcmp(new_fname, log->real_fname) != 0) { if (g_strcmp0(new_fname, log->real_fname) != 0) {
/* rotate log */ /* rotate log */
log_stop_logging(log); log_stop_logging(log);
signal_emit("log rotated", 1, 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 */ /* returns 0 on match, nonzero otherwise */
if (!strcmp(patt, "*")) if (!g_strcmp0(patt, "*"))
return 0; return 0;
return item ? g_ascii_strcasecmp(patt, item) : 1; 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) { for (tmp = logs; tmp != NULL; tmp = tmp->next) {
LOG_REC *rec = tmp->data; LOG_REC *rec = tmp->data;
if (strcmp(rec->fname, fname) == 0) if (g_strcmp0(rec->fname, fname) == 0)
return rec; return rec;
} }
@ -332,11 +332,11 @@ static void log_items_update_config(LOG_REC *log, CONFIG_NODE *parent)
GSList *tmp; GSList *tmp;
CONFIG_NODE *node; 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) { for (tmp = log->items; tmp != NULL; tmp = tmp->next) {
LOG_ITEM_REC *rec = tmp->data; 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, "type", log_item_types[rec->type]);
iconfig_node_set_str(node, "name", rec->name); iconfig_node_set_str(node, "name", rec->name);
iconfig_node_set_str(node, "server", rec->servertag); iconfig_node_set_str(node, "server", rec->servertag);
@ -352,7 +352,7 @@ static void log_update_config(LOG_REC *log)
return; return;
node = iconfig_node_traverse("logs", TRUE); 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) if (log->autoopen)
iconfig_node_set_bool(node, "auto_open", TRUE); 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); 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) if (node != NULL)
log_items_read_config(node, log); log_items_read_config(node, log);

View File

@ -184,7 +184,7 @@ int strarray_find(char **array, const char *item)
GSList *gslist_find_string(GSList *list, const char *key) GSList *gslist_find_string(GSList *list, const char *key)
{ {
for (; list != NULL; list = list->next) 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; return NULL;
} }
@ -269,7 +269,7 @@ GSList *hashtable_get_keys(GHashTable *hash)
GList *glist_find_string(GList *list, const char *key) GList *glist_find_string(GList *list, const char *key)
{ {
for (; list != NULL; list = list->next) 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; return NULL;
} }

View File

@ -78,7 +78,7 @@ static char *module_get_root(const char *name, char **prefixes)
/* skip the _core part */ /* skip the _core part */
len = strlen(name); 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_strndup(name, len-5);
return g_strdup(name); 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)); g_return_val_if_fail(namelen >= rootlen, g_strdup(name));
if (strncmp(name, root, rootlen) == 0 && if (strncmp(name, root, rootlen) == 0 &&
strcmp(name+rootlen, "_core") == 0) g_strcmp0(name+rootlen, "_core") == 0)
return g_strdup("core"); return g_strdup("core");
if (namelen > rootlen && name[namelen-rootlen-1] == '_' && 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_strndup(name, namelen-rootlen-1);
return g_strdup(name); 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, static char *module_get_func(const char *rootmodule, const char *submodule,
const char *function) const char *function)
{ {
if (strcmp(submodule, "core") == 0) if (g_strcmp0(submodule, "core") == 0)
return g_strconcat(rootmodule, "_core_", function, NULL); 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(rootmodule, "_", function, NULL);
return g_strconcat(submodule, "_", 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); module = module_find(rootmodule);
rec = module == NULL ? NULL : rec = module == NULL ? NULL :
strcmp(rootmodule, submodule) == 0 ? g_strcmp0(rootmodule, submodule) == 0 ?
module_file_find(module, "core") : module_file_find(module, "core") :
module_file_find(module, submodule); module_file_find(module, submodule);
if (rec == NULL) { if (rec == NULL) {
@ -277,7 +277,7 @@ static int module_load_full(const char *path, const char *rootmodule,
return FALSE; return FALSE;
module = module_find(rootmodule); 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_file_find(module, submodule) != NULL)) {
/* module is already loaded */ /* module is already loaded */
module_error(MODULE_ERROR_ALREADY_LOADED, NULL, 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.. */ /* 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); status = module_load_name(path, rootmodule, submodule, try_prefixes);
if (status == -1 && try_prefixes) { if (status == -1 && try_prefixes) {
/* nope, try loading the module_core, /* 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); g_free(name);
full_path = g_string_new(exppath); full_path = g_string_new(exppath);
if (strcmp(submodule, "core") == 0) if (g_strcmp0(submodule, "core") == 0)
g_string_insert(full_path, end, "_core"); g_string_insert(full_path, end, "_core");
else { else {
g_string_insert_c(full_path, start, '_'); g_string_insert_c(full_path, start, '_');

View File

@ -44,7 +44,7 @@ void *module_check_cast_module(void *object, int type_pos,
str = module_find_id_str(module, str = module_find_id_str(module,
G_STRUCT_MEMBER(int, object, type_pos)); 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' */ /* 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) { for (tmp = module->files; tmp != NULL; tmp = tmp->next) {
MODULE_FILE_REC *rec = tmp->data; MODULE_FILE_REC *rec = tmp->data;
if (strcmp(rec->name, name) == 0) if (g_strcmp0(rec->name, name) == 0)
return rec; return rec;
} }

View File

@ -460,6 +460,7 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_
const char *mypass = server->connrec->ssl_pass; const char *mypass = server->connrec->ssl_pass;
const char *cafile = server->connrec->ssl_cafile; const char *cafile = server->connrec->ssl_cafile;
const char *capath = server->connrec->ssl_capath; const char *capath = server->connrec->ssl_capath;
const char *ciphers = server->connrec->ssl_ciphers;
gboolean verify = server->connrec->ssl_verify; gboolean verify = server->connrec->ssl_verify;
g_return_val_if_fail(handle != NULL, NULL); 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_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(ctx, get_pem_password_callback);
SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)mypass); 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) { if (mycert && *mycert) {
char *scert = NULL, *spkey = NULL; char *scert = NULL, *spkey = NULL;
@ -531,6 +536,10 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_
return NULL; 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_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE |
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);

View File

@ -478,7 +478,7 @@ static NICK_REC *nick_nfind(CHANNEL_REC *channel, const char *nick, int len)
if (rec != NULL) { if (rec != NULL) {
/* if there's multiple, get the one with identical case */ /* if there's multiple, get the one with identical case */
while (rec->next != NULL) { while (rec->next != NULL) {
if (strcmp(rec->nick, tmpnick) == 0) if (g_strcmp0(rec->nick, tmpnick) == 0)
break; break;
rec = rec->next; rec = rec->next;
} }

View File

@ -28,6 +28,7 @@ char *ssl_pkey;
char *ssl_pass; char *ssl_pass;
char *ssl_cafile; char *ssl_cafile;
char *ssl_capath; char *ssl_capath;
char *ssl_ciphers;
GIOChannel *connect_handle; /* connect using this handle */ GIOChannel *connect_handle; /* connect using this handle */

View File

@ -13,6 +13,7 @@ char *ssl_pkey;
char *ssl_pass; char *ssl_pass;
char *ssl_cafile; char *ssl_cafile;
char *ssl_capath; char *ssl_capath;
char *ssl_ciphers;
char *own_host; /* address to use when connecting this server */ char *own_host; /* address to use when connecting this server */
IPADDR *own_ip4, *own_ip6; /* resolved own_address if not NULL */ IPADDR *own_ip4, *own_ip6; /* resolved own_address if not NULL */

View File

@ -197,6 +197,7 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
dest->ssl_verify = src->ssl_verify; dest->ssl_verify = src->ssl_verify;
dest->ssl_cafile = g_strdup(src->ssl_cafile); dest->ssl_cafile = g_strdup(src->ssl_cafile);
dest->ssl_capath = g_strdup(src->ssl_capath); dest->ssl_capath = g_strdup(src->ssl_capath);
dest->ssl_ciphers = g_strdup(src->ssl_ciphers);
return dest; 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)) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &tag, &msg))
return; return;
if (*tag != '\0' && strcmp(tag, "*") != 0) if (*tag != '\0' && g_strcmp0(tag, "*") != 0)
server = server_find_tag(tag); server = server_find_tag(tag);
if (server != NULL) { if (server != NULL) {

View File

@ -179,6 +179,8 @@ static void server_setup_fill_server(SERVER_CONNECT_REC *conn,
conn->ssl_cafile = g_strdup(sserver->ssl_cafile); conn->ssl_cafile = g_strdup(sserver->ssl_cafile);
if (conn->ssl_capath == NULL && sserver->ssl_capath != NULL && sserver->ssl_capath[0] != '\0') if (conn->ssl_capath == NULL && sserver->ssl_capath != NULL && sserver->ssl_capath[0] != '\0')
conn->ssl_capath = g_strdup(sserver->ssl_capath); 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); 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_verify = config_node_get_bool(node, "ssl_verify", FALSE);
rec->ssl_cafile = g_strdup(config_node_get_str(node, "ssl_cafile", NULL)); 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_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) if (rec->ssl_cafile || rec->ssl_capath)
rec->ssl_verify = TRUE; rec->ssl_verify = TRUE;
if (rec->ssl_cert != NULL || rec->ssl_verify) 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); parentnode = iconfig_node_traverse("(servers", TRUE);
node = config_node_nth(parentnode, index); node = config_node_nth(parentnode, index);
if (node == NULL) 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_clear(node);
iconfig_node_set_str(node, "address", rec->address); 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_bool(node, "ssl_verify", rec->ssl_verify);
iconfig_node_set_str(node, "ssl_cafile", rec->ssl_cafile); 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_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, "own_host", rec->own_host);
iconfig_node_set_str(node, "family", 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_pass);
g_free_not_null(rec->ssl_cafile); g_free_not_null(rec->ssl_cafile);
g_free_not_null(rec->ssl_capath); g_free_not_null(rec->ssl_capath);
g_free_not_null(rec->ssl_ciphers);
g_free(rec->address); g_free(rec->address);
g_free(rec); g_free(rec);
} }
@ -526,7 +531,7 @@ static void read_servers(void)
static void read_settings(void) static void read_settings(void)
{ {
if (old_source_host == NULL || 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); g_free_not_null(old_source_host);
old_source_host = g_strdup(settings_get_str("hostname")); old_source_host = g_strdup(settings_get_str("hostname"));

View File

@ -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_pass);
g_free_not_null(conn->ssl_cafile); g_free_not_null(conn->ssl_cafile);
g_free_not_null(conn->ssl_capath); 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->channels);
g_free_not_null(conn->away_reason); g_free_not_null(conn->away_reason);

View File

@ -92,7 +92,7 @@ static void cmd_upgrade(const char *data)
static void session_save_nick(CHANNEL_REC *channel, NICK_REC *nick, static void session_save_nick(CHANNEL_REC *channel, NICK_REC *nick,
CONFIG_REC *config, CONFIG_NODE *node) 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_str(config, node, "nick", nick->nick);
config_node_set_bool(config, node, "op", nick->op); 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; 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); nicks = nicklist_getnicks(channel);
for (tmp = nicks; tmp != NULL; tmp = tmp->next) for (tmp = nicks; tmp != NULL; tmp = tmp->next)
session_save_nick(channel, tmp->data, config, node); 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, static void session_save_channel(CHANNEL_REC *channel, CONFIG_REC *config,
CONFIG_NODE *node) 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, "name", channel->name);
config_node_set_str(config, node, "visible_name", channel->visible_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; GSList *tmp;
/* save channels */ /* 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) for (tmp = server->channels; tmp != NULL; tmp = tmp->next)
session_save_channel(tmp->data, config, node); session_save_channel(tmp->data, config, node);
} }
@ -148,7 +148,7 @@ static void session_save_server(SERVER_REC *server, CONFIG_REC *config,
{ {
int handle; 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", config_node_set_str(config, node, "chat_type",
chat_protocol_find_id(server->chat_type)->name); 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_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_cafile", server->connrec->ssl_cafile);
config_node_set_str(config, node, "ssl_capath", server->connrec->ssl_capath); 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)); handle = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
config_node_set_int(config, node, "handle", handle); config_node_set_int(config, node, "handle", handle);
@ -187,7 +188,7 @@ static void session_restore_channel_nicks(CHANNEL_REC *channel,
GSList *tmp; GSList *tmp;
/* restore nicks */ /* 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) { if (node != NULL && node->type == NODE_TYPE_LIST) {
tmp = config_node_first(node->value); tmp = config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp)) { for (; tmp != NULL; tmp = config_node_next(tmp)) {
@ -223,7 +224,7 @@ static void session_restore_server_channels(SERVER_REC *server,
GSList *tmp; GSList *tmp;
/* restore channels */ /* 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) { if (node != NULL && node->type == NODE_TYPE_LIST) {
tmp = config_node_first(node->value); tmp = config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp)) for (; tmp != NULL; tmp = config_node_next(tmp))

View File

@ -77,7 +77,7 @@ settings_get_str_type(const char *key, SettingType type)
if (rec == NULL) return NULL; if (rec == NULL) return NULL;
node = iconfig_node_traverse("settings", 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_string : return node == NULL ? rec->default_value.v_string :
config_node_get_str(node, key, 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; if (rec == NULL) return 0;
node = iconfig_node_traverse("settings", 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_int : return node == NULL ? rec->default_value.v_int :
config_node_get_int(node, key, 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; if (rec == NULL) return FALSE;
node = iconfig_node_traverse("settings", 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 : return node == NULL ? rec->default_value.v_bool :
config_node_get_bool(node, key, 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, static int settings_remove_hash(const char *key, SETTINGS_REC *rec,
const char *module) const char *module)
{ {
if (strcmp(rec->module, module) == 0) { if (g_strcmp0(rec->module, module) == 0) {
settings_unref(rec, FALSE); settings_unref(rec, FALSE);
return TRUE; return TRUE;
} }
@ -324,7 +324,7 @@ static CONFIG_NODE *settings_get_node(const char *key)
} }
node = iconfig_node_traverse("settings", TRUE); 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) 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); node = iconfig_node_traverse("settings", FALSE);
if (node == NULL) return; if (node == NULL) return;
node = config_node_section(node, module, -1); node = iconfig_node_section(node, module, -1);
if (node == NULL) return; if (node == NULL) return;
for (tmp = config_node_first(node->value); tmp != NULL; tmp = next) { 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); next = config_node_next(tmp);
set = g_hash_table_lookup(settings, subnode->key); 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); 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; new_value = NULL; new_key = NULL; new_module = NULL;
/* fe-text term_type -> fe-common/core term_charset - for 0.8.10-> */ /* 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 || if (g_ascii_strcasecmp(node->key, "term_type") == 0 ||
/* kludge for cvs-version where term_charset was in fe-text */ /* kludge for cvs-version where term_charset was in fe-text */
g_ascii_strcasecmp(node->key, "term_charset") == 0) { 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); g_strdup(node->value);
new_node = iconfig_node_traverse("settings", FALSE); new_node = iconfig_node_traverse("settings", FALSE);
new_node = new_node == NULL ? NULL : 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, config_node_set_str(mainconfig, new_node,
new_key, new_value); new_key, new_value);
@ -502,7 +502,7 @@ void settings_check_module(const char *module)
g_return_if_fail(module != NULL); g_return_if_fail(module != NULL);
node = iconfig_node_traverse("settings", FALSE); 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; if (node == NULL) return;
errors = g_string_new(NULL); errors = g_string_new(NULL);
@ -520,7 +520,7 @@ void settings_check_module(const char *module)
if (backwards_compatibility(module, node, parent)) if (backwards_compatibility(module, node, parent))
continue; 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); g_string_append_printf(errors, " %s", node->key);
count++; count++;
} }
@ -548,9 +548,9 @@ void settings_check_module(const char *module)
static int settings_compare(SETTINGS_REC *v1, SETTINGS_REC *v2) 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) if (!cmp)
cmp = strcmp(v1->key, v2->key); cmp = g_strcmp0(v1->key, v2->key);
return cmp; return cmp;
} }

View File

@ -36,6 +36,8 @@ typedef struct {
#define iconfig_set_int(a, b, c) config_set_int(mainconfig, a, b, c) #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_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_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_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) #define iconfig_node_set_int(a, b, c) config_node_set_int(mainconfig, a, b, c)

View File

@ -42,7 +42,7 @@ void command_history_add(HISTORY_REC *history, const char *text)
g_return_if_fail(text != NULL); g_return_if_fail(text != NULL);
link = g_list_last(history->list); 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 */ return; /* same as previous entry */
if (settings_get_int("max_command_history") < 1 || 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' && if (*text != '\0' &&
(pos == NULL || strcmp(pos->data, text) != 0)) { (pos == NULL || g_strcmp0(pos->data, text) != 0)) {
/* save the old entry to history */ /* save the old entry to history */
command_history_add(history, text); command_history_add(history, text);
} }
@ -145,7 +145,7 @@ const char *command_history_next(WINDOW_REC *window, const char *text)
} }
if (*text != '\0' && if (*text != '\0' &&
(pos == NULL || strcmp(pos->data, text) != 0)) { (pos == NULL || g_strcmp0(pos->data, text) != 0)) {
/* save the old entry to history */ /* save the old entry to history */
command_history_add(history, text); command_history_add(history, text);
} }

View File

@ -51,7 +51,7 @@ static const char *completion_find(const char *key, int automatic)
if (node == NULL || node->type != NODE_TYPE_BLOCK) if (node == NULL || node->type != NODE_TYPE_BLOCK)
return NULL; return NULL;
node = config_node_section(node, key, -1); node = iconfig_node_section(node, key, -1);
if (node == NULL) if (node == NULL)
return 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); g_return_val_if_fail(pos != NULL, NULL);
continue_complete = complist != NULL && *pos == last_line_pos && continue_complete = complist != NULL && *pos == last_line_pos &&
strcmp(line, last_line) == 0; g_strcmp0(line, last_line) == 0;
if (erase && !continue_complete) if (erase && !continue_complete)
return NULL; return NULL;
@ -681,7 +681,7 @@ static void sig_complete_set(GList **list, WINDOW_REC *window,
g_return_if_fail(line != NULL); g_return_if_fail(line != NULL);
if (*line == '\0' || if (*line == '\0' ||
!strcmp("-clear", line) || !strcmp("-default", line)) !g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
*list = completion_get_settings(word, -1); *list = completion_get_settings(word, -1);
else if (*line != '\0' && *word == '\0') { else if (*line != '\0' && *word == '\0') {
SETTINGS_REC *rec = settings_get_record(line); SETTINGS_REC *rec = settings_get_record(line);
@ -785,7 +785,7 @@ static void cmd_completion(const char *data)
} else if (*key != '\0' && *value != '\0') { } else if (*key != '\0' && *value != '\0') {
int automatic = g_hash_table_lookup(optlist, "auto") != NULL; 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); iconfig_node_set_str(node, "value", value);
if (automatic) if (automatic)
iconfig_node_set_bool(node, "auto", TRUE); iconfig_node_set_bool(node, "auto", TRUE);

View File

@ -287,7 +287,7 @@ static void cmd_channel_add(const char *data)
if (g_hash_table_lookup(optlist, "noauto")) rec->autojoin = FALSE; if (g_hash_table_lookup(optlist, "noauto")) rec->autojoin = FALSE;
if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg); if (botarg != NULL && *botarg != '\0') rec->botmasks = g_strdup(botarg);
if (botcmdarg != NULL && *botcmdarg != '\0') rec->autosendcmd = g_strdup(botcmdarg); 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); 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)) "names", &optlist, &channel))
return; return;
if (strcmp(channel, "*") == 0 || *channel == '\0') { if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
if (!IS_CHANNEL(item)) if (!IS_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED); 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) if (unknowns->len > 1)
g_string_truncate(unknowns, 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); signal_emit("command names", 3, unknowns->str, server, item);
g_string_free(unknowns, TRUE); g_string_free(unknowns, TRUE);

View File

@ -161,7 +161,7 @@ static PROCESS_REC *process_find(const char *name, int verbose)
for (tmp = processes; tmp != NULL; tmp = tmp->next) { for (tmp = processes; tmp != NULL; tmp = tmp->next) {
PROCESS_REC *rec = tmp->data; 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; return rec;
} }

View File

@ -37,12 +37,12 @@ static int commands_equal(COMMAND_REC *rec, COMMAND_REC *rec2)
if (rec2->category == NULL && rec->category != NULL) if (rec2->category == NULL && rec->category != NULL)
return 1; return 1;
if (rec->category != NULL && rec2->category != NULL) { if (rec->category != NULL && rec2->category != NULL) {
i = strcmp(rec->category, rec2->category); i = g_strcmp0(rec->category, rec2->category);
if (i != 0) if (i != 0)
return i; return i;
} }
return strcmp(rec->cmd, rec2->cmd); return g_strcmp0(rec->cmd, rec2->cmd);
} }
static int get_cmd_length(void *data) static int get_cmd_length(void *data)
@ -176,7 +176,7 @@ static void show_help(const char *data)
if (last != NULL && rec->category != NULL && if (last != NULL && rec->category != NULL &&
(last->category == NULL || (last->category == NULL ||
strcmp(rec->category, last->category) != 0)) { g_strcmp0(rec->category, last->category) != 0)) {
/* category changed */ /* category changed */
if (items > 0) { if (items > 0) {
if (!header) { if (!header) {

View File

@ -165,7 +165,7 @@ static void cmd_ignore(const char *data)
rec = g_new0(IGNORE_REC, 1); rec = g_new0(IGNORE_REC, 1);
rec->mask = mask == NULL || *mask == '\0' || rec->mask = mask == NULL || *mask == '\0' ||
strcmp(mask, "*") == 0 ? NULL : g_strdup(mask); g_strcmp0(mask, "*") == 0 ? NULL : g_strdup(mask);
rec->channels = channels; rec->channels = channels;
} else { } else {
g_free_and_null(rec->pattern); g_free_and_null(rec->pattern);

View File

@ -485,7 +485,7 @@ static void autolog_open_check(TEXT_DEST_REC *dest)
return; return;
if (target != NULL) 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, 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) static void sig_log_new(LOG_REC *log)
{ {
if (!settings_get_bool("awaylog_colors") && 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; log->colorizer = log_colorizer_strip;
} }

View File

@ -249,7 +249,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
int level = MSGLEVEL_MSGS; int level = MSGLEVEL_MSGS;
/* own message returned by bouncer? */ /* 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); 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 /* this should only happen if some special target failed and
we should display some error message. currently the special we should display some error message. currently the special
targets are only ',' and '.'. */ targets are only ',' and '.'. */
g_return_if_fail(strcmp(origtarget, ",") == 0 || g_return_if_fail(g_strcmp0(origtarget, ",") == 0 ||
strcmp(origtarget, ".") == 0); g_strcmp0(origtarget, ".") == 0);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
*origtarget == ',' ? TXT_NO_MSGS_GOT : *origtarget == ',' ? TXT_NO_MSGS_GOT :
@ -569,7 +569,7 @@ static int printnick_exists(NICK_REC *first, NICK_REC *ignore,
while (first != NULL) { while (first != NULL) {
if (first != ignore) { if (first != ignore) {
printnick = g_hash_table_lookup(printnicks, first); printnick = g_hash_table_lookup(printnicks, first);
if (printnick != NULL && strcmp(printnick, nick) == 0) if (printnick != NULL && g_strcmp0(printnick, nick) == 0)
return TRUE; return TRUE;
} }

View File

@ -331,7 +331,7 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
QUERY_REC *query; QUERY_REC *query;
/* own message returned by bouncer? */ /* own message returned by bouncer? */
int own = (!strcmp(nick, server->nick)); int own = (!g_strcmp0(nick, server->nick));
/* create query window if needed */ /* create query window if needed */
query = privmsg_get_query(server, own ? target : nick, FALSE, MSGLEVEL_MSGS); query = privmsg_get_query(server, own ? target : nick, FALSE, MSGLEVEL_MSGS);

View File

@ -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) 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 */ /* SYNTAX: RECODE */

View File

@ -173,6 +173,10 @@ static void cmd_server_add(const char *data)
if (value != NULL && *value != '\0') if (value != NULL && *value != '\0')
rec->ssl_capath = g_strdup(value); 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') if ((rec->ssl_cafile != NULL && rec->ssl_cafile[0] != '\0')
|| (rec->ssl_capath != NULL && rec->ssl_capath[0] != '\0')) || (rec->ssl_capath != NULL && rec->ssl_capath[0] != '\0'))
rec->ssl_verify = TRUE; 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, "proxy")) rec->no_proxy = FALSE;
if (g_hash_table_lookup(optlist, "noproxy")) rec->no_proxy = TRUE; 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"); value = g_hash_table_lookup(optlist, "host");
if (value != NULL && *value != '\0') { if (value != NULL && *value != '\0') {
rec->own_host = g_strdup(value); rec->own_host = g_strdup(value);
@ -264,7 +268,7 @@ static void cmd_server_connect(const char *data)
"connect", &optlist, &addr)) "connect", &optlist, &addr))
return; return;
if (*addr == '\0' || strcmp(addr, "+") == 0) if (*addr == '\0' || g_strcmp0(addr, "+") == 0)
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*addr == '+') window_create(NULL, FALSE); 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("server remove", NULL, (SIGNAL_FUNC) cmd_server_remove);
command_bind_first("server", NULL, (SIGNAL_FUNC) server_command); command_bind_first("server", NULL, (SIGNAL_FUNC) server_command);
command_bind_first("disconnect", 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 looking", (SIGNAL_FUNC) sig_server_looking);
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting); signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);

View File

@ -53,7 +53,7 @@ static void set_print_pattern(const char *pattern)
if (stristr(rec->key, pattern) == NULL) if (stristr(rec->key, pattern) == NULL)
continue; continue;
if (strcmp(last_section, rec->section) != 0) { if (g_strcmp0(last_section, rec->section) != 0) {
/* print section */ /* print section */
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP,
TXT_SET_TITLE, rec->section); TXT_SET_TITLE, rec->section);

View File

@ -66,7 +66,7 @@ static void hilight_add_config(HILIGHT_REC *rec)
g_return_if_fail(rec != NULL); g_return_if_fail(rec != NULL);
node = iconfig_node_traverse("(hilights", TRUE); 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); iconfig_node_set_str(node, "text", rec->text);
if (rec->level > 0) iconfig_node_set_int(node, "level", rec->level); 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->servertag) iconfig_node_set_str(node, "servertag", rec->servertag);
if (rec->channels != NULL && *rec->channels != NULL) { 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); 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)) if ((channels == NULL && rec->channels == NULL))
return rec; /* no channels - ok */ return rec; /* no channels - ok */
if (channels != NULL && strcmp(*channels, "*") == 0) if (channels != NULL && g_strcmp0(*channels, "*") == 0)
return rec; /* ignore channels */ return rec; /* ignore channels */
if (channels == NULL || rec->channels == NULL) 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; dest->hilight_priority = rec->priority;
g_free_and_null(dest->hilight_color); 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; dest->level |= MSGLEVEL_NO_ACT;
else else
dest->hilight_color = hilight_get_act_color(rec); 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; old_level = dest->level;
if (!nick_match || (dest->level & MSGLEVEL_HILIGHT)) { 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 /* Remove NO_ACT, this means explicitly defined hilights will bypass
* /IGNORE ... NO_ACT. * /IGNORE ... NO_ACT.
* (It's still possible to use /hilight -actcolor %n to hide * (It's still possible to use /hilight -actcolor %n to hide
* hilight/beep). * hilight/beep).
*/ */
dest->level &= ~MSGLEVEL_NO_ACT; dest->level &= ~MSGLEVEL_NO_ACT;
/* update the level / hilight info */
hilight_update_text_dest(dest, hilight);
} }
if (nick_match) if (nick_match)
@ -471,7 +471,7 @@ static void read_hilight_config(void)
rec->servertag = config_node_get_str(node, "servertag", NULL); rec->servertag = config_node_get_str(node, "servertag", NULL);
hilight_init_rec(rec); 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); if (node != NULL) rec->channels = config_node_get_list(node);
} }

View File

@ -118,7 +118,7 @@ static CONFIG_NODE *key_config_find(const char *key)
for (; tmp != NULL; tmp = config_node_next(tmp)) { for (; tmp != NULL; tmp = config_node_next(tmp)) {
node = tmp->data; 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; return node;
} }
@ -135,7 +135,7 @@ static void keyconfig_save(const char *id, const char *key, const char *data)
node = key_config_find(key); node = key_config_find(key);
if (node == NULL) { if (node == NULL) {
node = iconfig_node_traverse("(keyboard", TRUE); 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); 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) { for (tmp = info->keys; tmp != NULL; tmp = tmp->next) {
KEY_REC *rec = tmp->data; KEY_REC *rec = tmp->data;
if (strcmp(rec->data, str) == 0) if (g_strcmp0(rec->data, str) == 0)
list = g_slist_append(list, rec); 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; GSList *tmp, *out;
if (strcmp(rec->info->id, "key") == 0) if (g_strcmp0(rec->info->id, "key") == 0)
return; return;
out = g_slist_append(NULL, g_string_new(NULL)); 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, g_tree_foreach(key_states, (GTraverseFunc) key_state_destroy,
NULL); NULL);
g_tree_destroy(key_states); 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); temp = g_string_new(NULL);
g_hash_table_foreach(keys, (GHFunc) key_states_scan_key, temp); 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, default_keys = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal); (GCompareFunc) g_str_equal);
keyinfos = NULL; keyinfos = NULL;
key_states = g_tree_new((GCompareFunc) strcmp); key_states = g_tree_new((GCompareFunc) g_strcmp0);
key_config_frozen = 0; key_config_frozen = 0;
memset(used_keys, 0, sizeof(used_keys)); memset(used_keys, 0, sizeof(used_keys));

View File

@ -43,7 +43,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ "window_unset_immortal", "Window isn't immortal anymore", 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 }, { "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_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_line", "%#$[4]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } },
{ "windowlist_footer", "", 0 }, { "windowlist_footer", "", 0 },
{ "windows_layout_saved", "Layout of windows is now remembered", 0 }, { "windows_layout_saved", "Layout of windows is now remembered", 0 },
{ "windows_layout_reset", "Layout of windows reset to defaults", 0 }, { "windows_layout_reset", "Layout of windows reset to defaults", 0 },

View File

@ -739,7 +739,7 @@ static void theme_read_formats(THEME_REC *theme, const char *module,
node = config_node_traverse(config, "formats", FALSE); node = config_node_traverse(config, "formats", FALSE);
if (node == NULL) return; if (node == NULL) return;
node = config_node_section(node, module, -1); node = config_node_section(config, node, module, -1);
if (node == NULL) return; if (node == NULL) return;
for (tmp = node->value; tmp != NULL; tmp = tmp->next) { for (tmp = node->value; tmp != NULL; tmp = tmp->next) {
@ -895,7 +895,7 @@ THEME_REC *theme_load(const char *setname)
name = g_strdup(setname); name = g_strdup(setname);
p = strrchr(name, '.'); p = strrchr(name, '.');
if (p != NULL && strcmp(p, ".theme") == 0) { if (p != NULL && g_strcmp0(p, ".theme") == 0) {
/* remove the trailing .theme */ /* remove the trailing .theme */
*p = '\0'; *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); 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++) { for (n = 1; formats[n].def != NULL; n++) {
if (rec->formats[n] != NULL) { if (rec->formats[n] != NULL) {
config_node_set_str(data->config, node, formats[n].tag, config_node_set_str(data->config, node, formats[n].tag,
@ -1358,9 +1358,9 @@ static void read_settings(void)
theme = settings_get_str("theme"); theme = settings_get_str("theme");
len = strlen(current_theme->name); 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 || (strncmp(current_theme->name, theme, len) != 0 ||
strcmp(theme+len, ".theme") != 0)) g_strcmp0(theme+len, ".theme") != 0))
change_theme(theme, TRUE); change_theme(theme, TRUE);
} }

View File

@ -127,7 +127,7 @@ static void cmd_window_info(WINDOW_REC *win)
win->active_server->tag : "NONE"); win->active_server->tag : "NONE");
} else { } else {
if (win->active_server != NULL && 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!"); g_warning("Active server isn't the sticky server!");
printformat_window(win, MSGLEVEL_CLIENTCRAP, printformat_window(win, MSGLEVEL_CLIENTCRAP,
@ -609,7 +609,7 @@ static void cmd_window_name(const char *data)
if (win == NULL || win == active_win) if (win == NULL || win == active_win)
window_set_name(active_win, data); window_set_name(active_win, data);
else if (active_win->name == NULL || 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, printformat_window(active_win, MSGLEVEL_CLIENTERROR,
TXT_WINDOW_NAME_NOT_UNIQUE, data); TXT_WINDOW_NAME_NOT_UNIQUE, data);
} }

View File

@ -127,6 +127,7 @@ static void sig_layout_restore(void)
for (; tmp != NULL; tmp = config_node_next(tmp)) { for (; tmp != NULL; tmp = config_node_next(tmp)) {
CONFIG_NODE *node = tmp->data; CONFIG_NODE *node = tmp->data;
if (node->key == NULL) continue;
window = window_find_refnum(atoi(node->key)); window = window_find_refnum(atoi(node->key));
if (window == NULL) if (window == NULL)
window = window_create(NULL, TRUE); window = window_create(NULL, TRUE);
@ -143,7 +144,7 @@ static void sig_layout_restore(void)
if (window->theme_name != NULL) if (window->theme_name != NULL)
window->theme = theme_load(window->theme_name); 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); 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) if (type == NULL)
return; 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); iconfig_node_set_str(subnode, "type", type);
proto = item->chat_type == 0 ? NULL : proto = item->chat_type == 0 ? NULL :
@ -185,7 +186,7 @@ static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
{ {
GSList *tmp; 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) for (tmp = window->items; tmp != NULL; tmp = tmp->next)
signal_emit("layout save item", 3, window, tmp->data, node); 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]; char refnum[MAX_INT_STRLEN];
ltoa(refnum, window->refnum); 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) if (window->sticky_refnum)
iconfig_node_set_bool(node, "sticky_refnum", TRUE); iconfig_node_set_bool(node, "sticky_refnum", TRUE);

View File

@ -243,7 +243,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
return; return;
/* handle only DCC messages */ /* handle only DCC messages */
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
dcc = item_get_dcc(item); dcc = item_get_dcc(item);
else if (*target == '=') else if (*target == '=')
dcc = dcc_chat_find_id(target+1); dcc = dcc_chat_find_id(target+1);

View File

@ -427,7 +427,7 @@ static void event_no_such_nick(IRC_SERVER_REC *server, const char *data,
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &unick); params = event_get_params(data, 2, NULL, &unick);
if (!strcmp(unick, "*")) if (!g_strcmp0(unick, "*"))
/* more information will be in the description, /* more information will be in the description,
* e.g. * :Target left IRC. Failed to deliver: [hi] */ * e.g. * :Target left IRC. Failed to deliver: [hi] */
print_event_received(server, data, nick, FALSE); 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); recoded = recode_in(SERVER(server), args, NULL);
format = nick == NULL || server->real_address == 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; IRCTXT_DEFAULT_EVENT : IRCTXT_DEFAULT_EVENT_SERVER;
printformat(server, target, MSGLEVEL_CRAP, format, printformat(server, target, MSGLEVEL_CRAP, format,
nick, recoded, current_server_event); nick, recoded, current_server_event);

View File

@ -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, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &msg)) &target, &msg))
return; return;
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
target = item == NULL ? "" : window_item_get_target(item); target = item == NULL ? "" : window_item_get_target(item);
if (*target == '\0' || *msg == '\0') 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, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata)) &target, &ctcpcmd, &ctcpdata))
return; return;
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
target = item == NULL ? "" : window_item_get_target(item); target = item == NULL ? "" : window_item_get_target(item);
if (*target == '\0' || *ctcpcmd == '\0') if (*target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); 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, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &text)) &target, &text))
return; return;
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
target = item == NULL ? "" : window_item_get_target(item); target = item == NULL ? "" : window_item_get_target(item);
if (*target == '\0' || *text == '\0') if (*target == '\0' || *text == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); 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') if (chanrec == NULL && *channel == '\0')
cmd_param_error(CMDERR_NOT_JOINED); 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); chanrec = irc_channel_find(server, channel);
if (chanrec == NULL || !chanrec->synced) { if (chanrec == NULL || !chanrec->synced) {

View File

@ -178,7 +178,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
if (ischannel(*target)) { if (ischannel(*target)) {
item = irc_channel_find(server, target); item = irc_channel_find(server, target);
} else { } else {
own = (!strcmp(nick, server->nick)); own = (!g_strcmp0(nick, server->nick));
item = privmsg_get_query(SERVER(server), own ? target : nick, FALSE, level); item = privmsg_get_query(SERVER(server), own ? target : nick, FALSE, level);
} }

View File

@ -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>] /* SYNTAX: SERVER ADD [-4 | -6] [-ssl] [-ssl_cert <cert>] [-ssl_pkey <pkey>] [-ssl_pass <password>]
[-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>] [-ssl_verify] [-ssl_cafile <cafile>] [-ssl_capath <capath>]
[-ssl_ciphers <list>]
[-auto | -noauto] [-network <network>] [-host <hostname>] [-auto | -noauto] [-network <network>] [-host <hostname>]
[-cmdspeed <ms>] [-cmdmax <count>] [-port <port>] [-cmdspeed <ms>] [-cmdmax <count>] [-port <port>]
<address> [<port> [<password>]] */ <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); g_string_append_printf(str, "ssl_cafile: %s, ", rec->ssl_cafile);
if (rec->ssl_capath) if (rec->ssl_capath)
g_string_append_printf(str, "ssl_capath: %s, ", 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) if (rec->max_cmds_at_once > 0)

View File

@ -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); signal_add("print starting", (SIGNAL_FUNC) sig_print_starting);
rec = mode_find_channel(channel); 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 */ /* different mode than last time, show and remove the old */
print_mode(rec); print_mode(rec);
mode_destroy(rec); mode_destroy(rec);

View File

@ -134,8 +134,8 @@ static void event_whois_realhost(IRC_SERVER_REC *server, const char *data)
/* <yournick> real hostname <nick> <hostname> */ /* <yournick> real hostname <nick> <hostname> */
params = event_get_params(data, 5, NULL, &nick, &txt_real, params = event_get_params(data, 5, NULL, &nick, &txt_real,
&txt_hostname, &hostname); &txt_hostname, &hostname);
if (strcmp(txt_real, "real") != 0 || if (g_strcmp0(txt_real, "real") != 0 ||
strcmp(txt_hostname, "hostname") != 0) { g_strcmp0(txt_hostname, "hostname") != 0) {
/* <yournick> <nick> :... from <hostname> */ /* <yournick> <nick> :... from <hostname> */
g_free(params); g_free(params);
params = event_get_params(data, 3, NULL, &nick, &hostname); 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, params = event_get_params(data, 4, NULL, &txt_usermodes,
&nick, &usermode); &nick, &usermode);
if (strcmp(txt_usermodes, "usermodes") == 0) { if (g_strcmp0(txt_usermodes, "usermodes") == 0) {
/* <yournick> usermodes <nick> usermode */ /* <yournick> usermodes <nick> usermode */
printformat(server, nick, MSGLEVEL_CRAP, printformat(server, nick, MSGLEVEL_CRAP,
IRCTXT_WHOIS_USERMODE, nick, usermode); IRCTXT_WHOIS_USERMODE, nick, usermode);

View File

@ -392,7 +392,7 @@ static void sig_gui_key_pressed(gpointer keyp)
str[g_unichar_to_utf8(key, str)] = '\0'; 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 */ /* change it as ^-, that is an invalid control char */
str[1] = '-'; str[1] = '-';
str[2] = '\0'; str[2] = '\0';

View File

@ -310,6 +310,7 @@ int main(int argc, char **argv)
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL }, { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL },
{ NULL } { NULL }
}; };
int loglev;
#ifdef USE_GC #ifdef USE_GC
g_mem_set_vtable(&gc_mem_table); g_mem_set_vtable(&gc_mem_table);
@ -352,6 +353,7 @@ int main(int argc, char **argv)
you have to call setlocale(LC_ALL, "") */ you have to call setlocale(LC_ALL, "") */
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL);
textui_init(); textui_init();
if (!dummy && !term_init()) { if (!dummy && !term_init()) {
@ -360,6 +362,7 @@ int main(int argc, char **argv)
return 1; return 1;
} }
g_log_set_always_fatal(loglev);
textui_finish_init(); textui_finish_init();
main_loop = g_main_new(TRUE); main_loop = g_main_new(TRUE);

View File

@ -74,6 +74,25 @@ int cmd_options_get_level(const char *cmd, GHashTable *optlist)
return retlevel; 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, static void show_lastlog(const char *searchtext, GHashTable *optlist,
int start, int count, FILE *fhandle) int start, int count, FILE *fhandle)
{ {
@ -82,7 +101,7 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
GList *list, *tmp; GList *list, *tmp;
GString *line; GString *line;
char *str; char *str;
int level, before, after, len; int level, before, after, len, date = FALSE;
level = cmd_options_get_level("lastlog", optlist); level = cmd_options_get_level("lastlog", optlist);
if (level == -1) return; /* error in options */ 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; 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, list = textbuffer_find_text(WINDOW_GUI(window)->view->buffer, startline,
level, MSGLEVEL_LASTLOG, level, MSGLEVEL_LASTLOG,
searchtext, before, after, searchtext, before, after,
@ -199,6 +221,9 @@ static void show_lastlog(const char *searchtext, GHashTable *optlist,
g_string_prepend(line, timestamp); g_string_prepend(line, timestamp);
} }
if (date == TRUE)
prepend_date(window, rec, line);
/* write to file/window */ /* write to file/window */
if (fhandle != NULL) { if (fhandle != NULL) {
fwrite(line->str, line->len, 1, fhandle); 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] /* SYNTAX: LASTLOG [-] [-file <filename>] [-window <ref#|name>] [-new | -away]
[-<level> -<level...>] [-clear] [-count] [-case] [-<level> -<level...>] [-clear] [-count] [-case] [-date]
[-regexp | -word] [-before [<#>]] [-after [<#>]] [-regexp | -word] [-before [<#>]] [-after [<#>]]
[-<# before+after>] [<pattern>] [<count> [<start>]] */ [-<# before+after>] [<pattern>] [<count> [<start>]] */
static void cmd_lastlog(const char *data) static void cmd_lastlog(const char *data)
@ -285,7 +310,7 @@ void lastlog_init(void)
{ {
command_bind("lastlog", NULL, (SIGNAL_FUNC) cmd_lastlog); 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) void lastlog_deinit(void)

View File

@ -70,7 +70,7 @@ static void main_window_save(MAIN_WINDOW_REC *window, CONFIG_NODE *node)
char num[MAX_INT_STRLEN]; char num[MAX_INT_STRLEN];
ltoa(num, window->active->refnum); 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, "first_line", window->first_line);
iconfig_node_set_int(node, "lines", window->height); iconfig_node_set_int(node, "lines", window->height);
@ -179,6 +179,7 @@ static void sig_layout_restore(void)
lower_window = NULL; lower_size = 0; lower_window = NULL; lower_size = 0;
for (i = 0, tmp = sorted_config; i < windows_count; tmp = tmp->next, i++) { for (i = 0, tmp = sorted_config; i < windows_count; tmp = tmp->next, i++) {
CONFIG_NODE *node = tmp->data; CONFIG_NODE *node = tmp->data;
if (node->key == NULL) continue;
/* create a new window + mainwindow */ /* create a new window + mainwindow */
signal_emit("gui window create override", 1, signal_emit("gui window create override", 1,

View File

@ -33,6 +33,7 @@ FORMAT_REC gui_text_formats[] =
{ "lastlog_start", "{hilight Lastlog}:", 0 }, { "lastlog_start", "{hilight Lastlog}:", 0 },
{ "lastlog_end", "{hilight End of Lastlog}", 0 }, { "lastlog_end", "{hilight End of Lastlog}", 0 },
{ "lastlog_separator", "--", 0 }, { "lastlog_separator", "--", 0 },
{ "lastlog_date", "%%F ", 0 },
/* ---- */ /* ---- */
{ NULL, "Windows", 0 }, { NULL, "Windows", 0 },

View File

@ -10,6 +10,7 @@ enum {
TXT_LASTLOG_START, TXT_LASTLOG_START,
TXT_LASTLOG_END, TXT_LASTLOG_END,
TXT_LASTLOG_SEPARATOR, TXT_LASTLOG_SEPARATOR,
TXT_LASTLOG_DATE,
TXT_FILL_2, TXT_FILL_2,

View File

@ -95,7 +95,7 @@ statusbar_config_find(STATUSBAR_GROUP_REC *group, const char *name)
for (tmp = group->config_bars; tmp != NULL; tmp = tmp->next) { for (tmp = group->config_bars; tmp != NULL; tmp = tmp->next) {
STATUSBAR_CONFIG_REC *config = tmp->data; STATUSBAR_CONFIG_REC *config = tmp->data;
if (strcmp(config->name, name) == 0) if (g_strcmp0(config->name, name) == 0)
return config; return config;
} }
@ -137,7 +137,7 @@ static void statusbar_read_item(STATUSBAR_CONFIG_REC *bar, CONFIG_NODE *node)
int priority, right_alignment; int priority, right_alignment;
priority = config_node_get_int(node, "priority", 0); 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, statusbar_item_config_create(bar, node->key,
priority, right_alignment); priority, right_alignment);
} }
@ -177,7 +177,7 @@ static void statusbar_read(STATUSBAR_GROUP_REC *group, CONFIG_NODE *node)
bar->placement = STATUSBAR_TOP; bar->placement = STATUSBAR_TOP;
bar->position = config_node_get_int(node, "position", 0); 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) { if (node != NULL) {
/* we're overriding the items - destroy the old */ /* we're overriding the items - destroy the old */
while (bar->items != NULL) while (bar->items != NULL)
@ -227,7 +227,7 @@ static void read_statusbar_config_from_node(CONFIG_NODE *node)
CONFIG_NODE *items; CONFIG_NODE *items;
GSList *tmp; GSList *tmp;
items = config_node_section(node, "items", -1); items = iconfig_node_section(node, "items", -1);
if (items != NULL) if (items != NULL)
statusbar_read_items(items); statusbar_read_items(items);
@ -369,7 +369,7 @@ static void cmd_statusbar_reset(const char *data, void *server,
CONFIG_NODE *parent; CONFIG_NODE *parent;
parent = iconfig_node_traverse("statusbar", TRUE); 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); NODE_TYPE_BLOCK);
iconfig_node_set_str(parent, node->key, NULL); iconfig_node_set_str(parent, node->key, NULL);
@ -432,7 +432,7 @@ static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent)
CONFIG_NODE *node; CONFIG_NODE *node;
GSList *tmp; GSList *tmp;
node = config_node_section(parent, "items", -1); node = iconfig_node_section(parent, "items", -1);
if (node != NULL) if (node != NULL)
return node; return node;
@ -446,11 +446,11 @@ static CONFIG_NODE *statusbar_items_section(CONFIG_NODE *parent)
/* since items list in config file overrides defaults, /* since items list in config file overrides defaults,
we'll need to copy the whole list. */ 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) { for (tmp = bar->items; tmp != NULL; tmp = tmp->next) {
SBAR_ITEM_CONFIG_REC *rec = tmp->data; SBAR_ITEM_CONFIG_REC *rec = tmp->data;
node = config_node_section(parent, rec->name, node = iconfig_node_section(parent, rec->name,
NODE_TYPE_BLOCK); NODE_TYPE_BLOCK);
if (rec->priority != 0) if (rec->priority != 0)
iconfig_node_set_int(node, "priority", rec->priority); 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; if (value != NULL) index = config_node_index(node, value)+1;
/* create/move item */ /* 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 */ /* set the options */
value = g_hash_table_lookup(optlist, "priority"); value = g_hash_table_lookup(optlist, "priority");
@ -511,7 +511,7 @@ static void cmd_statusbar_remove(const char *data, void *server,
if (node == NULL) if (node == NULL)
return; return;
if (config_node_section(node, data, -1) != NULL) if (iconfig_node_section(node, data, -1) != NULL)
iconfig_node_set_str(node, data, NULL); iconfig_node_set_str(node, data, NULL);
else { else {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
@ -545,9 +545,9 @@ static void cmd_statusbar(const char *data)
/* lookup/create the statusbar node */ /* lookup/create the statusbar node */
node = iconfig_node_traverse("statusbar", TRUE); 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_TYPE_BLOCK);
node = config_node_section(node, name, NODE_TYPE_BLOCK); node = iconfig_node_section(node, name, NODE_TYPE_BLOCK);
/* call the subcommand */ /* call the subcommand */
signal = g_strconcat("command statusbar ", cmd, NULL); signal = g_strconcat("command statusbar ", cmd, NULL);

View File

@ -129,7 +129,7 @@ STATUSBAR_GROUP_REC *statusbar_group_find(const char *name)
for (tmp = statusbar_groups; tmp != NULL; tmp = tmp->next) { for (tmp = statusbar_groups; tmp != NULL; tmp = tmp->next) {
STATUSBAR_GROUP_REC *rec = tmp->data; STATUSBAR_GROUP_REC *rec = tmp->data;
if (strcmp(rec->name, name) == 0) if (g_strcmp0(rec->name, name) == 0)
return rec; return rec;
} }
@ -617,7 +617,7 @@ STATUSBAR_REC *statusbar_find(STATUSBAR_GROUP_REC *group, const char *name,
STATUSBAR_REC *rec = tmp->data; STATUSBAR_REC *rec = tmp->data;
if (rec->parent_window == window && if (rec->parent_window == window &&
strcmp(rec->config->name, name) == 0) g_strcmp0(rec->config->name, name) == 0)
return rec; return rec;
} }

View File

@ -646,11 +646,11 @@ static int term_setup(TERM_REC *term)
str = g_string_new(NULL); str = g_string_new(NULL);
if (term->TI_sgr0) if (term->TI_sgr0)
g_string_append(str, 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); 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); 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); g_string_append(str, term->TI_ritm);
term->TI_normal = str->str; term->TI_normal = str->str;
g_string_free(str, FALSE); g_string_free(str, FALSE);

View File

@ -188,7 +188,7 @@ static void command_set_ban(const char *data, IRC_SERVER_REC *server,
item, &channel, &nicks)) return; item, &channel, &nicks)) return;
if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED); if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED);
if (*nicks == '\0') { if (*nicks == '\0') {
if (strcmp(data, "*") != 0) if (g_strcmp0(data, "*") != 0)
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
/* /BAN * or /UNBAN * - ban/unban everyone */ /* /BAN * or /UNBAN * - ban/unban everyone */
nicks = (char *) data; 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) static void read_settings(void)
{ {
if (default_ban_type_str != NULL && 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; return;
g_free_not_null(default_ban_type_str); g_free_not_null(default_ban_type_str);

View File

@ -270,7 +270,7 @@ static void event_join(IRC_SERVER_REC *server, const char *data, const char *nic
} }
chanrec->joined = TRUE; chanrec->joined = TRUE;
if (strcmp(chanrec->name, channel) != 0) { if (g_strcmp0(chanrec->name, channel) != 0) {
g_free(chanrec->name); g_free(chanrec->name);
chanrec->name = g_strdup(channel); chanrec->name = g_strdup(channel);
} }

View File

@ -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, if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST,
&target, &msg)) &target, &msg))
return; return;
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
target = item == NULL ? NULL : window_item_get_target(item); target = item == NULL ? NULL : window_item_get_target(item);
if (target == NULL || *target == '\0' || *msg == '\0') if (target == NULL || *target == '\0' || *msg == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); 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, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata)) &target, &ctcpcmd, &ctcpdata))
return; return;
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
target = item == NULL ? NULL : window_item_get_target(item); target = item == NULL ? NULL : window_item_get_target(item);
if (target == NULL || *target == '\0' || *ctcpcmd == '\0') if (target == NULL || *target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); 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, if (!cmd_get_params(data, &free_arg, 3 | PARAM_FLAG_GETREST,
&target, &ctcpcmd, &ctcpdata)) &target, &ctcpcmd, &ctcpdata))
return; return;
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
target = item == NULL ? NULL : window_item_get_target(item); target = item == NULL ? NULL : window_item_get_target(item);
if (target == NULL || *target == '\0' || *ctcpcmd == '\0') if (target == NULL || *target == '\0' || *ctcpcmd == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); 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; return;
if (*nick == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); 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)) if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED); 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)) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &channel, &rest))
return; return;
if (strcmp(channel, "*") == 0 || *channel == '\0') { if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item)) if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED); cmd_param_error(CMDERR_NOT_JOINED);
channel = IRC_CHANNEL(item)->name; channel = IRC_CHANNEL(item)->name;
} }
if (strcmp(channel, "**") == 0) { if (g_strcmp0(channel, "**") == 0) {
/* ** displays all nicks.. */ /* ** displays all nicks.. */
*channel = '\0'; *channel = '\0';
} }
@ -313,14 +313,14 @@ static void cmd_names(const char *data, IRC_SERVER_REC *server,
PARAM_FLAG_GETREST, "names", &optlist, &channel)) PARAM_FLAG_GETREST, "names", &optlist, &channel))
return; return;
if (strcmp(channel, "*") == 0 || *channel == '\0') { if (g_strcmp0(channel, "*") == 0 || *channel == '\0') {
if (!IS_IRC_CHANNEL(item)) if (!IS_IRC_CHANNEL(item))
cmd_param_error(CMDERR_NOT_JOINED); cmd_param_error(CMDERR_NOT_JOINED);
channel = IRC_CHANNEL(item)->name; channel = IRC_CHANNEL(item)->name;
} }
if (strcmp(channel, "**") == 0) { if (g_strcmp0(channel, "**") == 0) {
/* ** displays all nicks.. */ /* ** displays all nicks.. */
irc_send_cmd(server, "NAMES"); irc_send_cmd(server, "NAMES");
} else { } else {
@ -409,7 +409,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
query = qserver = queryitem->name; query = qserver = queryitem->name;
} }
if (strcmp(query, "*") == 0 && if (g_strcmp0(query, "*") == 0 &&
g_hash_table_lookup(optlist, "yes") == NULL) g_hash_table_lookup(optlist, "yes") == NULL)
cmd_param_error(CMDERR_NOT_GOOD_IDEA); 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) { for (ptr = server->knockoutlist; ptr != NULL; ptr = ptr->next) {
rec = ptr->data; rec = ptr->data;
if (channel == rec->channel && if (channel == rec->channel &&
!strcmp(rec->ban, banmasks)) !g_strcmp0(rec->ban, banmasks))
break; break;
} }
if (ptr == NULL) { if (ptr == NULL) {

View File

@ -67,13 +67,13 @@ static void check_query_changes(IRC_SERVER_REC *server, const char *nick,
if (query == NULL) if (query == NULL)
return; return;
if (strcmp(query->name, nick) != 0) { if (g_strcmp0(query->name, nick) != 0) {
/* upper/lowercase chars in nick changed */ /* upper/lowercase chars in nick changed */
query_change_nick(query, nick); query_change_nick(query, nick);
} }
if (address != NULL && (query->address == NULL || if (address != NULL && (query->address == NULL ||
strcmp(query->address, address) != 0)) { g_strcmp0(query->address, address) != 0)) {
/* host changed */ /* host changed */
query_change_address(query, address); query_change_address(query, address);
} }
@ -109,7 +109,7 @@ static void event_nick(SERVER_REC *server, const char *data,
query = query_find(server, orignick); query = query_find(server, orignick);
if (query != NULL) { if (query != NULL) {
params = event_get_params(data, 1, &nick); 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); query_change_nick(query, nick);
g_free(params); g_free(params);
} }

View File

@ -314,6 +314,8 @@ SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn)
void irc_server_connect(SERVER_REC *server) void irc_server_connect(SERVER_REC *server)
{ {
g_return_if_fail(server != NULL);
if (!server_start_connect(server)) { if (!server_start_connect(server)) {
server_connect_unref(server->connrec); server_connect_unref(server->connrec);
g_free(server); 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); 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. */ /* nick changed unexpectedly .. connected via proxy, etc. */
g_free(server->nick); g_free(server->nick);
server->nick = g_strdup(nick); server->nick = g_strdup(nick);

View File

@ -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, "emode_known", server->emode_known);
config_node_set_bool(config, node, "isupport_sent", server->isupport_sent); 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.config = config;
isupport_data.node = isupport; isupport_data.node = isupport;
@ -95,7 +95,7 @@ static void sig_session_restore_server(IRC_SERVER_REC *server,
(GCompareFunc) g_istr_equal); (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); tmp = node == NULL ? NULL : config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp)) { for (; tmp != NULL; tmp = config_node_next(tmp)) {

View File

@ -398,7 +398,7 @@ void parse_channel_modes(IRC_CHANNEL_REC *channel, const char *setby,
old_key = NULL; old_key = NULL;
} }
if (strcmp(newmode->str, channel->mode) != 0) { if (g_strcmp0(newmode->str, channel->mode) != 0) {
g_free(channel->mode); g_free(channel->mode);
channel->mode = g_strdup(newmode->str); channel->mode = g_strdup(newmode->str);
@ -842,7 +842,7 @@ static void cmd_mode(const char *data, IRC_SERVER_REC *server,
return; return;
} }
if (strcmp(target, "*") == 0) { if (g_strcmp0(target, "*") == 0) {
if (!IS_IRC_CHANNEL(channel)) if (!IS_IRC_CHANNEL(channel))
cmd_param_error(CMDERR_NOT_JOINED); cmd_param_error(CMDERR_NOT_JOINED);

View File

@ -339,7 +339,7 @@ static GSList *redirect_cmd_list_find(GSList *list, const char *event)
while (list != NULL) { while (list != NULL) {
const char *str = list->data; const char *str = list->data;
if (strcmp(str, event) == 0) if (g_strcmp0(str, event) == 0)
break; break;
list = list->next->next; list = list->next->next;
} }
@ -365,7 +365,7 @@ static const char *redirect_match(REDIRECT_REC *redirect, const char *event,
use the default signal */ use the default signal */
signal = NULL; signal = NULL;
for (tmp = redirect->signals; tmp != NULL; tmp = tmp->next->next) { 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; signal = tmp->next->data;
break; break;
} }
@ -527,7 +527,7 @@ server_redirect_get(IRC_SERVER_REC *server, const char *prefix,
next = ptr->next; next = ptr->next;
r = ptr->data; r = ptr->data;
if (prefix != NULL && r->prefix != NULL && if (prefix != NULL && r->prefix != NULL &&
strcmp(prefix, r->prefix)) { g_strcmp0(prefix, r->prefix)) {
/* not from this server */ /* not from this server */
continue; continue;
} }

View File

@ -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 /* don't autoget files beginning with a dot, if download dir is
our home dir (stupid kludge for stupid people) */ our home dir (stupid kludge for stupid people) */
if (*dcc->arg == '.' && if (*dcc->arg == '.' &&
strcmp(settings_get_str("dcc_download_path"), "~") == 0) g_strcmp0(settings_get_str("dcc_download_path"), "~") == 0)
return; return;
/* check file size limit, NOTE: it's still possible to send a /* check file size limit, NOTE: it's still possible to send a

View File

@ -191,7 +191,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
return; return;
/* handle only DCC messages */ /* handle only DCC messages */
if (strcmp(target, "*") == 0) if (g_strcmp0(target, "*") == 0)
dcc = item_get_dcc(item); dcc = item_get_dcc(item);
else if (*target == '=') else if (*target == '=')
dcc = dcc_chat_find_id(target+1); 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); g_strfreev(params);
return; 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)); dcc = DCC_CHAT(dcc_find_request(DCC_CHAT_TYPE, nick, NULL));
if (dcc != NULL) { if (dcc != NULL) {

View File

@ -554,7 +554,7 @@ void cmd_dcc_receive(const char *data, DCC_GET_FUNC accept_func,
next = tmp->next; next = tmp->next;
if (IS_DCC_GET(dcc) && g_ascii_strcasecmp(dcc->nick, nick) == 0 && if (IS_DCC_GET(dcc) && g_ascii_strcasecmp(dcc->nick, nick) == 0 &&
(dcc_is_waiting_user(dcc) || dcc->from_dccserver) && (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; found = TRUE;
if (!dcc_is_passive(dcc)) if (!dcc_is_passive(dcc))
accept_func(dcc); accept_func(dcc);

View File

@ -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) && if (dcc->type == type && !dcc_is_connected(dcc) &&
g_ascii_strcasecmp(dcc->nick, nick) == 0 && g_ascii_strcasecmp(dcc->nick, nick) == 0 &&
(arg == NULL || strcmp(dcc->arg, arg) == 0)) (arg == NULL || g_strcmp0(dcc->arg, arg) == 0))
return dcc; return dcc;
} }
@ -516,7 +516,7 @@ static void cmd_dcc_close(char *data, IRC_SERVER_REC *server)
next = tmp->next; next = tmp->next;
if (dcc->type == type && g_ascii_strcasecmp(dcc->nick, nick) == 0 && 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); dcc_reject(dcc, server);
found = TRUE; found = TRUE;
} }

View File

@ -30,7 +30,7 @@ void notifylist_add_config(NOTIFYLIST_REC *rec)
CONFIG_NODE *node; CONFIG_NODE *node;
node = iconfig_node_traverse("notifies", TRUE); 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) if (rec->away_check)
iconfig_node_set_bool(node, "away_check", TRUE); 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); iconfig_node_set_str(node, "ircnets", NULL);
if (rec->ircnets != NULL && *rec->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); iconfig_node_add_list(node, rec->ircnets);
} }
} }
@ -73,7 +73,7 @@ void notifylist_read_config(void)
rec->mask = g_strdup(node->key); rec->mask = g_strdup(node->key);
rec->away_check = config_node_get_bool(node, "away_check", FALSE); 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); if (node != NULL) rec->ircnets = config_node_get_list(node);
} }
} }

View File

@ -91,7 +91,7 @@ int notifylist_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet)
if (rec->ircnets == NULL) return TRUE; if (rec->ircnets == NULL) return TRUE;
if (ircnet == NULL) return FALSE; 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++) { for (tmp = rec->ircnets; *tmp != NULL; tmp++) {
if (g_ascii_strcasecmp(*tmp, ircnet) == 0) if (g_ascii_strcasecmp(*tmp, ircnet) == 0)

View File

@ -209,7 +209,7 @@ static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client)
void proxy_client_reset_nick(CLIENT_REC *client) void proxy_client_reset_nick(CLIENT_REC *client)
{ {
if (client->server == NULL || if (client->server == NULL ||
strcmp(client->nick, client->server->nick) == 0) g_strcmp0(client->nick, client->server->nick) == 0)
return; return;
proxy_outdata(client, ":%s!proxy NICK :%s\n", proxy_outdata(client, ":%s!proxy NICK :%s\n",

View File

@ -84,7 +84,7 @@ static void grab_who(CLIENT_REC *client, const char *channel)
arg = g_string_new(channel); arg = g_string_new(channel);
for (tmp = list, count = 0; *tmp != NULL; tmp++, count++) { for (tmp = list, count = 0; *tmp != NULL; tmp++, count++) {
if (strcmp(*tmp, "0") == 0) { if (g_strcmp0(*tmp, "0") == 0) {
/* /who 0 displays everyone */ /* /who 0 displays everyone */
**tmp = '*'; **tmp = '*';
} }
@ -108,18 +108,18 @@ static void handle_client_connect_cmd(CLIENT_REC *client,
password = settings_get_str("irssiproxy_password"); password = settings_get_str("irssiproxy_password");
if (password != NULL && strcmp(cmd, "PASS") == 0) { if (password != NULL && g_strcmp0(cmd, "PASS") == 0) {
if (strcmp(password, args) == 0) if (g_strcmp0(password, args) == 0)
client->pass_sent = TRUE; client->pass_sent = TRUE;
else { else {
/* wrong password! */ /* wrong password! */
remove_client(client); remove_client(client);
return; return;
} }
} else if (strcmp(cmd, "NICK") == 0) { } else if (g_strcmp0(cmd, "NICK") == 0) {
g_free_not_null(client->nick); g_free_not_null(client->nick);
client->nick = g_strdup(args); client->nick = g_strdup(args);
} else if (strcmp(cmd, "USER") == 0) { } else if (g_strcmp0(cmd, "USER") == 0) {
client->user_sent = TRUE; client->user_sent = TRUE;
} }
@ -147,12 +147,12 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
return; return;
} }
if (strcmp(cmd, "QUIT") == 0) { if (g_strcmp0(cmd, "QUIT") == 0) {
remove_client(client); remove_client(client);
return; return;
} }
if (strcmp(cmd, "PING") == 0) { if (g_strcmp0(cmd, "PING") == 0) {
/* Reply to PING, if the target parameter is either /* Reply to PING, if the target parameter is either
proxy_adress, our own nick or empty. */ proxy_adress, our own nick or empty. */
char *params, *origin, *target; char *params, *origin, *target;
@ -170,7 +170,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
g_free(params); g_free(params);
} }
if (strcmp(cmd, "PROXY") == 0) { if (g_strcmp0(cmd, "PROXY") == 0) {
if (g_ascii_strcasecmp(args, "CTCP ON") == 0) { if (g_ascii_strcasecmp(args, "CTCP ON") == 0) {
/* client wants all ctcps */ /* client wants all ctcps */
client->want_ctcp = 1; 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 */ /* check if the command could be redirected */
if (strcmp(cmd, "WHO") == 0) if (g_strcmp0(cmd, "WHO") == 0)
grab_who(client, args); 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); proxy_redirect_event(client, "whowas", 1, args, -1);
else if (strcmp(cmd, "WHOIS") == 0) { else if (g_strcmp0(cmd, "WHOIS") == 0) {
char *p; char *p;
/* convert dots to spaces */ /* convert dots to spaces */
@ -218,11 +218,11 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
if (*p == ',') *p = ' '; if (*p == ',') *p = ' ';
proxy_redirect_event(client, "whois", 1, args, TRUE); 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); 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); 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 */ /* convert dots to spaces */
char *slist, *str, mode, *p; char *slist, *str, mode, *p;
int argc; int argc;
@ -258,7 +258,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
} }
g_free(str); g_free(str);
g_free(slist); g_free(slist);
} else if (strcmp(cmd, "PRIVMSG") == 0) { } else if (g_strcmp0(cmd, "PRIVMSG") == 0) {
/* send the message to other clients as well */ /* send the message to other clients as well */
char *params, *target, *msg; char *params, *target, *msg;
@ -289,9 +289,9 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
} }
ignore_next = FALSE; ignore_next = FALSE;
g_free(params); g_free(params);
} else if (strcmp(cmd, "PING") == 0) { } else if (g_strcmp0(cmd, "PING") == 0) {
proxy_redirect_event(client, "ping", 1, NULL, TRUE); 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 */ /* set the away reason */
if (args != NULL) { if (args != NULL) {
g_free(client->server->away_reason); g_free(client->server->away_reason);
@ -354,7 +354,7 @@ static void sig_listen(LISTEN_REC *listen)
rec->handle = sendbuf; rec->handle = sendbuf;
rec->host = g_strdup(host); rec->host = g_strdup(host);
rec->port = port; rec->port = port;
if (strcmp(listen->ircnet, "*") == 0) { if (g_strcmp0(listen->ircnet, "*") == 0) {
rec->proxy_address = g_strdup("irc.proxy"); rec->proxy_address = g_strdup("irc.proxy");
rec->server = servers == NULL ? NULL : IRC_SERVER(servers->data); rec->server = servers == NULL ? NULL : IRC_SERVER(servers->data);
} else { } 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, " :\001") != NULL &&
strstr(args, " :\001ACTION") == NULL) { strstr(args, " :\001ACTION") == NULL) {
/* CTCP - either answer ourself or forward it to one client */ /* 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; return;
} }
if (strcmp(event, "event ping") == 0 || if (g_strcmp0(event, "event ping") == 0 ||
strcmp(event, "event pong") == 0) { g_strcmp0(event, "event pong") == 0) {
/* We want to answer ourself to PINGs and CTCPs. /* We want to answer ourself to PINGs and CTCPs.
Also hide PONGs from clients. */ Also hide PONGs from clients. */
g_free(event); g_free(event);
@ -470,7 +470,7 @@ static void event_connected(IRC_SERVER_REC *server)
CLIENT_REC *rec = tmp->data; CLIENT_REC *rec = tmp->data;
if (rec->connected && rec->server == NULL && if (rec->connected && rec->server == NULL &&
(strcmp(rec->listen->ircnet, "*") == 0 || (g_strcmp0(rec->listen->ircnet, "*") == 0 ||
(chatnet != NULL && (chatnet != NULL &&
g_ascii_strcasecmp(chatnet, rec->listen->ircnet) == 0))) { g_ascii_strcasecmp(chatnet, rec->listen->ircnet) == 0))) {
proxy_outdata(rec, ":%s NOTICE %s :Connected to server\n", proxy_outdata(rec, ":%s NOTICE %s :Connected to server\n",

View File

@ -38,12 +38,12 @@ CONFIG_NODE *config_node_find(CONFIG_NODE *node, const char *key)
return NULL; 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) int index, int new_type)
{ {
CONFIG_NODE *node; 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); node = key == NULL ? NULL : config_node_find(parent, key);
if (node != NULL) { if (node != NULL) {
g_return_val_if_fail(new_type == -1 || new_type == node->type, NULL);
nindex = g_slist_index(parent->value, node); nindex = g_slist_index(parent->value, node);
if (index >= 0 && nindex != index && if (index >= 0 && nindex != index &&
nindex <= g_slist_length(parent->value)) { nindex <= g_slist_length(parent->value)) {
@ -62,8 +61,26 @@ CONFIG_NODE *config_node_section_index(CONFIG_NODE *parent, const char *key,
parent->value = g_slist_remove(parent->value, node); parent->value = g_slist_remove(parent->value, node);
parent->value = g_slist_insert(parent->value, node, index); parent->value = g_slist_insert(parent->value, node, index);
} }
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; return node;
} }
}
if (new_type == -1) if (new_type == -1)
return NULL; return NULL;
@ -91,7 +108,21 @@ CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int crea
/* check if it already exists in cache */ /* check if it already exists in cache */
node = g_hash_table_lookup(rec->cache, section); 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; 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); list = g_strsplit(section, "/", -1);
for (tmp = list; *tmp != NULL; tmp++) { for (tmp = list; *tmp != NULL; tmp++) {
is_list = **tmp == '('; is_list = **tmp == '(';
if (create) new_type = is_list ? NODE_TYPE_LIST : NODE_TYPE_BLOCK; if (create) {
CONFIG_NODE *tmpnode;
node = config_node_section(node, *tmp + is_list, new_type); 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(rec, node, *tmp + is_list, new_type);
if (node == NULL) { if (node == NULL) {
g_strfreev(list); g_strfreev(list);
return NULL; return NULL;
@ -111,7 +151,7 @@ CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int crea
if (!is_node_list(node)) { if (!is_node_list(node)) {
/* Will die. Better to not corrupt the config further in this case. */ /* 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; return NULL;
} }

View File

@ -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); 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. /* 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 */ 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(CONFIG_REC *rec, 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_index(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key,
int index, int new_type); int index, int new_type);
/* Find the section with the whole path. /* Find the section with the whole path.
Create the path if necessary if `create' is TRUE. */ Create the path if necessary if `create' is TRUE. */

View File

@ -173,7 +173,7 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
if (key == NULL && node->type != NODE_TYPE_LIST) if (key == NULL && node->type != NODE_TYPE_LIST)
return G_TOKEN_ERROR; 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) '}'); config_parse_loop(rec, newnode, (GTokenType) '}');
g_free_not_null(key); g_free_not_null(key);
@ -188,7 +188,7 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
/* list */ /* list */
if (key == NULL) if (key == NULL)
return G_TOKEN_ERROR; 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) ')'); config_parse_loop(rec, newnode, (GTokenType) ')');
g_free_not_null(key); g_free_not_null(key);

View File

@ -104,8 +104,14 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key,
return; 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 (node != NULL) {
if (strcmp(node->value, value) == 0) if (g_strcmp0(node->value, value) == 0)
return; return;
g_free(node->value); g_free(node->value);
} else { } else {

View File

@ -44,7 +44,7 @@ static int print_script_errors;
static char *perl_args[] = {"", "-e", "0"}; static char *perl_args[] = {"", "-e", "0"};
#define IS_PERL_SCRIPT(file) \ #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) 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) { for (tmp = perl_scripts; tmp != NULL; tmp = tmp->next) {
PERL_SCRIPT_REC *rec = tmp->data; PERL_SCRIPT_REC *rec = tmp->data;
if (strcmp(rec->name, name) == 0) if (g_strcmp0(rec->name, name) == 0)
return rec; 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) { for (tmp = perl_scripts; tmp != NULL; tmp = tmp->next) {
PERL_SCRIPT_REC *rec = tmp->data; PERL_SCRIPT_REC *rec = tmp->data;
if (strcmp(rec->package, package) == 0) if (g_strcmp0(rec->package, package) == 0)
return rec; return rec;
} }

View File

@ -170,7 +170,7 @@ static void cmd_load(const char *data, SERVER_REC *server, void *item)
return; return;
len = strlen(rootmodule); 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 */ /* make /LOAD script.pl work as expected */
signal_stop(); signal_stop();
cmd_script_load(data); cmd_script_load(data);

View File

@ -99,14 +99,14 @@ void perl_signal_args_to_c(
if (!SvOK(arg)) { if (!SvOK(arg)) {
c_arg = NULL; 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); 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); 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); saved_args[n].v_ulong = SvUV(arg);
c_arg = &saved_args[n].v_ulong; 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)); saved_args[n].v_int = SvIV(SvRV(arg));
c_arg = &saved_args[n].v_int; c_arg = &saved_args[n].v_int;
} else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { } else if (strncmp(rec->args[n], "glistptr_", 9) == 0) {
@ -122,7 +122,7 @@ void perl_signal_args_to_c(
} }
av = (AV *)t; av = (AV *)t;
is_str = strcmp(rec->args[n]+9, "char*") == 0; is_str = g_strcmp0(rec->args[n]+9, "char*") == 0;
gl = NULL; gl = NULL;
count = av_len(av) + 1; count = av_len(av) + 1;
@ -181,7 +181,7 @@ void perl_signal_args_to_c(
continue; continue;
} }
if (strcmp(rec->args[n], "intptr") == 0) { if (g_strcmp0(rec->args[n], "intptr") == 0) {
SV *t = SvRV(arg); SV *t = SvRV(arg);
SvIOK_only(t); SvIOK_only(t);
SvIV_set(t, saved_args[n].v_int); SvIV_set(t, saved_args[n].v_int);
@ -192,8 +192,8 @@ void perl_signal_args_to_c(
AV *av; AV *av;
GList *gl, *tmp; GList *gl, *tmp;
is_iobject = strcmp(rec->args[n]+9, "iobject") == 0; is_iobject = g_strcmp0(rec->args[n]+9, "iobject") == 0;
is_str = strcmp(rec->args[n]+9, "char*") == 0; is_str = g_strcmp0(rec->args[n]+9, "char*") == 0;
av = (AV *)SvRV(arg); av = (AV *)SvRV(arg);
av_clear(av); av_clear(av);
@ -245,8 +245,8 @@ static void perl_call_signal(PERL_SCRIPT_REC *script, SV *func,
GList *tmp, **ptr; GList *tmp, **ptr;
int is_iobject, is_str; int is_iobject, is_str;
is_iobject = strcmp(rec->args[n]+9, "iobject") == 0; is_iobject = g_strcmp0(rec->args[n]+9, "iobject") == 0;
is_str = strcmp(rec->args[n]+9, "char*") == 0; is_str = g_strcmp0(rec->args[n]+9, "char*") == 0;
av = newAV(); av = newAV();
ptr = arg; 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); 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); perlarg = newSViv((IV)arg);
else if (arg == NULL) else if (arg == NULL)
perlarg = &PL_sv_undef; 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); 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); 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)); saved_args[n] = perlarg = newRV_noinc(newSViv(*(int *) arg));
else if (strncmp(rec->args[n], "gslist_", 7) == 0) { else if (strncmp(rec->args[n], "gslist_", 7) == 0) {
/* linked list - push as AV */ /* linked list - push as AV */
GSList *tmp; GSList *tmp;
int is_iobject; int is_iobject;
is_iobject = strcmp(rec->args[n]+7, "iobject") == 0; is_iobject = g_strcmp0(rec->args[n]+7, "iobject") == 0;
av = newAV(); av = newAV();
for (tmp = arg; tmp != NULL; tmp = tmp->next) { for (tmp = arg; tmp != NULL; tmp = tmp->next) {
sv = is_iobject ? iobject_bless((SERVER_REC *) tmp->data) : 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); 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 /* "irssi object" - any struct that has
"int type; int chat_type" as it's first "int type; int chat_type" as it's first
variables (server, channel, ..) */ variables (server, channel, ..) */
perlarg = iobject_bless((SERVER_REC *) arg); 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 /* "simple irssi object" - any struct that has
int type; as it's first variable (dcc) */ int type; as it's first variable (dcc) */
perlarg = simple_iobject_bless((SERVER_REC *) arg); 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) if (saved_args[n] == NULL)
continue; continue;
if (strcmp(rec->args[n], "intptr") == 0) { if (g_strcmp0(rec->args[n], "intptr") == 0) {
int *val = arg; int *val = arg;
*val = SvIV(SvRV(saved_args[n])); *val = SvIV(SvRV(saved_args[n]));
} else if (strncmp(rec->args[n], "glistptr_", 9) == 0) { } 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); 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_foreach(*ret, (GFunc) g_free, NULL);
g_list_free(*ret); g_list_free(*ret);
*ret = out; *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) \ #define sv_func_cmp(f1, f2) \
(f1 == f2 || (SvPOK(f1) && SvPOK(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) static void perl_signal_remove_list(GSList **list, SV *func)
{ {