summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
13 files changed, 69 insertions, 17 deletions
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);