From 98200ebd43e90d8662fee5e014bbe3dc1709a6d7 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Sun, 12 Apr 2020 00:24:00 +0200 Subject: [PATCH] Check if server suppors MAM --- src/xmpp/iq.c | 7 +++++-- src/xmpp/xmpp.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index e6d34d9d..8152ec01 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -2503,8 +2503,11 @@ _iq_free_affiliation_list(ProfAffiliationList *affiliation_list) void iq_mam_request(ProfChatWin *win) { - //TODDO: check for mam feature - //if (connection_supports(XMPP_FEATURE_PING) == FALSE) { + if (connection_supports(XMPP_FEATURE_MAM2) == FALSE) { + log_warning("Server doesn't advertise %s feature.", XMPP_FEATURE_PING); + cons_show_error("Server doesn't support MAM."); + return; + } xmpp_ctx_t * const ctx = connection_get_ctx(); char *id = connection_create_stanza_id(); diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index cb0004e3..fa26cfbf 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -69,6 +69,7 @@ #define XMPP_FEATURE_PUBSUB_PUBLISH_OPTIONS "http://jabber.org/protocol/pubsub#publish-options" #define XMPP_FEATURE_USER_AVATAR_METADATA_NOTIFY "urn:xmpp:avatar:metadata+notify" #define XMPP_FEATURE_LAST_MESSAGE_CORRECTION "urn:xmpp:message-correct:0" +#define XMPP_FEATURE_MAM2 "urn:xmpp:mam:2" typedef enum { JABBER_CONNECTING,