Compare commits
1 Commits
6548329616
...
1f38ff0522
| Author | SHA1 | Date | |
|---|---|---|---|
|
1f38ff0522
|
@@ -1959,12 +1959,14 @@ static const struct cmd_t command_defs[] = {
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
"/autoping set <seconds>",
|
||||
"/autoping timeout <seconds>")
|
||||
"/autoping timeout <seconds>",
|
||||
"/autoping warning enable|disable")
|
||||
CMD_DESC(
|
||||
"Set the interval between sending ping requests to the server to ensure the connection is kept alive.")
|
||||
CMD_ARGS(
|
||||
{ "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."})
|
||||
},
|
||||
|
||||
{ CMD_PREAMBLE("/ping",
|
||||
|
||||
@@ -6350,6 +6350,8 @@ cmd_autoping(ProfWin* window, const char* const command, gchar** args)
|
||||
cons_bad_cmd_usage(command);
|
||||
}
|
||||
|
||||
} else if (g_strcmp0(cmd, "warning") == 0) {
|
||||
_cmd_set_boolean_preference(value, "Autoping availability warning", PREF_AUTOPING_WARNING);
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ typedef struct prof_account_t
|
||||
gchar* muc_service;
|
||||
gchar* muc_nick;
|
||||
gboolean enabled;
|
||||
gboolean autoping_received;
|
||||
gchar* otr_policy;
|
||||
GList* otr_manual;
|
||||
GList* otr_opportunistic;
|
||||
|
||||
@@ -2211,6 +2211,7 @@ _get_default_boolean(preference_t pref)
|
||||
case PREF_MOOD:
|
||||
case PREF_STROPHE_SM_ENABLED:
|
||||
case PREF_STROPHE_SM_RESEND:
|
||||
case PREF_AUTOPING_WARNING:
|
||||
return TRUE;
|
||||
case PREF_PGP_PUBKEY_AUTOIMPORT:
|
||||
case PREF_FORCE_ENCRYPTION:
|
||||
|
||||
@@ -2053,21 +2053,27 @@ cons_autoping_setting(void)
|
||||
{
|
||||
gint autoping_interval = prefs_get_autoping();
|
||||
if (autoping_interval == 0) {
|
||||
cons_show("Autoping interval (/autoping) : OFF");
|
||||
cons_show("Autoping interval (/autoping) : OFF");
|
||||
} else if (autoping_interval == 1) {
|
||||
cons_show("Autoping interval (/autoping) : 1 second");
|
||||
cons_show("Autoping interval (/autoping) : 1 second");
|
||||
} else {
|
||||
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
|
||||
cons_show("Autoping interval (/autoping) : %d seconds", autoping_interval);
|
||||
}
|
||||
|
||||
gint autoping_timeout = prefs_get_autoping_timeout();
|
||||
if (autoping_timeout == 0) {
|
||||
cons_show("Autoping timeout (/autoping) : OFF");
|
||||
cons_show("Autoping timeout (/autoping) : OFF");
|
||||
} else if (autoping_timeout == 1) {
|
||||
cons_show("Autoping timeout (/autoping) : 1 second");
|
||||
cons_show("Autoping timeout (/autoping) : 1 second");
|
||||
} else {
|
||||
cons_show("Autoping timeout (/autoping) : %d seconds", autoping_timeout);
|
||||
cons_show("Autoping timeout (/autoping) : %d seconds", autoping_timeout);
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_AUTOPING_WARNING))
|
||||
cons_show("Autoping warning (/autoping warn) : ON");
|
||||
else
|
||||
cons_show("Autoping warning (/autoping warn) : OFF");
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -2451,19 +2451,14 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* con
|
||||
static int
|
||||
_disco_autoping_warning_message(GHashTable* features)
|
||||
{
|
||||
gboolean supports_ping = g_hash_table_contains(features, "urn:xmpp:ping");
|
||||
gboolean is_autoping_disabled = prefs_get_autoping() == 0;
|
||||
gboolean server_supports_ping = g_hash_table_contains(features, "urn:xmpp:ping");
|
||||
gboolean users_prefers_warning = prefs_get_boolean(PREF_AUTOPING_WARNING);
|
||||
|
||||
// if "autoping" in disco + user wasn't alerted earlier after login + prefs for autoping recommendation alert is set
|
||||
// then cons_show("Autoping is disabled, but server supports autoping.")
|
||||
|
||||
if (supports_ping && is_autoping_disabled) { // && !connection->disco_ping_alert_shown
|
||||
// TODO: later add preference check: if (prefs_autoping_recommendation_enabled())
|
||||
if (server_supports_ping && users_prefers_warning) {
|
||||
cons_show("This server supports XEP-0199: XMPP Ping (better keepalive detection),\n"
|
||||
"but autoping feature is currently disabled in settings.\n"
|
||||
"Consider enabling it (e.g., `/autoping set 30`) for improved connection stability.\n"
|
||||
"Use `/autoping warn disable` to disable this message.");
|
||||
// connection->disco_ping_alert_shown = TRUE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user