From 6aafc8e51d17f0bd92f1ec46567a5b1597e7e799 Mon Sep 17 00:00:00 2001 From: leeter Date: Wed, 10 Dec 2014 14:40:42 -0500 Subject: Fix chanopts not saving if /quit before exit This is the C fix, unfortunately a proper fix, e.g. removing the dependency on session_name all together is a much vaster refactor outside the scope of this bugfix. Closes #1111 --- src/common/chanopt.c | 10 +++++----- src/common/hexchat.c | 5 ++++- src/common/hexchat.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/common') diff --git a/src/common/chanopt.c b/src/common/chanopt.c index 820a31fb..92466ce9 100644 --- a/src/common/chanopt.c +++ b/src/common/chanopt.c @@ -119,7 +119,7 @@ chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[]) if (!quiet) PrintTextf (sess, "\002Network\002: %s \002Channel\002: %s\n", sess->server->network ? server_get_network (sess->server, TRUE) : _(""), - sess->channel[0] ? sess->channel : _("")); + sess->session_name[0] ? sess->session_name : _("")); while (i < sizeof (chanopt) / sizeof (channel_options)) { @@ -298,7 +298,7 @@ chanopt_load (session *sess) chanopt_in_memory *co; char *network; - if (sess->channel[0] == 0) + if (sess->session_name[0] == 0) return; network = server_get_network (sess->server, FALSE); @@ -311,7 +311,7 @@ chanopt_load (session *sess) chanopt_load_all (); } - co = chanopt_find (network, sess->channel, FALSE); + co = chanopt_find (network, sess->session_name, FALSE); if (!co) return; @@ -334,7 +334,7 @@ chanopt_save (session *sess) chanopt_in_memory *co; char *network; - if (sess->channel[0] == 0) + if (sess->session_name[0] == 0) return; network = server_get_network (sess->server, FALSE); @@ -343,7 +343,7 @@ chanopt_save (session *sess) /* 2. reconcile sess with what we loaded from disk */ - co = chanopt_find (network, sess->channel, TRUE); + co = chanopt_find (network, sess->session_name, TRUE); i = 0; while (i < sizeof (chanopt) / sizeof (channel_options)) diff --git a/src/common/hexchat.c b/src/common/hexchat.c index 30e95ca9..274773e7 100644 --- a/src/common/hexchat.c +++ b/src/common/hexchat.c @@ -480,7 +480,10 @@ session_new (server *serv, char *from, int type, int focus) sess->lastact_idx = LACT_NONE; if (from != NULL) - safe_strcpy (sess->channel, from, CHANLEN); + { + safe_strcpy(sess->channel, from, CHANLEN); + safe_strcpy(sess->session_name, from, CHANLEN); + } sess_list = g_slist_prepend (sess_list, sess); diff --git a/src/common/hexchat.h b/src/common/hexchat.h index 8dc106e9..c9c281cc 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -388,6 +388,7 @@ typedef struct session char channel[CHANLEN]; char waitchannel[CHANLEN]; /* waiting to join channel (/join sent) */ char willjoinchannel[CHANLEN]; /* will issue /join for this channel */ + char session_name[CHANLEN]; /* the name of the session, should not modified */ char channelkey[64]; /* XXX correct max length? */ int limit; /* channel user limit */ int logfd; -- cgit 1.4.1