mirror of
https://github.com/profanity-im/profanity.git
synced 2025-05-18 13:58:57 -04:00
Implemented /console private setting
This commit is contained in:
parent
19a3066e28
commit
bab75cae15
@ -1047,10 +1047,12 @@ static struct cmd_t command_defs[] =
|
|||||||
cmd_console, parse_args, 2, 2, &cons_console_setting,
|
cmd_console, parse_args, 2, 2, &cons_console_setting,
|
||||||
CMD_TAGS(
|
CMD_TAGS(
|
||||||
CMD_TAG_UI,
|
CMD_TAG_UI,
|
||||||
|
CMD_TAG_CHAT,
|
||||||
CMD_TAG_GROUPCHAT)
|
CMD_TAG_GROUPCHAT)
|
||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/console chat all|first|none",
|
"/console chat all|first|none",
|
||||||
"/console muc all|first|none")
|
"/console muc all|first|none",
|
||||||
|
"/console private all|first|none")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Configure what is displayed in the console window when messages are received. "
|
"Configure what is displayed in the console window when messages are received. "
|
||||||
"The default is set to 'all' for all types of messages.")
|
"The default is set to 'all' for all types of messages.")
|
||||||
@ -1060,7 +1062,10 @@ static struct cmd_t command_defs[] =
|
|||||||
{ "chat none", "Do not show any new chat messages in the console window." },
|
{ "chat none", "Do not show any new chat messages in the console window." },
|
||||||
{ "muc all", "Indicate all new chat room messages in the console." },
|
{ "muc all", "Indicate all new chat room messages in the console." },
|
||||||
{ "muc first", "Indicate only the first new message in each room in the console." },
|
{ "muc first", "Indicate only the first new message in each room in the console." },
|
||||||
{ "muc none", "Do not show any new chat room messages in the console window." })
|
{ "muc none", "Do not show any new chat room messages in the console window." },
|
||||||
|
{ "private all", "Indicate all new private room messages in the console." },
|
||||||
|
{ "private first", "Indicate only the first private room message in the console." },
|
||||||
|
{ "private none", "Do not show any new private room messages in the console window." })
|
||||||
CMD_NOEXAMPLES
|
CMD_NOEXAMPLES
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2526,6 +2531,7 @@ cmd_init(void)
|
|||||||
console_ac = autocomplete_new();
|
console_ac = autocomplete_new();
|
||||||
autocomplete_add(console_ac, "chat");
|
autocomplete_add(console_ac, "chat");
|
||||||
autocomplete_add(console_ac, "muc");
|
autocomplete_add(console_ac, "muc");
|
||||||
|
autocomplete_add(console_ac, "private");
|
||||||
|
|
||||||
console_msg_ac = autocomplete_new();
|
console_msg_ac = autocomplete_new();
|
||||||
autocomplete_add(console_msg_ac, "all");
|
autocomplete_add(console_msg_ac, "all");
|
||||||
@ -4418,6 +4424,10 @@ _console_autocomplete(ProfWin *window, const char *const input)
|
|||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
result = autocomplete_param_with_ac(input, "/console private", console_msg_ac, TRUE);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
result = autocomplete_param_with_ac(input, "/console", console_ac, TRUE);
|
result = autocomplete_param_with_ac(input, "/console", console_ac, TRUE);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -4409,7 +4409,7 @@ cmd_beep(ProfWin *window, const char *const command, gchar **args)
|
|||||||
gboolean
|
gboolean
|
||||||
cmd_console(ProfWin *window, const char *const command, gchar **args)
|
cmd_console(ProfWin *window, const char *const command, gchar **args)
|
||||||
{
|
{
|
||||||
if ((g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "muc") != 0)) {
|
if ((g_strcmp0(args[0], "chat") != 0) && (g_strcmp0(args[0], "muc") != 0) && (g_strcmp0(args[0], "private") != 0)) {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -4432,6 +4432,12 @@ cmd_console(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(args[0], "private") == 0) {
|
||||||
|
prefs_set_string(PREF_CONSOLE_PRIVATE, setting);
|
||||||
|
cons_show("Console private room messages set: %s", setting);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1157,6 +1157,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_INPBLOCK_DYNAMIC:
|
case PREF_INPBLOCK_DYNAMIC:
|
||||||
case PREF_TLS_SHOW:
|
case PREF_TLS_SHOW:
|
||||||
case PREF_CONSOLE_MUC:
|
case PREF_CONSOLE_MUC:
|
||||||
|
case PREF_CONSOLE_PRIVATE:
|
||||||
case PREF_CONSOLE_CHAT:
|
case PREF_CONSOLE_CHAT:
|
||||||
return PREF_GROUP_UI;
|
return PREF_GROUP_UI;
|
||||||
case PREF_STATES:
|
case PREF_STATES:
|
||||||
@ -1382,6 +1383,8 @@ _get_key(preference_t pref)
|
|||||||
return "lastactivity";
|
return "lastactivity";
|
||||||
case PREF_CONSOLE_MUC:
|
case PREF_CONSOLE_MUC:
|
||||||
return "console.muc";
|
return "console.muc";
|
||||||
|
case PREF_CONSOLE_PRIVATE:
|
||||||
|
return "console.private";
|
||||||
case PREF_CONSOLE_CHAT:
|
case PREF_CONSOLE_CHAT:
|
||||||
return "console.chat";
|
return "console.chat";
|
||||||
default:
|
default:
|
||||||
@ -1487,7 +1490,7 @@ _get_default_string(preference_t pref)
|
|||||||
case PREF_PGP_LOG:
|
case PREF_PGP_LOG:
|
||||||
return "redact";
|
return "redact";
|
||||||
case PREF_CONSOLE_MUC:
|
case PREF_CONSOLE_MUC:
|
||||||
return "all";
|
case PREF_CONSOLE_PRIVATE:
|
||||||
case PREF_CONSOLE_CHAT:
|
case PREF_CONSOLE_CHAT:
|
||||||
return "all";
|
return "all";
|
||||||
default:
|
default:
|
||||||
|
@ -133,6 +133,7 @@ typedef enum {
|
|||||||
PREF_TLS_SHOW,
|
PREF_TLS_SHOW,
|
||||||
PREF_LASTACTIVITY,
|
PREF_LASTACTIVITY,
|
||||||
PREF_CONSOLE_MUC,
|
PREF_CONSOLE_MUC,
|
||||||
|
PREF_CONSOLE_PRIVATE,
|
||||||
PREF_CONSOLE_CHAT,
|
PREF_CONSOLE_CHAT,
|
||||||
} preference_t;
|
} preference_t;
|
||||||
|
|
||||||
|
@ -410,6 +410,7 @@ _load_preferences(void)
|
|||||||
_set_string_preference("statuses.chat", PREF_STATUSES_CHAT);
|
_set_string_preference("statuses.chat", PREF_STATUSES_CHAT);
|
||||||
_set_string_preference("statuses.muc", PREF_STATUSES_MUC);
|
_set_string_preference("statuses.muc", PREF_STATUSES_MUC);
|
||||||
_set_string_preference("console.muc", PREF_CONSOLE_MUC);
|
_set_string_preference("console.muc", PREF_CONSOLE_MUC);
|
||||||
|
_set_string_preference("console.private", PREF_CONSOLE_PRIVATE);
|
||||||
_set_string_preference("console.chat", PREF_CONSOLE_CHAT);
|
_set_string_preference("console.chat", PREF_CONSOLE_CHAT);
|
||||||
_set_string_preference("roster.by", PREF_ROSTER_BY);
|
_set_string_preference("roster.by", PREF_ROSTER_BY);
|
||||||
_set_string_preference("roster.order", PREF_ROSTER_ORDER);
|
_set_string_preference("roster.order", PREF_ROSTER_ORDER);
|
||||||
|
@ -384,7 +384,7 @@ cons_show_incoming_message(const char *const short_from, const int win_index, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_show_incoming_private_message(const char *const nick, const char *const room, const int win_index)
|
cons_show_incoming_private_message(const char *const nick, const char *const room, const int win_index, int unread)
|
||||||
{
|
{
|
||||||
ProfWin *console = wins_get_console();
|
ProfWin *console = wins_get_console();
|
||||||
|
|
||||||
@ -392,9 +392,17 @@ cons_show_incoming_private_message(const char *const nick, const char *const roo
|
|||||||
if (ui_index == 10) {
|
if (ui_index == 10) {
|
||||||
ui_index = 0;
|
ui_index = 0;
|
||||||
}
|
}
|
||||||
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< private message: %s in %s (win %d)", nick, room, ui_index);
|
|
||||||
|
|
||||||
|
char *priv_show = prefs_get_string(PREF_CONSOLE_PRIVATE);
|
||||||
|
if (g_strcmp0(priv_show, "all") == 0) {
|
||||||
|
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< private message: %s in %s (win %d)", nick, room, ui_index);
|
||||||
cons_alert();
|
cons_alert();
|
||||||
|
} else if ((g_strcmp0(priv_show, "first") == 0) && unread == 0) {
|
||||||
|
win_vprint(console, '-', 0, NULL, 0, THEME_INCOMING, "", "<< private message: %s in %s (win %d)", nick, room, ui_index);
|
||||||
|
cons_alert();
|
||||||
|
}
|
||||||
|
|
||||||
|
prefs_free_string(priv_show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1140,6 +1148,10 @@ cons_console_setting(void)
|
|||||||
char *mucsetting = prefs_get_string(PREF_CONSOLE_MUC);
|
char *mucsetting = prefs_get_string(PREF_CONSOLE_MUC);
|
||||||
cons_show("Console MUC messages (/console) : %s", mucsetting);
|
cons_show("Console MUC messages (/console) : %s", mucsetting);
|
||||||
prefs_free_string(mucsetting);
|
prefs_free_string(mucsetting);
|
||||||
|
|
||||||
|
char *privsetting = prefs_get_string(PREF_CONSOLE_PRIVATE);
|
||||||
|
cons_show("Console private messages (/console) : %s", privsetting);
|
||||||
|
prefs_free_string(privsetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -67,13 +67,14 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, const char *const message, GDat
|
|||||||
|
|
||||||
// not currently viewing chat window with sender
|
// not currently viewing chat window with sender
|
||||||
} else {
|
} else {
|
||||||
|
status_bar_new(num);
|
||||||
|
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num, privatewin->unread);
|
||||||
|
win_print_incoming_message(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
|
||||||
|
|
||||||
privatewin->unread++;
|
privatewin->unread++;
|
||||||
if (notify) {
|
if (notify) {
|
||||||
privatewin->notify = TRUE;
|
privatewin->notify = TRUE;
|
||||||
}
|
}
|
||||||
status_bar_new(num);
|
|
||||||
cons_show_incoming_private_message(jidp->resourcepart, jidp->barejid, num);
|
|
||||||
win_print_incoming_message(window, timestamp, jidp->resourcepart, message, PROF_MSG_PLAIN);
|
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_FLASH)) {
|
if (prefs_get_boolean(PREF_FLASH)) {
|
||||||
flash();
|
flash();
|
||||||
|
@ -274,7 +274,7 @@ 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,
|
void cons_show_incoming_room_message(const char *const nick, const char *const room, const int win_index,
|
||||||
gboolean mention, GList *triggers, int unread);
|
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_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_incoming_private_message(const char *const nick, const char *const room, const int win_index, int unread);
|
||||||
void cons_show_room_invites(GSList *invites);
|
void cons_show_room_invites(GSList *invites);
|
||||||
void cons_show_received_subs(void);
|
void cons_show_received_subs(void);
|
||||||
void cons_show_sent_subs(void);
|
void cons_show_sent_subs(void);
|
||||||
|
@ -132,3 +132,4 @@ otr.char=
|
|||||||
pgp.char=
|
pgp.char=
|
||||||
console.muc=
|
console.muc=
|
||||||
console.chat=
|
console.chat=
|
||||||
|
console.private=
|
||||||
|
@ -131,3 +131,4 @@ pgp.char=%
|
|||||||
tls.show=true
|
tls.show=true
|
||||||
console.muc=first
|
console.muc=first
|
||||||
console.chat=all
|
console.chat=all
|
||||||
|
console.private=all
|
||||||
|
@ -127,3 +127,4 @@ pgp.char=%
|
|||||||
tls.show=true
|
tls.show=true
|
||||||
console.muc=first
|
console.muc=first
|
||||||
console.chat=all
|
console.chat=all
|
||||||
|
console.private=all
|
||||||
|
@ -56,3 +56,4 @@ enc.warn=true
|
|||||||
tls.show=true
|
tls.show=true
|
||||||
console.muc=all
|
console.muc=all
|
||||||
console.chat=all
|
console.chat=all
|
||||||
|
console.private=all
|
||||||
|
@ -43,3 +43,4 @@ wins.autotidy=false
|
|||||||
tls.show=false
|
tls.show=false
|
||||||
console.muc=first
|
console.muc=first
|
||||||
console.chat=first
|
console.chat=first
|
||||||
|
console.private=first
|
||||||
|
Loading…
x
Reference in New Issue
Block a user