about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-04-12 00:24:00 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-04-12 00:24:00 +0200
commit98200ebd43e90d8662fee5e014bbe3dc1709a6d7 (patch)
treea97b2f6d2ff8ca377bf50d495cc04b695f5f2f1b /src/xmpp
parentaedecee962ab3bf72402bde5783cf953d6e24fd0 (diff)
downloadprofani-tty-98200ebd43e90d8662fee5e014bbe3dc1709a6d7.tar.gz
Check if server suppors MAM
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/iq.c7
-rw-r--r--src/xmpp/xmpp.h1
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,