More fixes for tab color handling with plugins
Part 2 of 03767ee0f9
So how the colors work should be pretty straight forward:
- A message comes in and is handled, this sets the state flags:
nick_said, msg_said, new_data. These map to tab colors.
- This state is reset under one of these conditions:
- It is commited to the UI when actually printed on unfocused tab
- Event is interupted by a plugin hook
- The tab focus is changed
This commit is contained in:
parent
e7c88e0f83
commit
539949973c
|
@ -2027,7 +2027,13 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
|
||||||
word[i] = "\000";
|
word[i] = "\000";
|
||||||
|
|
||||||
if (plugin_emit_print (sess, word, timestamp))
|
if (plugin_emit_print (sess, word, timestamp))
|
||||||
|
{
|
||||||
|
/* Reset the state that never printed */
|
||||||
|
sess->nick_said = FALSE;
|
||||||
|
sess->msg_said = FALSE;
|
||||||
|
sess->new_data = FALSE;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* If a plugin's callback executes "/close", 'sess' may be invalid */
|
/* If a plugin's callback executes "/close", 'sess' may be invalid */
|
||||||
if (!is_session (sess))
|
if (!is_session (sess))
|
||||||
|
@ -2061,7 +2067,6 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
|
||||||
/* ===Highlighted message=== */
|
/* ===Highlighted message=== */
|
||||||
case XP_TE_HCHANACTION:
|
case XP_TE_HCHANACTION:
|
||||||
case XP_TE_HCHANMSG:
|
case XP_TE_HCHANMSG:
|
||||||
fe_set_tab_color (sess, 3);
|
|
||||||
if (chanopt_is_set (prefs.hex_input_beep_hilight, sess->alert_beep) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
|
if (chanopt_is_set (prefs.hex_input_beep_hilight, sess->alert_beep) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
|
||||||
sound_beep (sess);
|
sound_beep (sess);
|
||||||
if (chanopt_is_set (prefs.hex_input_flash_hilight, sess->alert_taskbar) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
|
if (chanopt_is_set (prefs.hex_input_flash_hilight, sess->alert_taskbar) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
|
||||||
|
|
|
@ -660,21 +660,21 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
|
||||||
{
|
{
|
||||||
PrintTextRaw (sess->res->buffer, (unsigned char *)text, prefs.hex_text_indent, stamp);
|
PrintTextRaw (sess->res->buffer, (unsigned char *)text, prefs.hex_text_indent, stamp);
|
||||||
|
|
||||||
if (no_activity || sess == current_tab || !sess->gui->is_tab)
|
if (no_activity || !sess->gui->is_tab)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sess->nick_said)
|
if (sess == current_tab)
|
||||||
|
{
|
||||||
|
sess->nick_said = FALSE;
|
||||||
|
sess->msg_said = FALSE;
|
||||||
|
sess->new_data = FALSE;
|
||||||
|
}
|
||||||
|
else if (sess->nick_said)
|
||||||
fe_set_tab_color (sess, 3);
|
fe_set_tab_color (sess, 3);
|
||||||
else if (sess->msg_said)
|
else if (sess->msg_said)
|
||||||
fe_set_tab_color (sess, 2);
|
fe_set_tab_color (sess, 2);
|
||||||
else
|
else
|
||||||
fe_set_tab_color (sess, 1);
|
fe_set_tab_color (sess, 1);
|
||||||
|
|
||||||
if (!sess->new_data && !sess->nick_said)
|
|
||||||
{
|
|
||||||
sess->new_data = TRUE;
|
|
||||||
lastact_update (sess);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -540,17 +540,10 @@ mg_focus (session *sess)
|
||||||
sess->server->server_session = sess;
|
sess->server->server_session = sess;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sess->new_data || sess->nick_said || sess->msg_said)
|
/* when called via mg_changui_new, is_tab might be true, but
|
||||||
{
|
sess->res->tab is still NULL. */
|
||||||
sess->nick_said = FALSE;
|
if (sess->res->tab)
|
||||||
sess->msg_said = FALSE;
|
fe_set_tab_color (sess, 0);
|
||||||
sess->new_data = FALSE;
|
|
||||||
lastact_update (sess);
|
|
||||||
/* when called via mg_changui_new, is_tab might be true, but
|
|
||||||
sess->res->tab is still NULL. */
|
|
||||||
if (sess->res->tab)
|
|
||||||
fe_set_tab_color (sess, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue