mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 14:06:21 +00:00
fix(autoping): align warning command with on|off
The warning toggle uses _cmd_set_boolean_preference (accepts on|off) and the subcommand is "warning", but the help syntax, console status lines and warning text advertised "warning enable|disable" and "/autoping warn", none of which work. - cmd_defs: document "/autoping warning on|off" - console: show "(/autoping warning)" in the status lines - iq: point the warning text at "/autoping warning off" - cmd_ac: register "warning" and complete on|off via a dedicated _autoping_autocomplete (moved off the generic single-level table)
This commit is contained in:
@@ -47,6 +47,7 @@ static char* _notify_autocomplete(ProfWin* window, const char* const input, gboo
|
|||||||
static char* _theme_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _theme_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _spellcheck_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _spellcheck_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _autoaway_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _autoaway_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
|
static char* _autoping_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _autoconnect_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _autoconnect_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _account_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _account_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
static char* _who_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
static char* _who_autocomplete(ProfWin* window, const char* const input, gboolean previous);
|
||||||
@@ -1056,6 +1057,7 @@ cmd_ac_init(void)
|
|||||||
|
|
||||||
autocomplete_add(autoping_ac, "set");
|
autocomplete_add(autoping_ac, "set");
|
||||||
autocomplete_add(autoping_ac, "timeout");
|
autocomplete_add(autoping_ac, "timeout");
|
||||||
|
autocomplete_add(autoping_ac, "warning");
|
||||||
|
|
||||||
autocomplete_add(plugins_ac, "install");
|
autocomplete_add(plugins_ac, "install");
|
||||||
autocomplete_add(plugins_ac, "update");
|
autocomplete_add(plugins_ac, "update");
|
||||||
@@ -1407,6 +1409,7 @@ cmd_ac_init(void)
|
|||||||
g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete);
|
g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/autoaway", _autoaway_autocomplete);
|
g_hash_table_insert(ac_funcs, "/autoaway", _autoaway_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/autoconnect", _autoconnect_autocomplete);
|
g_hash_table_insert(ac_funcs, "/autoconnect", _autoconnect_autocomplete);
|
||||||
|
g_hash_table_insert(ac_funcs, "/autoping", _autoping_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
|
g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/ban", _ban_autocomplete);
|
g_hash_table_insert(ac_funcs, "/ban", _ban_autocomplete);
|
||||||
g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
|
g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
|
||||||
@@ -1934,7 +1937,6 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
|
|||||||
{ "/prefs", prefs_ac },
|
{ "/prefs", prefs_ac },
|
||||||
{ "/disco", disco_ac },
|
{ "/disco", disco_ac },
|
||||||
{ "/room", room_ac },
|
{ "/room", room_ac },
|
||||||
{ "/autoping", autoping_ac },
|
|
||||||
{ "/mainwin", winpos_ac },
|
{ "/mainwin", winpos_ac },
|
||||||
{ "/inputwin", winpos_ac },
|
{ "/inputwin", winpos_ac },
|
||||||
};
|
};
|
||||||
@@ -4264,6 +4266,20 @@ _executable_autocomplete(ProfWin* window, const char* const input, gboolean prev
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char*
|
||||||
|
_autoping_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
||||||
|
{
|
||||||
|
char* result = NULL;
|
||||||
|
|
||||||
|
result = autocomplete_param_with_ac(input, "/autoping", autoping_ac, TRUE, previous);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = autocomplete_param_with_func(input, "/autoping warning", prefs_autocomplete_boolean_choice, previous, NULL);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static char*
|
static char*
|
||||||
_lastactivity_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
_lastactivity_autocomplete(ProfWin* window, const char* const input, gboolean previous)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1965,13 +1965,13 @@ static const struct cmd_t command_defs[] = {
|
|||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/autoping set <seconds>",
|
"/autoping set <seconds>",
|
||||||
"/autoping timeout <seconds>",
|
"/autoping timeout <seconds>",
|
||||||
"/autoping warning enable|disable")
|
"/autoping warning on|off")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"Set the interval between sending ping requests to the server to ensure the connection is kept alive.")
|
"Set the interval between sending ping requests to the server to ensure the connection is kept alive.")
|
||||||
CMD_ARGS(
|
CMD_ARGS(
|
||||||
{ "set <seconds>", "Number of seconds between sending pings, a value of 0 disables autoping." },
|
{ "set <seconds>", "Number of seconds between sending pings, a value of 0 disables autoping." },
|
||||||
{ "timeout <seconds>", "Seconds to wait for autoping responses, after which the connection is considered broken." },
|
{ "timeout <seconds>", "Seconds to wait for autoping responses, after which the connection is considered broken." },
|
||||||
{"warning enable|disable", "Enable or disable autoping availability warning."})
|
{ "warning on|off", "Enable or disable autoping availability warning." })
|
||||||
},
|
},
|
||||||
|
|
||||||
{ CMD_PREAMBLE("/ping",
|
{ CMD_PREAMBLE("/ping",
|
||||||
|
|||||||
@@ -1704,9 +1704,9 @@ cons_notify_setting(void)
|
|||||||
cons_show("Subscription requests (/notify sub) : OFF");
|
cons_show("Subscription requests (/notify sub) : OFF");
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_AUTOPING_WARNING))
|
if (prefs_get_boolean(PREF_AUTOPING_WARNING))
|
||||||
cons_show("Autoping warning (/autoping warn) : ON");
|
cons_show("Autoping warning (/autoping warning): ON");
|
||||||
else
|
else
|
||||||
cons_show("Autoping warning (/autoping warn) : OFF");
|
cons_show("Autoping warning (/autoping warning): OFF");
|
||||||
|
|
||||||
gint remind_period = prefs_get_notify_remind();
|
gint remind_period = prefs_get_notify_remind();
|
||||||
if (remind_period == 0) {
|
if (remind_period == 0) {
|
||||||
@@ -2025,9 +2025,9 @@ cons_autoping_setting(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_AUTOPING_WARNING))
|
if (prefs_get_boolean(PREF_AUTOPING_WARNING))
|
||||||
cons_show("Autoping warning (/autoping warn) : ON");
|
cons_show("Autoping warning (/autoping warning): ON");
|
||||||
else
|
else
|
||||||
cons_show("Autoping warning (/autoping warn) : OFF");
|
cons_show("Autoping warning (/autoping warning): OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -2449,7 +2449,7 @@ _disco_autoping_warning_message(GHashTable* features)
|
|||||||
cons_show("This server supports XEP-0199: XMPP Ping (better keepalive detection),\n"
|
cons_show("This server supports XEP-0199: XMPP Ping (better keepalive detection),\n"
|
||||||
"but autoping feature is currently disabled in settings.\n"
|
"but autoping feature is currently disabled in settings.\n"
|
||||||
"Consider enabling it (e.g., `/autoping set 30`) for improved connection stability.\n"
|
"Consider enabling it (e.g., `/autoping set 30`) for improved connection stability.\n"
|
||||||
"Use `/autoping warn disable` to disable this message.");
|
"Use `/autoping warning off` to disable this message.");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user