mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 12:16:22 +00:00
Pass window to functions so we dont have to call twice
This commit is contained in:
@@ -308,11 +308,10 @@ _room_triggers_to_string(GList* triggers)
|
||||
|
||||
void
|
||||
cons_show_incoming_room_message(const char* const nick, const char* const room, const int win_index, gboolean mention,
|
||||
GList* triggers, int unread)
|
||||
GList* triggers, int unread, ProfWin* const window)
|
||||
{
|
||||
ProfWin* const console = wins_get_console();
|
||||
|
||||
// TODO: pass window and get ui index inside so tha cons_alert() can use window
|
||||
int ui_index = win_index;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
@@ -330,27 +329,27 @@ cons_show_incoming_room_message(const char* const nick, const char* const room,
|
||||
} else {
|
||||
win_println(console, THEME_INCOMING, "-", "<< room message: %s in %s (win %d)", nick, room, ui_index);
|
||||
}
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
|
||||
} else if (g_strcmp0(muc_show, "first") == 0) {
|
||||
if (mention) {
|
||||
win_println(console, THEME_MENTION, "-", "<< room mention: %s in %s (win %d)", nick, room, ui_index);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
} else if (triggers) {
|
||||
char* triggers_str = _room_triggers_to_string(triggers);
|
||||
win_println(console, THEME_TRIGGER, "-", "<< room trigger %s: %s in %s (win %d)", triggers_str, nick, room, ui_index);
|
||||
free(triggers_str);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
} else if (unread == 0) {
|
||||
win_println(console, THEME_INCOMING, "-", "<< room message: %s (win %d)", room, ui_index);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
}
|
||||
}
|
||||
g_free(muc_show);
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_incoming_message(const char* const short_from, const int win_index, int unread)
|
||||
cons_show_incoming_message(const char* const short_from, const int win_index, int unread, ProfWin* const window)
|
||||
{
|
||||
ProfWin* console = wins_get_console();
|
||||
|
||||
@@ -362,17 +361,17 @@ cons_show_incoming_message(const char* const short_from, const int win_index, in
|
||||
char* chat_show = prefs_get_string(PREF_CONSOLE_CHAT);
|
||||
if (g_strcmp0(chat_show, "all") == 0) {
|
||||
win_println(console, THEME_INCOMING, "-", "<< chat message: %s (win %d)", short_from, ui_index);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
} else if ((g_strcmp0(chat_show, "first") == 0) && unread == 0) {
|
||||
win_println(console, THEME_INCOMING, "-", "<< chat message: %s (win %d)", short_from, ui_index);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
}
|
||||
|
||||
g_free(chat_show);
|
||||
}
|
||||
|
||||
void
|
||||
cons_show_incoming_private_message(const char* const nick, const char* const room, const int win_index, int unread)
|
||||
cons_show_incoming_private_message(const char* const nick, const char* const room, const int win_index, int unread, ProfWin* const window)
|
||||
{
|
||||
ProfWin* console = wins_get_console();
|
||||
|
||||
@@ -384,10 +383,10 @@ cons_show_incoming_private_message(const char* const nick, const char* const roo
|
||||
char* priv_show = prefs_get_string(PREF_CONSOLE_PRIVATE);
|
||||
if (g_strcmp0(priv_show, "all") == 0) {
|
||||
win_println(console, THEME_INCOMING, "-", "<< private message: %s in %s (win %d)", nick, room, ui_index);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
} else if ((g_strcmp0(priv_show, "first") == 0) && unread == 0) {
|
||||
win_println(console, THEME_INCOMING, "-", "<< private message: %s in %s (win %d)", nick, room, ui_index);
|
||||
cons_alert(wins_get_by_num(ui_index));
|
||||
cons_alert(window);
|
||||
}
|
||||
|
||||
g_free(priv_show);
|
||||
|
||||
Reference in New Issue
Block a user