mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Pass window to functions so we dont have to call twice
This commit is contained in:
parent
11d849aa7f
commit
7b49fbdf45
@ -357,7 +357,7 @@ sv_ev_room_message(ProfMessage* message)
|
||||
flash();
|
||||
}
|
||||
|
||||
cons_show_incoming_room_message(message->from_jid->resourcepart, mucwin->roomjid, num, mention, triggers, mucwin->unread);
|
||||
cons_show_incoming_room_message(message->from_jid->resourcepart, mucwin->roomjid, num, mention, triggers, mucwin->unread, window);
|
||||
|
||||
mucwin->unread++;
|
||||
|
||||
|
@ -282,7 +282,7 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
|
||||
// not currently viewing chat window with sender
|
||||
} else {
|
||||
status_bar_new(num, WIN_CHAT, chatwin->barejid);
|
||||
cons_show_incoming_message(display_name, num, chatwin->unread);
|
||||
cons_show_incoming_message(display_name, num, chatwin->unread, window);
|
||||
|
||||
if (prefs_get_boolean(PREF_FLASH)) {
|
||||
flash();
|
||||
|
@ -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);
|
||||
|
@ -68,7 +68,7 @@ privwin_incoming_msg(ProfPrivateWin* privatewin, ProfMessage* message)
|
||||
// not currently viewing chat window with sender
|
||||
} else {
|
||||
status_bar_new(num, WIN_PRIVATE, privatewin->fulljid);
|
||||
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread);
|
||||
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread, window);
|
||||
win_insert_last_read_position_marker((ProfWin*)privatewin, privatewin->fulljid);
|
||||
win_print_incoming(window, jidp->resourcepart, message);
|
||||
|
||||
|
@ -275,9 +275,9 @@ void cons_show_room_invite(const char* const invitor, const char* const room, co
|
||||
void cons_check_version(gboolean not_available_msg);
|
||||
void cons_show_typing(const char* const barejid);
|
||||
void cons_show_incoming_room_message(const char* const nick, const char* const room, const int win_index,
|
||||
gboolean mention, GList* triggers, int unread);
|
||||
void cons_show_incoming_message(const char* const short_from, const int win_index, int unread);
|
||||
void cons_show_incoming_private_message(const char* const nick, const char* const room, const int win_index, int unread);
|
||||
gboolean mention, GList* triggers, int unread, ProfWin* const window);
|
||||
void cons_show_incoming_message(const char* const short_from, const int win_index, int unread, ProfWin* const window);
|
||||
void cons_show_incoming_private_message(const char* const nick, const char* const room, const int win_index, int unread, ProfWin* const window);
|
||||
void cons_show_room_invites(GList* invites);
|
||||
void cons_show_received_subs(void);
|
||||
void cons_show_sent_subs(void);
|
||||
|
Loading…
Reference in New Issue
Block a user