summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-11-11 20:02:24 -0500
committerPatrick Griffis <tingping@tingping.se>2016-11-11 20:02:24 -0500
commit13f6d9265a92fe2f1f6baf9d44e58302a55d4baf (patch)
treedecce0f964b78cbac5891c37ac23902b4f7eb6ac /src
parent241dd69b081779a77718763561a779cdffcaf11f (diff)
Respect plugin hook changing tab color
Fixup to 241dd69b081
Diffstat (limited to 'src')
-rw-r--r--src/common/text.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/common/text.c b/src/common/text.c
index 9d7935f2..48b81ea5 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -2009,6 +2009,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
 	char *word[PDIWORDS];
 	int i;
 	tab_state_flags current_state = sess->tab_state;
+	tab_state_flags plugin_state = sess->last_tab_state;
 	unsigned int stripcolor_args = (chanopt_is_set (prefs.hex_text_stripcolor_msg, sess->text_strip) ? 0xFFFFFFFF : 0);
 	char tbuf[NICKLEN + 4];
 
@@ -2029,10 +2030,15 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
 
 	/* We want to ignore the tab state if the plugin emits new events
 	 * and restore it if it doesn't eat the current one */
-	sess->tab_state = sess->last_tab_state;
+	sess->tab_state = plugin_state;
 	if (plugin_emit_print (sess, word, timestamp))
 		return;
-	sess->tab_state = current_state;
+
+	/* The plugin may have changed the state which we should respect.
+	 * If the state is NEW_DATA we don't actually know if that was on
+	 * purpose though as print() sets it, so for now we ignore that. FIXME */
+	if (sess->tab_state == plugin_state || sess->tab_state == TAB_STATE_NEW_DATA)
+		sess->tab_state = current_state;
 
 	/* If a plugin's callback executes "/close", 'sess' may be invalid */
 	if (!is_session (sess))