1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added console MUC message preference

This commit is contained in:
James Booth 2015-12-29 23:00:49 +00:00
parent 377a63d038
commit 8ea228480c
4 changed files with 17 additions and 2 deletions

View File

@ -1034,6 +1034,7 @@ _get_group(preference_t pref)
case PREF_ENC_WARN:
case PREF_INPBLOCK_DYNAMIC:
case PREF_TLS_SHOW:
case PREF_CONSOLE_MUC:
return PREF_GROUP_UI;
case PREF_STATES:
case PREF_OUTTYPE:
@ -1238,6 +1239,8 @@ _get_key(preference_t pref)
return "tls.show";
case PREF_LASTACTIVITY:
return "lastactivity";
case PREF_CONSOLE_MUC:
return "console.muc";
default:
return NULL;
}
@ -1324,6 +1327,8 @@ _get_default_string(preference_t pref)
return "%d/%m/%y %H:%M:%S";
case PREF_PGP_LOG:
return "redact";
case PREF_CONSOLE_MUC:
return "all";
default:
return NULL;
}

View File

@ -123,6 +123,7 @@ typedef enum {
PREF_TLS_CERTPATH,
PREF_TLS_SHOW,
PREF_LASTACTIVITY,
PREF_CONSOLE_MUC,
} preference_t;
typedef struct prof_alias_t {

View File

@ -240,7 +240,12 @@ sv_ev_room_message(const char *const room_jid, const char *const nick,
// not currently on groupchat window
} else {
status_bar_new(num);
char *muc_show = prefs_get_string(PREF_CONSOLE_MUC);
if (g_strcmp0(muc_show, "all") == 0) {
cons_show_incoming_room_message(nick, mucwin->roomjid, num);
} else if (g_strcmp0(muc_show, "first") == 0 && mucwin->unread == 0) {
cons_show_incoming_room_message(NULL, mucwin->roomjid, num);
}
if (prefs_get_boolean(PREF_FLASH) && (strcmp(nick, my_nick) != 0)) {
flash();

View File

@ -311,7 +311,11 @@ cons_show_incoming_room_message(const char *const nick, const char *const room,
ui_index = 0;
}
if (nick) {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s in %s (win %d)", nick, room, ui_index);
} else {
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< room message: %s (win %d)", room, ui_index);
}
cons_alert();
}