mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Add /presence titlebar subcommand
This commit is contained in:
parent
94212cd01c
commit
52c01a8ee8
@ -97,7 +97,8 @@ static char* _close_autocomplete(ProfWin *window, const char *const input);
|
|||||||
static char* _plugins_autocomplete(ProfWin *window, const char *const input);
|
static char* _plugins_autocomplete(ProfWin *window, const char *const input);
|
||||||
static char* _sendfile_autocomplete(ProfWin *window, const char *const input);
|
static char* _sendfile_autocomplete(ProfWin *window, const char *const input);
|
||||||
static char* _blocked_autocomplete(ProfWin *window, const char *const input);
|
static char* _blocked_autocomplete(ProfWin *window, const char *const input);
|
||||||
static char *_tray_autocomplete(ProfWin *window, const char *const input);
|
static char* _tray_autocomplete(ProfWin *window, const char *const input);
|
||||||
|
static char* _presence_autocomplete(ProfWin *window, const char *const input);
|
||||||
|
|
||||||
static char* _script_autocomplete_func(const char *const prefix);
|
static char* _script_autocomplete_func(const char *const prefix);
|
||||||
|
|
||||||
@ -190,6 +191,7 @@ static Autocomplete plugins_load_ac;
|
|||||||
static Autocomplete sendfile_ac;
|
static Autocomplete sendfile_ac;
|
||||||
static Autocomplete blocked_ac;
|
static Autocomplete blocked_ac;
|
||||||
static Autocomplete tray_ac;
|
static Autocomplete tray_ac;
|
||||||
|
static Autocomplete presence_ac;
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_ac_init(void)
|
cmd_ac_init(void)
|
||||||
@ -724,6 +726,9 @@ cmd_ac_init(void)
|
|||||||
autocomplete_add(tray_ac, "off");
|
autocomplete_add(tray_ac, "off");
|
||||||
autocomplete_add(tray_ac, "read");
|
autocomplete_add(tray_ac, "read");
|
||||||
autocomplete_add(tray_ac, "timer");
|
autocomplete_add(tray_ac, "timer");
|
||||||
|
|
||||||
|
presence_ac = autocomplete_new();
|
||||||
|
autocomplete_add(presence_ac, "titlebar");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -971,6 +976,8 @@ cmd_ac_reset(ProfWin *window)
|
|||||||
autocomplete_reset(plugins_ac);
|
autocomplete_reset(plugins_ac);
|
||||||
autocomplete_reset(blocked_ac);
|
autocomplete_reset(blocked_ac);
|
||||||
autocomplete_reset(tray_ac);
|
autocomplete_reset(tray_ac);
|
||||||
|
autocomplete_reset(presence_ac);
|
||||||
|
|
||||||
autocomplete_reset(script_ac);
|
autocomplete_reset(script_ac);
|
||||||
if (script_show_ac) {
|
if (script_show_ac) {
|
||||||
autocomplete_free(script_show_ac);
|
autocomplete_free(script_show_ac);
|
||||||
@ -1090,6 +1097,7 @@ cmd_ac_uninit(void)
|
|||||||
autocomplete_free(sendfile_ac);
|
autocomplete_free(sendfile_ac);
|
||||||
autocomplete_free(blocked_ac);
|
autocomplete_free(blocked_ac);
|
||||||
autocomplete_free(tray_ac);
|
autocomplete_free(tray_ac);
|
||||||
|
autocomplete_free(presence_ac);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
@ -1102,7 +1110,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
|
|||||||
|
|
||||||
// autocomplete boolean settings
|
// autocomplete boolean settings
|
||||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash", "/chlog", "/grlog",
|
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash", "/chlog", "/grlog",
|
||||||
"/history", "/vercheck", "/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn",
|
"/history", "/vercheck", "/privileges", "/wrap", "/winstidy", "/carbons", "/encwarn",
|
||||||
"/lastactivity" };
|
"/lastactivity" };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||||
@ -1221,6 +1229,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
|
|||||||
g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
|
g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
|
g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
|
g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
|
||||||
|
g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
|
||||||
|
|
||||||
int len = strlen(input);
|
int len = strlen(input);
|
||||||
char parsed[len+1];
|
char parsed[len+1];
|
||||||
@ -2921,3 +2930,21 @@ _account_autocomplete(ProfWin *window, const char *const input)
|
|||||||
found = autocomplete_param_with_ac(input, "/account", account_ac, TRUE);
|
found = autocomplete_param_with_ac(input, "/account", account_ac, TRUE);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char*
|
||||||
|
_presence_autocomplete(ProfWin *window, const char *const input)
|
||||||
|
{
|
||||||
|
char *found = NULL;
|
||||||
|
|
||||||
|
found = autocomplete_param_with_func(input, "/presence titlebar", prefs_autocomplete_boolean_choice);
|
||||||
|
if (found) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
found = autocomplete_param_with_ac(input, "/presence", presence_ac, TRUE);
|
||||||
|
if (found) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -1197,21 +1197,47 @@ static struct cmd_t command_defs[] =
|
|||||||
},
|
},
|
||||||
|
|
||||||
{ "/presence",
|
{ "/presence",
|
||||||
parse_args, 1, 1, &cons_presence_setting,
|
parse_args, 2, 2, &cons_presence_setting,
|
||||||
CMD_NOSUBFUNCS
|
CMD_NOSUBFUNCS
|
||||||
CMD_MAINFUNC(cmd_presence)
|
CMD_MAINFUNC(cmd_presence)
|
||||||
CMD_TAGS(
|
CMD_TAGS(
|
||||||
CMD_TAG_UI,
|
CMD_TAG_UI,
|
||||||
CMD_TAG_CHAT)
|
CMD_TAG_CHAT)
|
||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/presence on|off")
|
"/presence titlebar on|off")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Show the contacts presence in the titlebar.")
|
"Show the contacts presence in the titlebar.")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "on|off", "Switch display of the contacts presence in the titlebar on or off." })
|
{ "titlebar on|off", "Switch display of the contacts presence in the titlebar on or off." })
|
||||||
CMD_NOEXAMPLES
|
CMD_NOEXAMPLES
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ "/statuses",
|
||||||
|
parse_args, 2, 2, &cons_statuses_setting,
|
||||||
|
CMD_NOSUBFUNCS
|
||||||
|
CMD_MAINFUNC(cmd_statuses)
|
||||||
|
CMD_TAGS(
|
||||||
|
CMD_TAG_UI,
|
||||||
|
CMD_TAG_CHAT,
|
||||||
|
CMD_TAG_GROUPCHAT)
|
||||||
|
CMD_SYN(
|
||||||
|
"/statuses console|chat|muc all|online|none")
|
||||||
|
CMD_DESC(
|
||||||
|
"Configure which presence changes are displayed in various windows. "
|
||||||
|
"The default is 'all' for all windows.")
|
||||||
|
CMD_ARGS(
|
||||||
|
{ "console", "Configure what is displayed in the console window." },
|
||||||
|
{ "chat", "Configure what is displayed in chat windows." },
|
||||||
|
{ "muc", "Configure what is displayed in chat room windows." },
|
||||||
|
{ "all", "Show all presence changes." },
|
||||||
|
{ "online", "Show only online/offline changes." },
|
||||||
|
{ "none", "Don't show any presence changes." })
|
||||||
|
CMD_EXAMPLES(
|
||||||
|
"/statuses console none",
|
||||||
|
"/statuses chat online",
|
||||||
|
"/statuses muc all")
|
||||||
|
},
|
||||||
|
|
||||||
{ "/wrap",
|
{ "/wrap",
|
||||||
parse_args, 1, 1, &cons_wrap_setting,
|
parse_args, 1, 1, &cons_wrap_setting,
|
||||||
CMD_NOSUBFUNCS
|
CMD_NOSUBFUNCS
|
||||||
@ -2015,32 +2041,6 @@ static struct cmd_t command_defs[] =
|
|||||||
"/theme load forest")
|
"/theme load forest")
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "/statuses",
|
|
||||||
parse_args, 2, 2, &cons_statuses_setting,
|
|
||||||
CMD_NOSUBFUNCS
|
|
||||||
CMD_MAINFUNC(cmd_statuses)
|
|
||||||
CMD_TAGS(
|
|
||||||
CMD_TAG_UI,
|
|
||||||
CMD_TAG_CHAT,
|
|
||||||
CMD_TAG_GROUPCHAT)
|
|
||||||
CMD_SYN(
|
|
||||||
"/statuses console|chat|muc all|online|none")
|
|
||||||
CMD_DESC(
|
|
||||||
"Configure which presence changes are displayed in various windows. "
|
|
||||||
"The default is 'all' for all windows.")
|
|
||||||
CMD_ARGS(
|
|
||||||
{ "console", "Configure what is displayed in the console window." },
|
|
||||||
{ "chat", "Configure what is displayed in chat windows." },
|
|
||||||
{ "muc", "Configure what is displayed in chat room windows." },
|
|
||||||
{ "all", "Show all presence changes." },
|
|
||||||
{ "online", "Show only online/offline changes." },
|
|
||||||
{ "none", "Don't show any presence changes." })
|
|
||||||
CMD_EXAMPLES(
|
|
||||||
"/statuses console none",
|
|
||||||
"/statuses chat online",
|
|
||||||
"/statuses muc all")
|
|
||||||
},
|
|
||||||
|
|
||||||
{ "/xmlconsole",
|
{ "/xmlconsole",
|
||||||
parse_args, 0, 0, NULL,
|
parse_args, 0, 0, NULL,
|
||||||
CMD_NOSUBFUNCS
|
CMD_NOSUBFUNCS
|
||||||
|
@ -4792,7 +4792,12 @@ cmd_console(ProfWin *window, const char *const command, gchar **args)
|
|||||||
gboolean
|
gboolean
|
||||||
cmd_presence(ProfWin *window, const char *const command, gchar **args)
|
cmd_presence(ProfWin *window, const char *const command, gchar **args)
|
||||||
{
|
{
|
||||||
_cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE);
|
if (g_strcmp0(args[0], "titlebar") != 0) {
|
||||||
|
cons_bad_cmd_usage(command);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cmd_set_boolean_preference(args[1], command, "Contact presence", PREF_PRESENCE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user