1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Implemented /console chat setting

This commit is contained in:
James Booth 2016-02-03 23:16:42 +00:00
parent 72c1c49695
commit 19a3066e28
4 changed files with 21 additions and 9 deletions

View File

@ -251,7 +251,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
// not currently viewing chat window with sender
} else {
status_bar_new(num);
cons_show_incoming_message(display_name, num);
cons_show_incoming_message(display_name, num, chatwin->unread);
if (prefs_get_boolean(PREF_FLASH)) {
flash();

View File

@ -362,7 +362,7 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
}
void
cons_show_incoming_message(const char *const short_from, const int win_index)
cons_show_incoming_message(const char *const short_from, const int win_index, int unread)
{
ProfWin *console = wins_get_console();
@ -370,9 +370,17 @@ cons_show_incoming_message(const char *const short_from, const int win_index)
if (ui_index == 10) {
ui_index = 0;
}
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< chat message: %s (win %d)", short_from, ui_index);
char *chat_show = prefs_get_string(PREF_CONSOLE_CHAT);
if (g_strcmp0(chat_show, "all") == 0) {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< chat message: %s (win %d)", short_from, ui_index);
cons_alert();
} else if ((g_strcmp0(chat_show, "first") == 0) && unread == 0) {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< chat message: %s (win %d)", short_from, ui_index);
cons_alert();
}
prefs_free_string(chat_show);
}
void
@ -1125,9 +1133,13 @@ cons_encwarn_setting(void)
void
cons_console_setting(void)
{
char *setting = prefs_get_string(PREF_CONSOLE_MUC);
cons_show("Console MUC messages (/console) : %s", setting);
prefs_free_string(setting);
char *chatsetting = prefs_get_string(PREF_CONSOLE_CHAT);
cons_show("Console chat messages (/console) : %s", chatsetting);
prefs_free_string(chatsetting);
char *mucsetting = prefs_get_string(PREF_CONSOLE_MUC);
cons_show("Console MUC messages (/console) : %s", mucsetting);
prefs_free_string(mucsetting);
}
void

View File

@ -273,7 +273,7 @@ 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);
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);
void cons_show_room_invites(GSList *invites);
void cons_show_received_subs(void);

View File

@ -403,7 +403,7 @@ void cons_show_room_invite(const char * const invitor, const char * const room,
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) {}
void cons_show_incoming_message(const char * const short_from, const int win_index, int unread) {}
void cons_show_room_invites(GSList *invites) {}
void cons_show_received_subs(void) {}
void cons_show_sent_subs(void) {}