summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL9
-rw-r--r--NEWS19
-rw-r--r--configure.ac2
-rw-r--r--docs/help/in/script.in2
-rw-r--r--scripts/buf.pl42
-rw-r--r--src/core/settings.c1
-rw-r--r--src/fe-common/core/completion.c4
-rw-r--r--src/fe-common/core/formats.c5
-rw-r--r--src/fe-common/irc/fe-irc-channels.c9
-rw-r--r--src/irc/core/irc-servers.c6
-rw-r--r--src/perl/common/Expando.xs4
-rw-r--r--src/perl/irc/Irc.xs25
-rw-r--r--src/perl/irc/Server.xs9
-rw-r--r--src/perl/irc/module.h1
-rw-r--r--src/perl/perl-core.c2
-rw-r--r--src/perl/perl-core.h2
-rw-r--r--src/perl/perl-fe.c13
-rw-r--r--src/perl/textui/Statusbar.xs5
18 files changed, 120 insertions, 40 deletions
diff --git a/INSTALL b/INSTALL
index 4c6f5681..5e6e2be0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -85,10 +85,11 @@ things that can go wrong:
- If configure complains that it doesn't find some perl stuff, you're
probably missing libperl.so or libperl.a. In debian, you'll need to do
apt-get install libperl-dev
- - For unprivileged home directory installations, using the local::lib CPAN
- module is recommended. Read its docs, bootstrap it if needed, ensure that
- the environment variables are set before running the configure script, and
- append "--with-perl-lib=site" to the configure parameters to use it.
+ - For unprivileged home directory installations, you probably do not want
+ to specify --with-perl-lib=(site|vendor). Instead, you can use the
+ default perl installation target (below the irssi prefix). If you are
+ using local::lib you can also choose to install there by specifying
+ --with-perl-lib=$PERL_LOCAL_LIB_ROOT/lib/perl5
You can verify that the perl module is loaded and working with "/LOAD"
command. It should print something like:
diff --git a/NEWS b/NEWS
index 6666400d..a76771e7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-v0.8.20-head 2016-xx-xx The Irssi team <staff@irssi.org>
+v0.8.21-head 2016-xx-xx The Irssi team <staff@irssi.org>
* Removed --disable-ipv6
* /connect Network now aborts with an error if no servers have been
added to that network.
@@ -17,14 +17,25 @@ v0.8.20-head 2016-xx-xx The Irssi team <staff@irssi.org>
+ autolog_ignore_targets and activity_hide_targets learn a new syntax
tag/* and * to ignore whole networks or everything.
+ /hilight got a -matchcase flag to hilight case sensitively (#421).
- - /squery and /servlist commands have been restored.
- - Where Irssi would previously only report "System error" on connect,
- it will now try harder to retrieve the system error message.
- IP addresses are no longer stored when resolve_reverse_lookup is
used.
- /names and $[...] now uses utf8 string operations (#40, #411).
- Removed broken support for curses.
+v0.8.20 2016-09-16 The Irssi team <staff@irssi.org>
+ - Correct the name of an emitted sasl signal (#484)
+ - Correct the prototype for the 'message private' signal (#515)
+ - Corrections in away and hilight help text (#477, #518)
+ - /squery and /servlist commands have been restored.
+ - Where Irssi would previously only report "System error" on connect,
+ it will now try harder to retrieve the system error message.
+ - Fixed issue with +channels not working properly (#533)
+ - Fixed crash in optchan when item has no server (#485)
+ - Fixed random remote crash in the nicklist handling (#529)
+ - Fixed remote crash due to incorrect bounds checking on
+ formats, reported by Gabriel Campana and Adrien Guinet from
+ Quarkslab.
+
v0.8.19 2016-03-23 The Irssi team <staff@irssi.org>
- Fixed regression when joining and parting channels on IRCnet (#435)
- Fixed SASL EXTERNAL (#432)
diff --git a/configure.ac b/configure.ac
index 653dfc99..ee03eb82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(irssi, 0.8.20-head)
+AC_INIT(irssi, 0.8.21-head)
AC_CONFIG_SRCDIR([src])
AC_CONFIG_AUX_DIR(build-aux)
AC_PREREQ(2.50)
diff --git a/docs/help/in/script.in b/docs/help/in/script.in
index 6e94ef7f..e90135ad 100644
--- a/docs/help/in/script.in
+++ b/docs/help/in/script.in
@@ -12,6 +12,8 @@
RESET: Unloads all the scripts.
-permanent: In combination with EXEC, the code will be loaded into the
memory.
+ -autorun: When passed to RESET the scripts in the autorun folder are
+ reloaded.
If no argument is given, the list of active scripts will be displayed.
diff --git a/scripts/buf.pl b/scripts/buf.pl
index da50e821..6d907f12 100644
--- a/scripts/buf.pl
+++ b/scripts/buf.pl
@@ -5,7 +5,7 @@ use Irssi qw(command signal_add signal_add_first active_win
settings_get_str settings_get_bool channels windows
settings_add_str settings_add_bool get_irssi_dir
window_find_refnum signal_stop);
-$VERSION = '2.13';
+$VERSION = '2.20';
%IRSSI = (
authors => 'Juerd',
contact => 'juerd@juerd.nl',
@@ -13,10 +13,8 @@ $VERSION = '2.13';
description => 'Saves the buffer for /upgrade, so that no information is lost',
license => 'Public Domain',
url => 'http://juerd.nl/irssi/',
- changed => 'Mon May 13 19:41 CET 2002',
- changes => 'Severe formatting bug removed * oops, I ' .
- 'exposed Irssi to ircII foolishness * sorry ' .
- '** removed logging stuff (this is a fix)',
+ changed => 'Thu Sep 22 01:37 CEST 2016',
+ changes => 'Fixed file permissions (leaked everything via filesystem)',
note1 => 'This script HAS TO BE in your scripts/autorun!',
note2 => 'Perl support must be static or in startup',
);
@@ -39,9 +37,15 @@ use Data::Dumper;
my %suppress;
+sub _filename { sprintf '%s/scrollbuffer', get_irssi_dir }
+
sub upgrade {
- open BUF, q{>}, sprintf('%s/scrollbuffer', get_irssi_dir) or die $!;
- print BUF join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
+ my $fn = _filename;
+ my $old_umask = umask 0077;
+ open my $fh, q{>}, $fn or die "open $fn: $!";
+ umask $old_umask;
+
+ print $fh join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
for my $window (windows) {
next unless defined $window;
next if $window->{name} eq 'status';
@@ -57,36 +61,39 @@ sub upgrade {
redo if defined $line;
}
}
- printf BUF "%s:%s\n%s", $window->{refnum}, $lines, $buf;
+ printf $fh "%s:%s\n%s", $window->{refnum}, $lines, $buf;
}
- close BUF;
+ close $fh;
unlink sprintf("%s/sessionconfig", get_irssi_dir);
command 'layout save';
command 'save';
}
sub restore {
- open BUF, q{<}, sprintf('%s/scrollbuffer', get_irssi_dir) or die $!;
- my @suppress = split /\0/, <BUF>;
+ my $fn = _filename;
+ open my $fh, q{<}, $fn or die "open $fn: $!";
+ unlink $fn or warn "unlink $fn: $!";
+
+ my @suppress = split /\0/, readline $fh;
if (settings_get_bool 'upgrade_suppress_join') {
chomp $suppress[-1];
@suppress{@suppress} = (2) x @suppress;
}
active_win->command('^window scroll off');
- while (my $bla = <BUF>){
+ while (my $bla = readline $fh){
chomp $bla;
my ($refnum, $lines) = split /:/, $bla;
next unless $lines;
my $window = window_find_refnum $refnum;
unless (defined $window){
- <BUF> for 1..$lines;
+ readline $fh for 1..$lines;
next;
}
my $view = $window->view;
$view->remove_all_lines();
$view->redraw();
my $buf = '';
- $buf .= <BUF> for 1..$lines;
+ $buf .= readline $fh for 1..$lines;
my $sep = settings_get_str 'upgrade_separator';
$sep .= "\n" if $sep ne '';
$window->gui_printtext_after(undef, MSGLEVEL_CLIENTNOTICE, "$buf\cO$sep");
@@ -119,3 +126,10 @@ signal_add 'event join' => 'suppress';
unless (-f sprintf('%s/scripts/autorun/buf.pl', get_irssi_dir)) {
Irssi::print('PUT THIS SCRIPT IN ~/.irssi/scripts/autorun/ BEFORE /UPGRADING!!');
}
+
+# Remove any left-over file. If 'session' doesn't exist (created by irssi
+# during /UPGRADE), neither should our file.
+unless (-e sprintf('%s/session', get_irssi_dir)) {
+ my $fn = _filename;
+ unlink $fn or warn "unlink $fn: $!" if -e $fn;
+}
diff --git a/src/core/settings.c b/src/core/settings.c
index e65ceb2c..4e0717cd 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -585,6 +585,7 @@ void settings_check_module(const char *module)
for (; tmp != NULL; tmp = next) {
node = tmp->data;
next = config_node_next(tmp);
+ if (node->key == NULL) continue;
set = g_hash_table_lookup(settings, node->key);
if (backwards_compatibility(module, node, parent))
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 46fd9db7..76dfbb79 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -345,7 +345,9 @@ GList *filename_complete(const char *path, const char *default_path)
(dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
continue; /* skip . and .. */
- if (basename[0] != '.')
+ /* Skip the dotfiles unless the user explicitly asked us
+ * to do so. Basename might be './', beware of that */
+ if (basename[0] != '.' || basename[1] == '\0')
continue;
}
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c
index 3e88426f..9aa7698d 100644
--- a/src/fe-common/core/formats.c
+++ b/src/fe-common/core/formats.c
@@ -131,6 +131,8 @@ void unformat_24bit_color(char **ptr, int off, int *fgcolor, int *bgcolor, int *
unsigned char rgbx[4];
unsigned int i;
for (i = 0; i < 4; ++i) {
+ if ((*ptr)[i + off] == '\0')
+ return;
rgbx[i] = (*ptr)[i + off];
}
rgbx[3] -= 0x20;
@@ -1341,6 +1343,9 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
bgcolor = *ptr==(char)0xff ? -1 : *ptr-'0';
}
}
+ if (*ptr == '\0')
+ break;
+
ptr++;
break;
case 6:
diff --git a/src/fe-common/irc/fe-irc-channels.c b/src/fe-common/irc/fe-irc-channels.c
index a2737fc3..0ec30003 100644
--- a/src/fe-common/irc/fe-irc-channels.c
+++ b/src/fe-common/irc/fe-irc-channels.c
@@ -41,7 +41,7 @@ int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target)
statusmsg = g_hash_table_lookup(server->isupport, "statusmsg");
if (statusmsg == NULL)
- statusmsg = "@+";
+ statusmsg = "@";
return strchr(statusmsg, *target) != NULL;
}
@@ -61,12 +61,9 @@ const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target)
statusmsg = g_hash_table_lookup(server->isupport, "statusmsg");
/* Hack: for bahamut 1.4 which sends neither STATUSMSG nor
- * WALLCHOPS in 005, accept @#chan and @+#chan (but not +#chan) */
- if (statusmsg == NULL && *target != '@')
- return target;
-
+ * WALLCHOPS in 005 */
if (statusmsg == NULL)
- statusmsg = "@+";
+ statusmsg = "@";
/* Strip the leading statusmsg prefixes */
while (strchr(statusmsg, *target) != NULL) {
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 9a3e9a67..79aeb227 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -89,8 +89,10 @@ static int ischannel_func(SERVER_REC *server, const char *data)
chantypes = "#&!+"; /* normal, local, secure, modeless */
statusmsg = g_hash_table_lookup(irc_server->isupport, "statusmsg");
- if (statusmsg != NULL)
- data += strspn(data, statusmsg);
+ if (statusmsg == NULL)
+ statusmsg = "@";
+
+ data += strspn(data, statusmsg);
/* strchr(3) considers the trailing NUL as part of the string, make sure
* we didn't advance too much. */
diff --git a/src/perl/common/Expando.xs b/src/perl/common/Expando.xs
index bb5d185b..26800b05 100644
--- a/src/perl/common/Expando.xs
+++ b/src/perl/common/Expando.xs
@@ -85,7 +85,9 @@ static char *perl_expando_event(PerlExpando *rec, SERVER_REC *server,
script_unregister_expandos(script);
/* rec has been freed now */
- signal_emit("script error", 2, script, SvPV_nolen(ERRSV));
+ char *error = g_strdup(SvPV_nolen(ERRSV));
+ signal_emit("script error", 2, script, error);
+ g_free(error);
} else if (retcount > 0) {
ret = g_strdup(POPp);
*free_ret = TRUE;
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs
index 3f8ccc2e..8b3b0c45 100644
--- a/src/perl/irc/Irc.xs
+++ b/src/perl/irc/Irc.xs
@@ -11,12 +11,15 @@ static void perl_irc_connect_fill_hash(HV *hv, IRC_SERVER_CONNECT_REC *conn)
static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server)
{
- perl_irc_connect_fill_hash(hv, server->connrec);
- perl_server_fill_hash(hv, (SERVER_REC *) server);
+ AV *av;
+ GSList *tmp;
+
+ perl_irc_connect_fill_hash(hv, server->connrec);
+ perl_server_fill_hash(hv, (SERVER_REC *) server);
- (void) hv_store(hv, "real_address", 12, new_pv(server->real_address), 0);
- (void) hv_store(hv, "usermode", 8, new_pv(server->usermode), 0);
- (void) hv_store(hv, "userhost", 8, new_pv(server->userhost), 0);
+ (void) hv_store(hv, "real_address", 12, new_pv(server->real_address), 0);
+ (void) hv_store(hv, "usermode", 8, new_pv(server->usermode), 0);
+ (void) hv_store(hv, "userhost", 8, new_pv(server->userhost), 0);
(void) hv_store(hv, "max_cmds_at_once", 16, newSViv(server->max_cmds_at_once), 0);
(void) hv_store(hv, "cmd_queue_speed", 15, newSViv(server->cmd_queue_speed), 0);
@@ -27,6 +30,18 @@ static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server)
(void) hv_store(hv, "max_modes_in_cmd", 16, newSViv(server->max_modes_in_cmd), 0);
(void) hv_store(hv, "max_whois_in_cmd", 16, newSViv(server->max_whois_in_cmd), 0);
(void) hv_store(hv, "isupport_sent", 13, newSViv(server->isupport_sent), 0);
+
+ (void) hv_store(hv, "cap_complete", 12, newSViv(server->cap_complete), 0);
+
+ av = newAV();
+ for (tmp = server->cap_supported; tmp != NULL; tmp = tmp->next)
+ av_push(av, new_pv(tmp->data));
+ (void) hv_store(hv, "cap_supported", 13, newRV_noinc((SV*)av), 0);
+
+ av = newAV();
+ for (tmp = server->cap_active; tmp != NULL; tmp = tmp->next)
+ av_push(av, new_pv(tmp->data));
+ (void) hv_store(hv, "cap_active", 10, newRV_noinc((SV*)av), 0);
}
static void perl_ban_fill_hash(HV *hv, BAN_REC *ban)
diff --git a/src/perl/irc/Server.xs b/src/perl/irc/Server.xs
index 0e9ec672..33417bf5 100644
--- a/src/perl/irc/Server.xs
+++ b/src/perl/irc/Server.xs
@@ -149,3 +149,12 @@ CODE:
OUTPUT:
RETVAL
+int
+irc_server_cap_toggle(server, cap, enable)
+ Irssi::Irc::Server server
+ char *cap
+ int enable
+CODE:
+ RETVAL = cap_toggle(server, cap, enable);
+OUTPUT:
+ RETVAL
diff --git a/src/perl/irc/module.h b/src/perl/irc/module.h
index 91c19c7a..a2454545 100644
--- a/src/perl/irc/module.h
+++ b/src/perl/irc/module.h
@@ -6,6 +6,7 @@
#include "irc-queries.h"
#include "irc-nicklist.h"
#include "irc-masks.h"
+#include "irc-cap.h"
#include "bans.h"
#include "modes.h"
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index cb690906..2c61df70 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -393,7 +393,7 @@ int perl_get_api_version(void)
return IRSSI_PERL_API_VERSION;
}
-static void perl_scripts_autorun(void)
+void perl_scripts_autorun(void)
{
DIR *dirp;
struct dirent *dp;
diff --git a/src/perl/perl-core.h b/src/perl/perl-core.h
index b451cc5c..7390a6fd 100644
--- a/src/perl/perl-core.h
+++ b/src/perl/perl-core.h
@@ -16,6 +16,8 @@ extern GSList *perl_scripts;
void perl_scripts_init(void);
/* Destroy all perl scripts and deinitialize perl interpreter */
void perl_scripts_deinit(void);
+/* Load all the scripts in the autorun/ folder */
+void perl_scripts_autorun(void);
/* Load a perl script, path must be a full path. */
PERL_SCRIPT_REC *perl_script_load_file(const char *path);
diff --git a/src/perl/perl-fe.c b/src/perl/perl-fe.c
index 04305b63..396c80b7 100644
--- a/src/perl/perl-fe.c
+++ b/src/perl/perl-fe.c
@@ -119,8 +119,20 @@ static void cmd_script_unload(const char *data)
static void cmd_script_reset(const char *data)
{
+ void *free_arg;
+ GHashTable *optlist;
+
+ if (!cmd_get_params(data, &free_arg, 0 | PARAM_FLAG_OPTIONS,
+ "script reset", &optlist))
+ return;
+
perl_scripts_deinit();
perl_scripts_init();
+
+ if (g_hash_table_lookup(optlist, "autorun") != NULL)
+ perl_scripts_autorun();
+
+ cmd_params_free(free_arg);
}
static void cmd_script_list(void)
@@ -251,6 +263,7 @@ void fe_perl_init(void)
command_bind("script list", NULL, (SIGNAL_FUNC) cmd_script_list);
command_bind("load", NULL, (SIGNAL_FUNC) cmd_load);
command_set_options("script exec", "permanent");
+ command_set_options("script reset", "autorun");
signal_add("script error", (SIGNAL_FUNC) sig_script_error);
signal_add("complete command script load", (SIGNAL_FUNC) sig_complete_load);
diff --git a/src/perl/textui/Statusbar.xs b/src/perl/textui/Statusbar.xs
index a449e11d..8b0e5f65 100644
--- a/src/perl/textui/Statusbar.xs
+++ b/src/perl/textui/Statusbar.xs
@@ -77,7 +77,10 @@ static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
/* make sure we don't get back here */
script_unregister_statusbars(script);
}
- signal_emit("script error", 2, script, SvPV_nolen(ERRSV));
+
+ char *error = g_strdup(SvPV_nolen(ERRSV));
+ signal_emit("script error", 2, script, error);
+ g_free(error);
} else {
/* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
hv = hvref(item_sv);