[WORK IN PROGRESS] feat: warning if autoping is disabled
All checks were successful
CI Code / Check spelling (pull_request) Successful in 21s
CI Code / Check coding style (pull_request) Successful in 36s
CI Code / Code Coverage (pull_request) Successful in 15m29s
CI Code / Linux (debian) (pull_request) Successful in 16m1s
CI Code / Linux (ubuntu) (pull_request) Successful in 16m3s
CI Code / Linux (arch) (pull_request) Successful in 21m14s
All checks were successful
CI Code / Check spelling (pull_request) Successful in 21s
CI Code / Check coding style (pull_request) Successful in 36s
CI Code / Code Coverage (pull_request) Successful in 15m29s
CI Code / Linux (debian) (pull_request) Successful in 16m1s
CI Code / Linux (ubuntu) (pull_request) Successful in 16m3s
CI Code / Linux (arch) (pull_request) Successful in 21m14s
This commit is contained in:
@@ -57,6 +57,7 @@ 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;
|
||||
|
||||
@@ -1816,6 +1816,7 @@ _get_group(preference_t pref)
|
||||
case PREF_TRAY:
|
||||
case PREF_TRAY_READ:
|
||||
case PREF_ADV_NOTIFY_DISCO_OR_VERSION:
|
||||
case PREF_AUTOPING_WARNING:
|
||||
return PREF_GROUP_NOTIFICATIONS;
|
||||
case PREF_DBLOG:
|
||||
case PREF_CHLOG:
|
||||
@@ -2156,6 +2157,8 @@ _get_key(preference_t pref)
|
||||
return "force-encryption.enabled";
|
||||
case PREF_FORCE_ENCRYPTION_MODE:
|
||||
return "force-encryption.policy";
|
||||
case PREF_AUTOPING_WARNING:
|
||||
return "autoping.warning";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -188,7 +188,8 @@ typedef enum {
|
||||
PREF_VCARD_PHOTO_CMD,
|
||||
PREF_STATUSBAR_TABMODE,
|
||||
PREF_FORCE_ENCRYPTION,
|
||||
PREF_FORCE_ENCRYPTION_MODE
|
||||
PREF_FORCE_ENCRYPTION_MODE,
|
||||
PREF_AUTOPING_WARNING
|
||||
} preference_t;
|
||||
|
||||
typedef struct prof_alias_t
|
||||
|
||||
@@ -1739,6 +1739,11 @@ cons_notify_setting(void)
|
||||
else
|
||||
cons_show("Subscription requests (/notify sub) : OFF");
|
||||
|
||||
if (prefs_get_boolean(PREF_AUTOPING_WARNING))
|
||||
cons_show("Autoping warning (/autoping warn) : ON");
|
||||
else
|
||||
cons_show("Autoping warning (/autoping warn) : OFF");
|
||||
|
||||
gint remind_period = prefs_get_notify_remind();
|
||||
if (remind_period == 0) {
|
||||
cons_show("Reminder period (/notify remind) : OFF");
|
||||
|
||||
@@ -129,6 +129,7 @@ static void _ping_get_handler(xmpp_stanza_t* const stanza);
|
||||
static int _version_result_id_handler(xmpp_stanza_t* const stanza, void* const userdata);
|
||||
static int _disco_info_response_id_handler(xmpp_stanza_t* const stanza, void* const userdata);
|
||||
static int _disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* const userdata);
|
||||
static int _disco_autoping_warning_message(GHashTable* features);
|
||||
static int _http_upload_response_id_handler(xmpp_stanza_t* const stanza, void* const upload_ctx);
|
||||
static int _last_activity_response_id_handler(xmpp_stanza_t* const stanza, void* const userdata);
|
||||
static int _room_info_response_id_handler(xmpp_stanza_t* const stanza, void* const userdata);
|
||||
@@ -2439,6 +2440,7 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* con
|
||||
}
|
||||
child = xmpp_stanza_get_next(child);
|
||||
}
|
||||
_disco_autoping_warning_message(features);
|
||||
}
|
||||
|
||||
connection_features_received(from);
|
||||
@@ -2446,6 +2448,26 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* con
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
// 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())
|
||||
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;
|
||||
}
|
||||
|
||||
static int
|
||||
_http_upload_response_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user