summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorRichardHitt <rbh00@netcom.com>2014-03-24 12:46:02 -0700
committerTingPing <tingping@tingping.se>2014-03-24 21:22:04 -0400
commit1a3bfdce75822a2c3cdf2ee23a266eb0ffbe4775 (patch)
treea4a9821e59500e3670fef01399fb0c9b2f76deab /src/common
parent46e449f1107591720bec206d8df6a55c615f2660 (diff)
Improve handling scrollback when gui_tab_server==FALSE
Fixes #925.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/inbound.c8
-rw-r--r--src/common/text.c7
2 files changed, 13 insertions, 2 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 47fe2e00..ea7c3c9b 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -48,6 +48,7 @@
 #include "text.h"
 #include "ctcp.h"
 #include "hexchatc.h"
+#include "chanopt.h"
 
 
 void
@@ -583,6 +584,7 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip,
 					const message_tags_data *tags_data)
 {
 	session *sess;
+	int found_unused = FALSE;
 
 	/* already joined? probably a bnc */
 	sess = find_channel (serv, chan);
@@ -594,6 +596,7 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip,
 		{
 			/* find a "<none>" tab and use that */
 			sess = find_unused_session (serv);
+			found_unused = sess != NULL;
 			if (!sess)
 				/* last resort, open a new tab/window */
 				sess = new_ircwindow (serv, chan, SESS_CHANNEL, 1);
@@ -601,6 +604,11 @@ inbound_ujoin (server *serv, char *chan, char *nick, char *ip,
 	}
 
 	safe_strcpy (sess->channel, chan, CHANLEN);
+	if (found_unused)
+	{
+		chanopt_load (sess);
+		scrollback_load (sess);
+	}
 
 	fe_set_channel (sess);
 	fe_set_title (sess);
diff --git a/src/common/text.c b/src/common/text.c
index a01fc2c8..96442e6e 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -79,7 +79,10 @@ scrollback_get_filename (session *sess)
 	g_free (buf);
 
 	chan = log_create_filename (sess->channel);
-	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, chan);
+	if (chan[0])
+		buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "scrollback" G_DIR_SEPARATOR_S "%s" G_DIR_SEPARATOR_S "%s.txt", get_xdir (), net, chan);
+	else
+		buf = NULL;
 	free (chan);
 
 	return buf;
@@ -207,7 +210,7 @@ scrollback_save (session *sess, char *text)
 	time_t stamp;
 	int len;
 
-	if (sess->type == SESS_SERVER)
+	if (sess->type == SESS_SERVER && prefs.hex_gui_tab_server == 1)
 		return;
 
 	if (sess->text_scrollback == SET_DEFAULT)