1
0
mirror of https://github.com/irssi/irssi.git synced 2025-02-02 15:08:01 -05:00

Merge remote-tracking branch 'origin/master' into bracketed-paste

This commit is contained in:
dequis 2015-11-08 14:28:18 -03:00
commit 8c98e07eab
23 changed files with 159 additions and 75 deletions

View File

@ -1,3 +1,4 @@
sudo: false
language: perl language: perl
perl: perl:
- "5.20-shrplib" - "5.20-shrplib"
@ -7,28 +8,19 @@ env:
- CC=clang - CC=clang
- CC=gcc - CC=gcc
addons:
apt:
packages:
- libperl-dev
- elinks
before_install: before_install:
- sudo apt-get update -qq
- perl -V - perl -V
- sudo apt-get build-dep -qq irssi
- sudo apt-get install -qq lynx
install: true install: true
script: script:
- ./autogen.sh --with-proxy --with-bot --with-perl=module - ./autogen.sh --with-proxy --with-bot --with-perl=module --prefix=$HOME/irssi-build
- cat config.log - cat config.log
- make - make CFLAGS="-Wall -Werror"
- sudo make install - make install
notifications:
irc:
channels:
- "irc.freenode.net#irssi"
template:
- "%{repository} (%{commit}: %{author}): %{message}"
- "Build details : %{build_url}"
on_success: always
on_failure: always
use_notice: true
skip_join: true

View File

@ -7,6 +7,8 @@ AC_CONFIG_HEADERS([irssi-config.h])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 no-define foreign]) AM_INIT_AUTOMAKE([1.9 no-define foreign])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
AC_PROG_CC AC_PROG_CC

View File

@ -391,7 +391,7 @@ messages window.</p>
the connection into some window. IRSSI DOES NOT. There is no required the connection into some window. IRSSI DOES NOT. There is no required
relationship between window and server. You can connect to 10 servers relationship between window and server. You can connect to 10 servers
and manage them all in just one window, or join channel in each one of and manage them all in just one window, or join channel in each one of
them to one sigle window if you really want to. That being said, here's them to one single window if you really want to. That being said, here's
how you do connect to new server without closing the old connection:</p> how you do connect to new server without closing the old connection:</p>
<pre> <pre>

View File

@ -131,7 +131,7 @@ AC_DEFUN([AC_CHECK_CURSES],[
if test x$withval = xno ; then if test x$withval = xno ; then
search_ncurses=false search_ncurses=false
elif test x$withval != xyes ; then elif test x$withval != xyes ; then
AC_NCURSES($withval/include, ncurses.h, -L$withval/lib -lncurses, -I$withval/include, "ncurses on $withval/include") AC_NCURSES($withval/include, ncurses.h, -L$withval/lib -lncurses, -I$withval/include, [ncurses on $withval/include])
fi fi
) )

View File

@ -156,11 +156,17 @@ static void sig_init_finished(void)
static char *fix_path(const char *str) static char *fix_path(const char *str)
{ {
char *new_str = convert_home(str); char *new_str = convert_home(str);
if (!g_path_is_absolute(new_str)) { if (!g_path_is_absolute(new_str)) {
char *tmp_str = new_str; char *tmp_str = new_str;
new_str = g_strdup_printf("%s/%s", g_get_current_dir(), tmp_str); char *current_dir = g_get_current_dir();
new_str = g_build_path(G_DIR_SEPARATOR_S, current_dir, tmp_str, NULL);
g_free(current_dir);
g_free(tmp_str); g_free(tmp_str);
} }
return new_str; return new_str;
} }

View File

@ -24,6 +24,7 @@
#include "log.h" #include "log.h"
#include "servers.h" #include "servers.h"
#include "settings.h" #include "settings.h"
#include "write-buffer.h"
static LOG_REC *awaylog; static LOG_REC *awaylog;
static int away_filepos; static int away_filepos;
@ -62,6 +63,9 @@ static void awaylog_open(void)
return; return;
} }
/* Flush the dirty buffers to disk before acquiring the file position */
write_buffer_flush();
awaylog = log; awaylog = log;
away_filepos = lseek(log->handle, 0, SEEK_CUR); away_filepos = lseek(log->handle, 0, SEEK_CUR);
away_msgs = 0; away_msgs = 0;
@ -83,6 +87,9 @@ static void awaylog_close(void)
if (awaylog == log) awaylog = NULL; if (awaylog == log) awaylog = NULL;
/* Flush the dirty buffers to disk before showing the away log */
write_buffer_flush();
signal_emit("awaylog show", 3, log, GINT_TO_POINTER(away_msgs), signal_emit("awaylog show", 3, log, GINT_TO_POINTER(away_msgs),
GINT_TO_POINTER(away_filepos)); GINT_TO_POINTER(away_filepos));
log_close(log); log_close(log);

View File

@ -420,8 +420,8 @@ static void cmd_reconnect(const char *data, SERVER_REC *server)
cmd_param_error(CMDERR_NOT_CONNECTED); cmd_param_error(CMDERR_NOT_CONNECTED);
rec = reconnects->data; rec = reconnects->data;
} else { } else {
if (g_ascii_strncasecmp(data, "RECON-", 6) == 0) if (g_ascii_strncasecmp(tag, "RECON-", 6) == 0)
data += 6; tag += 6;
tagnum = atoi(tag); tagnum = atoi(tag);
rec = tagnum <= 0 ? NULL : reconnect_find_tag(tagnum); rec = tagnum <= 0 ? NULL : reconnect_find_tag(tagnum);

View File

@ -59,7 +59,7 @@ static SETTINGS_REC *settings_get(const char *key, SettingType type)
g_warning("settings_get(%s) : not found", key); g_warning("settings_get(%s) : not found", key);
return NULL; return NULL;
} }
if (type != -1 && rec->type != type) { if (type != SETTING_TYPE_ANY && rec->type != type) {
g_warning("settings_get(%s) : invalid type", key); g_warning("settings_get(%s) : invalid type", key);
return NULL; return NULL;
} }
@ -85,7 +85,7 @@ settings_get_str_type(const char *key, SettingType type)
const char *settings_get_str(const char *key) const char *settings_get_str(const char *key)
{ {
return settings_get_str_type(key, -1); return settings_get_str_type(key, SETTING_TYPE_ANY);
} }
int settings_get_int(const char *key) int settings_get_int(const char *key)
@ -163,6 +163,7 @@ char *settings_get_print(SETTINGS_REC *rec)
case SETTING_TYPE_TIME: case SETTING_TYPE_TIME:
case SETTING_TYPE_LEVEL: case SETTING_TYPE_LEVEL:
case SETTING_TYPE_SIZE: case SETTING_TYPE_SIZE:
case SETTING_TYPE_ANY:
value = g_strdup(settings_get_str(rec->key)); value = g_strdup(settings_get_str(rec->key));
break; break;
} }
@ -380,10 +381,10 @@ SettingType settings_get_type(const char *key)
{ {
SETTINGS_REC *rec; SETTINGS_REC *rec;
g_return_val_if_fail(key != NULL, -1); g_return_val_if_fail(key != NULL, SETTING_TYPE_ANY);
rec = g_hash_table_lookup(settings, key); rec = g_hash_table_lookup(settings, key);
return rec == NULL ? -1 : rec->type; return rec == NULL ? SETTING_TYPE_ANY : rec->type;
} }
/* Get the record of the setting */ /* Get the record of the setting */

View File

@ -7,7 +7,8 @@ typedef enum {
SETTING_TYPE_BOOLEAN, SETTING_TYPE_BOOLEAN,
SETTING_TYPE_TIME, SETTING_TYPE_TIME,
SETTING_TYPE_LEVEL, SETTING_TYPE_LEVEL,
SETTING_TYPE_SIZE SETTING_TYPE_SIZE,
SETTING_TYPE_ANY
} SettingType; } SettingType;
typedef struct { typedef struct {

View File

@ -362,8 +362,7 @@ static GList *completion_get_settings(const char *key, SettingType type)
for (tmp = sets; tmp != NULL; tmp = tmp->next) { for (tmp = sets; tmp != NULL; tmp = tmp->next) {
SETTINGS_REC *rec = tmp->data; SETTINGS_REC *rec = tmp->data;
if ((type == -1 || rec->type == type) && if ((type == SETTING_TYPE_ANY || rec->type == type) && g_ascii_strncasecmp(rec->key, key, len) == 0)
g_ascii_strncasecmp(rec->key, key, len) == 0)
complist = g_list_insert_sorted(complist, g_strdup(rec->key), (GCompareFunc) g_istr_cmp); complist = g_list_insert_sorted(complist, g_strdup(rec->key), (GCompareFunc) g_istr_cmp);
} }
g_slist_free(sets); g_slist_free(sets);
@ -682,7 +681,7 @@ static void sig_complete_set(GList **list, WINDOW_REC *window,
if (*line == '\0' || if (*line == '\0' ||
!g_strcmp0("-clear", line) || !g_strcmp0("-default", line)) !g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
*list = completion_get_settings(word, -1); *list = completion_get_settings(word, SETTING_TYPE_ANY);
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);
if (rec != NULL) { if (rec != NULL) {

View File

@ -149,29 +149,27 @@ static void cmd_set(char *data)
case SETTING_TYPE_TIME: case SETTING_TYPE_TIME:
if (!settings_set_time(key, clear ? "0" : if (!settings_set_time(key, clear ? "0" :
set_default ? rec->default_value.v_string : value)) set_default ? rec->default_value.v_string : value))
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_TIME);
TXT_INVALID_TIME);
break; break;
case SETTING_TYPE_LEVEL: case SETTING_TYPE_LEVEL:
if (!settings_set_level(key, clear ? "" : if (!settings_set_level(key, clear ? "" :
set_default ? rec->default_value.v_string : value)) set_default ? rec->default_value.v_string : value))
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_LEVEL);
TXT_INVALID_LEVEL);
break; break;
case SETTING_TYPE_SIZE: case SETTING_TYPE_SIZE:
if (!settings_set_size(key, clear ? "0" : if (!settings_set_size(key, clear ? "0" :
set_default ? rec->default_value.v_string : value)) set_default ? rec->default_value.v_string : value))
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_INVALID_SIZE);
TXT_INVALID_SIZE); break;
case SETTING_TYPE_ANY:
/* Unpossible! */
break; break;
} }
signal_emit("setup changed", 0); signal_emit("setup changed", 0);
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_SET_TITLE, rec->section);
TXT_SET_TITLE, rec->section);
set_print(rec); set_print(rec);
} else } else
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
TXT_SET_UNKNOWN, key);
} }
cmd_params_free(free_arg); cmd_params_free(free_arg);
@ -187,10 +185,11 @@ static void cmd_toggle(const char *data)
if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &key, &value)) if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_GETREST, &key, &value))
return; return;
if (*key == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); if (*key == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
type = settings_get_type(key); type = settings_get_type(key);
if (type == -1) if (type == SETTING_TYPE_ANY)
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key); printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_UNKNOWN, key);
else if (type != SETTING_TYPE_BOOLEAN) else if (type != SETTING_TYPE_BOOLEAN)
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_NOT_BOOLEAN, key); printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_SET_NOT_BOOLEAN, key);

View File

@ -31,6 +31,8 @@
#include "fe-windows.h" #include "fe-windows.h"
#include "printtext.h" #include "printtext.h"
#define MAX_EXPAND_RECURSION 100
GSList *keyinfos; GSList *keyinfos;
static GHashTable *keys, *default_keys; static GHashTable *keys, *default_keys;
@ -171,7 +173,7 @@ KEYINFO_REC *key_info_find(const char *id)
return NULL; return NULL;
} }
static int expand_key(const char *key, GSList **out); static int expand_key(const char *key, GSList **out, int *limit);
#define expand_out_char(out, c) \ #define expand_out_char(out, c) \
{ \ { \
@ -188,13 +190,17 @@ static int expand_key(const char *key, GSList **out);
g_slist_free(out); out = NULL; \ g_slist_free(out); out = NULL; \
} }
static int expand_combo(const char *start, const char *end, GSList **out) static int expand_combo(const char *start, const char *end, GSList **out, int *limit)
{ {
KEY_REC *rec; KEY_REC *rec;
KEYINFO_REC *info; KEYINFO_REC *info;
GSList *tmp, *tmp2, *list, *copy, *newout; GSList *tmp, *tmp2, *list, *copy, *newout;
char *str, *p; char *str, *p;
if ((*limit)-- < 0) {
return FALSE;
}
if (start == end) { if (start == end) {
/* single key */ /* single key */
expand_out_char(*out, *start); expand_out_char(*out, *start);
@ -229,7 +235,7 @@ static int expand_combo(const char *start, const char *end, GSList **out)
/* only one way to generate the combo, good */ /* only one way to generate the combo, good */
rec = list->data; rec = list->data;
g_slist_free(list); g_slist_free(list);
return expand_key(rec->key, out); return expand_key(rec->key, out, limit);
} }
/* multiple ways to generate the combo - /* multiple ways to generate the combo -
@ -244,7 +250,11 @@ static int expand_combo(const char *start, const char *end, GSList **out)
copy = g_slist_append(copy, g_string_new(str->str)); copy = g_slist_append(copy, g_string_new(str->str));
} }
if (!expand_key(rec->key, &copy)) { if (!expand_key(rec->key, &copy, limit)) {
if (*limit < 0) {
return FALSE;
}
/* illegal key combo, remove from list */ /* illegal key combo, remove from list */
expand_out_free(copy); expand_out_free(copy);
} else { } else {
@ -254,7 +264,11 @@ static int expand_combo(const char *start, const char *end, GSList **out)
rec = list->data; rec = list->data;
g_slist_free(list); g_slist_free(list);
if (!expand_key(rec->key, out)) { if (!expand_key(rec->key, out, limit)) {
if (*limit < 0) {
return FALSE;
}
/* illegal key combo, remove from list */ /* illegal key combo, remove from list */
expand_out_free(*out); expand_out_free(*out);
} }
@ -264,12 +278,16 @@ static int expand_combo(const char *start, const char *end, GSList **out)
} }
/* Expand key code - returns TRUE if successful. */ /* Expand key code - returns TRUE if successful. */
static int expand_key(const char *key, GSList **out) static int expand_key(const char *key, GSList **out, int *limit)
{ {
GSList *tmp; GSList *tmp;
const char *start; const char *start;
int last_hyphen; int last_hyphen;
if ((*limit)-- < 0) {
return FALSE;
}
/* meta-^W^Gf -> ^[-^W-^G-f */ /* meta-^W^Gf -> ^[-^W-^G-f */
start = NULL; last_hyphen = TRUE; start = NULL; last_hyphen = TRUE;
for (; *key != '\0'; key++) { for (; *key != '\0'; key++) {
@ -279,7 +297,7 @@ static int expand_key(const char *key, GSList **out)
continue; continue;
} }
if (!expand_combo(start, key-1, out)) if (!expand_combo(start, key-1, out, limit))
return FALSE; return FALSE;
expand_out_char(*out, '-'); expand_out_char(*out, '-');
start = NULL; start = NULL;
@ -332,7 +350,7 @@ static int expand_key(const char *key, GSList **out)
} }
if (start != NULL) if (start != NULL)
return expand_combo(start, key-1, out); return expand_combo(start, key-1, out, limit);
for (tmp = *out; tmp != NULL; tmp = tmp->next) { for (tmp = *out; tmp != NULL; tmp = tmp->next) {
GString *str = tmp->data; GString *str = tmp->data;
@ -346,12 +364,13 @@ static int expand_key(const char *key, GSList **out)
static void key_states_scan_key(const char *key, KEY_REC *rec) static void key_states_scan_key(const char *key, KEY_REC *rec)
{ {
GSList *tmp, *out; GSList *tmp, *out;
int limit = MAX_EXPAND_RECURSION;
if (g_strcmp0(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));
if (expand_key(key, &out)) { if (expand_key(key, &out, &limit)) {
for (tmp = out; tmp != NULL; tmp = tmp->next) { for (tmp = out; tmp != NULL; tmp = tmp->next) {
GString *str = tmp->data; GString *str = tmp->data;

View File

@ -56,7 +56,12 @@ static void cmd_network_list(void)
g_string_append_printf(str, "autosendcmd: %s, ", rec->autosendcmd); g_string_append_printf(str, "autosendcmd: %s, ", rec->autosendcmd);
if (rec->usermode != NULL) if (rec->usermode != NULL)
g_string_append_printf(str, "usermode: %s, ", rec->usermode); g_string_append_printf(str, "usermode: %s, ", rec->usermode);
if (rec->sasl_mechanism != NULL)
g_string_append_printf(str, "sasl_mechanism: %s, ", rec->sasl_mechanism);
if (rec->sasl_username != NULL)
g_string_append_printf(str, "sasl_username: %s, ", rec->sasl_username);
if (rec->sasl_password != NULL)
g_string_append_printf(str, "sasl_password: (pass), ");
if (rec->cmd_queue_speed > 0) if (rec->cmd_queue_speed > 0)
g_string_append_printf(str, "cmdspeed: %d, ", rec->cmd_queue_speed); g_string_append_printf(str, "cmdspeed: %d, ", rec->cmd_queue_speed);
if (rec->max_cmds_at_once > 0) if (rec->max_cmds_at_once > 0)

View File

@ -35,21 +35,21 @@ static unichar i_toupper(unichar c)
{ {
if (term_type == TERM_TYPE_UTF8) if (term_type == TERM_TYPE_UTF8)
return g_unichar_toupper(c); return g_unichar_toupper(c);
return (c >= 0 && c <= 255) ? toupper(c) : c; return c <= 255 ? toupper(c) : c;
} }
static unichar i_tolower(unichar c) static unichar i_tolower(unichar c)
{ {
if (term_type == TERM_TYPE_UTF8) if (term_type == TERM_TYPE_UTF8)
return g_unichar_tolower(c); return g_unichar_tolower(c);
return (c >= 0 && c <= 255) ? tolower(c) : c; return c <= 255 ? tolower(c) : c;
} }
static int i_isalnum(unichar c) static int i_isalnum(unichar c)
{ {
if (term_type == TERM_TYPE_UTF8) if (term_type == TERM_TYPE_UTF8)
return (g_unichar_isalnum(c) || mk_wcwidth(c) == 0); return (g_unichar_isalnum(c) || mk_wcwidth(c) == 0);
return (c >= 0 && c <= 255) ? isalnum(c) : 0; return c <= 255 ? isalnum(c) : 0;
} }
GUI_ENTRY_REC *active_entry; GUI_ENTRY_REC *active_entry;

View File

@ -227,8 +227,7 @@ static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor,
term_move(root_window, next_xpos, next_ypos); term_move(root_window, next_xpos, next_ypos);
if (flags & GUI_PRINT_FLAG_CLRTOEOL) if (flags & GUI_PRINT_FLAG_CLRTOEOL)
term_clrtoeol(root_window); term_clrtoeol(root_window);
term_addstr(root_window, str); next_xpos += term_addstr(root_window, str);
next_xpos += strlen(str); /* FIXME utf8 or big5 */
return; return;
} }

View File

@ -1126,6 +1126,8 @@ void gui_readline_init(void)
key_bind("key", NULL, "meta2-5F", "cend", (SIGNAL_FUNC) key_combo); key_bind("key", NULL, "meta2-5F", "cend", (SIGNAL_FUNC) key_combo);
key_bind("key", NULL, "meta2-1;5F", "cend", (SIGNAL_FUNC) key_combo); key_bind("key", NULL, "meta2-1;5F", "cend", (SIGNAL_FUNC) key_combo);
key_bind("key", NULL, "meta-O-M", "return", (SIGNAL_FUNC) key_combo);
key_bind("paste_start", "Bracketed paste start", "meta2-200~", "paste_start", (SIGNAL_FUNC) key_paste_start); key_bind("paste_start", "Bracketed paste start", "meta2-200~", "paste_start", (SIGNAL_FUNC) key_paste_start);
/* cursor movement */ /* cursor movement */

View File

@ -522,15 +522,36 @@ void term_add_unichar(TERM_WINDOW *window, unichar chr)
} }
} }
void term_addstr(TERM_WINDOW *window, const char *str) int term_addstr(TERM_WINDOW *window, const char *str)
{ {
int len; int len, raw_len;
unichar tmp;
const char *ptr;
if (vcmove) term_move_real(); if (vcmove) term_move_real();
len = strlen(str); /* FIXME utf8 or big5 */
len = 0;
raw_len = strlen(str);
/* The string length depends on the terminal encoding */
ptr = str;
if (term_type == TERM_TYPE_UTF8) {
while (*ptr != '\0') {
tmp = g_utf8_get_char(ptr);
len += unichar_isprint(tmp) ? mk_wcwidth(tmp) : 1;
ptr = g_utf8_next_char(ptr);
}
} else
len = raw_len;
term_printed_text(len); term_printed_text(len);
fwrite(str, 1, len, window->term->out); /* Use strlen() here since we need the number of raw bytes */
fwrite(str, 1, raw_len, window->term->out);
return len;
} }
void term_clrtoeol(TERM_WINDOW *window) void term_clrtoeol(TERM_WINDOW *window)

View File

@ -83,7 +83,7 @@ void term_set_color(TERM_WINDOW *window, int col);
void term_move(TERM_WINDOW *window, int x, int y); void term_move(TERM_WINDOW *window, int x, int y);
void term_addch(TERM_WINDOW *window, char chr); void term_addch(TERM_WINDOW *window, char chr);
void term_add_unichar(TERM_WINDOW *window, unichar chr); void term_add_unichar(TERM_WINDOW *window, unichar chr);
void term_addstr(TERM_WINDOW *window, const char *str); int term_addstr(TERM_WINDOW *window, const char *str);
void term_clrtoeol(TERM_WINDOW *window); void term_clrtoeol(TERM_WINDOW *window);
void term_move_cursor(int x, int y); void term_move_cursor(int x, int y);

View File

@ -35,10 +35,13 @@ void ircnet_create(IRC_CHATNET_REC *rec)
static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node) static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
{ {
char *value;
if (!IS_IRC_CHATNET(rec)) if (!IS_IRC_CHATNET(rec))
return; return;
rec->usermode = g_strdup(config_node_get_str(node, "usermode", NULL)); value = config_node_get_str(node, "usermode", NULL);
rec->usermode = (value != NULL && *value != '\0') ? g_strdup(value) : NULL;
rec->max_cmds_at_once = config_node_get_int(node, "cmdmax", 0); rec->max_cmds_at_once = config_node_get_int(node, "cmdmax", 0);
rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0); rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0);

View File

@ -27,6 +27,10 @@
#include "irc-channels.h" #include "irc-channels.h"
#include "nicklist.h" #include "nicklist.h"
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
#endif
static char *last_join; static char *last_join;
/* last person to join a channel you are on */ /* last person to join a channel you are on */
@ -56,7 +60,7 @@ static char *expando_userhost(SERVER_REC *server, void *item, int *free_ret)
{ {
IRC_SERVER_REC *ircserver; IRC_SERVER_REC *ircserver;
const char *username; const char *username;
char hostname[HOST_NAME_MAX]; char hostname[HOST_NAME_MAX + 1];
ircserver = IRC_SERVER(server); ircserver = IRC_SERVER(server);
@ -80,7 +84,7 @@ static char *expando_userhost(SERVER_REC *server, void *item, int *free_ret)
static char *expando_hostname(SERVER_REC *server, void *item, int *free_ret) static char *expando_hostname(SERVER_REC *server, void *item, int *free_ret)
{ {
IRC_SERVER_REC *ircserver; IRC_SERVER_REC *ircserver;
char hostname[HOST_NAME_MAX]; char hostname[HOST_NAME_MAX + 1];
char **list; char **list;
char *hostname_split; char *hostname_split;

View File

@ -48,6 +48,9 @@ static void sig_server_connect_copy(SERVER_CONNECT_REC **dest,
rec->max_whois = src->max_whois; rec->max_whois = src->max_whois;
rec->usermode = g_strdup(src->usermode); rec->usermode = g_strdup(src->usermode);
rec->alternate_nick = g_strdup(src->alternate_nick); rec->alternate_nick = g_strdup(src->alternate_nick);
rec->sasl_mechanism = src->sasl_mechanism;
rec->sasl_username = src->sasl_username;
rec->sasl_password = src->sasl_password;
*dest = (SERVER_CONNECT_REC *) rec; *dest = (SERVER_CONNECT_REC *) rec;
} }

View File

@ -48,12 +48,18 @@ static void sig_server_setup_fill_reconn(IRC_SERVER_CONNECT_REC *conn,
static void sig_server_setup_fill_connect(IRC_SERVER_CONNECT_REC *conn) static void sig_server_setup_fill_connect(IRC_SERVER_CONNECT_REC *conn)
{ {
const char *value;
if (!IS_IRC_SERVER_CONNECT(conn)) if (!IS_IRC_SERVER_CONNECT(conn))
return; return;
conn->alternate_nick = *settings_get_str("alternate_nick") != '\0' ? value = settings_get_str("alternate_nick");
g_strdup(settings_get_str("alternate_nick")) : NULL; conn->alternate_nick = (value != NULL && *value != '\0') ?
conn->usermode = g_strdup(settings_get_str("usermode")); g_strdup(value) : NULL;
value = settings_get_str("usermode");
conn->usermode = (value != NULL && *value != '\0') ?
g_strdup(value) : NULL;
} }
static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn, static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,

View File

@ -28,6 +28,8 @@
#include "irc-channels.h" #include "irc-channels.h"
#include "irc-nicklist.h" #include "irc-nicklist.h"
#include "sasl.h"
struct _isupport_data { CONFIG_REC *config; CONFIG_NODE *node; }; struct _isupport_data { CONFIG_REC *config; CONFIG_NODE *node; };
static void session_isupport_foreach(char *key, char *value, struct _isupport_data *data) static void session_isupport_foreach(char *key, char *value, struct _isupport_data *data)
@ -65,6 +67,10 @@ static void sig_session_save_server(IRC_SERVER_REC *server, CONFIG_REC *config,
config_node_set_str(config, node, "away_reason", server->away_reason); config_node_set_str(config, node, "away_reason", server->away_reason);
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_int(config, node, "sasl_mechanism", server->connrec->sasl_mechanism);
config_node_set_str(config, node, "sasl_username", server->connrec->sasl_username);
config_node_set_str(config, node, "sasl_password", server->connrec->sasl_password);
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(config, node, "isupport", NODE_TYPE_BLOCK); isupport = config_node_section(config, node, "isupport", NODE_TYPE_BLOCK);
isupport_data.config = config; isupport_data.config = config;
@ -90,6 +96,15 @@ static void sig_session_restore_server(IRC_SERVER_REC *server,
server->emode_known = config_node_get_bool(node, "emode_known", FALSE); server->emode_known = config_node_get_bool(node, "emode_known", FALSE);
server->isupport_sent = config_node_get_bool(node, "isupport_sent", FALSE); server->isupport_sent = config_node_get_bool(node, "isupport_sent", FALSE);
server->connrec->sasl_mechanism = config_node_get_int(node, "sasl_mechanism", SASL_MECHANISM_NONE);
/* The fields below might have been filled when loading the chatnet
* description from the config and we favor the content that's been saved
* in the session file over that. */
g_free(server->connrec->sasl_username);
server->connrec->sasl_username = g_strdup(config_node_get_str(node, "sasl_username", NULL));
g_free(server->connrec->sasl_password);
server->connrec->sasl_password = g_strdup(config_node_get_str(node, "sasl_password", NULL));
if (server->isupport == NULL) { if (server->isupport == NULL) {
server->isupport = g_hash_table_new((GHashFunc) g_istr_hash, server->isupport = g_hash_table_new((GHashFunc) g_istr_hash,
(GCompareFunc) g_istr_equal); (GCompareFunc) g_istr_equal);