Have separate settings for intype

Old: `/intype on|of`
Typing information is printed in console and titlebar.

New: `/intype titlebar|console on|off`
Typing information can be configured in more detail.

Regards https://github.com/profanity-im/profanity/issues/1516
This commit is contained in:
Michael Vetter
2021-05-08 19:33:58 +02:00
parent 1ef700f918
commit 1d8061e89b
7 changed files with 62 additions and 14 deletions

View File

@@ -1716,9 +1716,14 @@ void
cons_intype_setting(void)
{
if (prefs_get_boolean(PREF_INTYPE))
cons_show("Show typing (/intype) : ON");
cons_show("Show typing in titlebar (/intype titlebar) : ON");
else
cons_show("Show typing (/intype) : OFF");
cons_show("Show typing in titlebar (/intype titlebar) : OFF");
if (prefs_get_boolean(PREF_INTYPE_CONSOLE))
cons_show("Show typing in console (/intype console) : ON");
else
cons_show("Show typing in console (/intype console) : OFF");
}
void

View File

@@ -276,17 +276,21 @@ ui_contact_typing(const char* const barejid, const char* const resource)
ProfWin* window = (ProfWin*)chatwin;
ChatSession* session = chat_session_get(barejid);
if (prefs_get_boolean(PREF_INTYPE)) {
// no chat window for user
if (chatwin == NULL) {
// no chat window for user
if (chatwin == NULL) {
if (prefs_get_boolean(PREF_INTYPE_CONSOLE)) {
cons_show_typing(barejid);
}
// have chat window but not currently in it
} else if (!wins_is_current(window)) {
// have chat window but not currently in it
} else if (!wins_is_current(window)) {
if (prefs_get_boolean(PREF_INTYPE_CONSOLE)) {
cons_show_typing(barejid);
}
// in chat window with user, no session or session with resource
} else if (!session || (session && g_strcmp0(session->resource, resource) == 0)) {
// in chat window with user, no session or session with resource
} else if (!session || (session && g_strcmp0(session->resource, resource) == 0)) {
if (prefs_get_boolean(PREF_INTYPE)) {
title_bar_set_typing(TRUE);
int num = wins_get_num(window);