From 9044e3732c5f6f53e3aa6f0205bd9e05b6caace3 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Tue, 19 Mar 2019 18:39:58 +0140 Subject: [PATCH] Ensure room isn't anonymous --- src/command/cmd_funcs.c | 4 ++++ src/xmpp/xmpp.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index f21da6e7..4c8accd0 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -7978,6 +7978,10 @@ cmd_omemo_start(ProfWin *window, const char *const command, gchar **args) /* TODO: Check room is configured correctly, no anonymous and access to * full jid */ + if (!caps_jid_has_feature(mucwin->roomjid, XMPP_FEATURE_MUC_NONANONYMOUS)) { + win_println(window, THEME_DEFAULT, '!', "MUC is anonymous, can't enable OMEMO."); + return TRUE; + } omemo_start_muc_sessions(mucwin->roomjid); mucwin->is_omemo = TRUE; diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 6675369a..763c8a91 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -60,6 +60,7 @@ #define XMPP_FEATURE_RECEIPTS "urn:xmpp:receipts" #define XMPP_FEATURE_LASTACTIVITY "jabber:iq:last" #define XMPP_FEATURE_MUC "http://jabber.org/protocol/muc" +#define XMPP_FEATURE_MUC_NONANONYMOUS "http://jabber.org/protocol/muc#muc_nonanonymous" #define XMPP_FEATURE_COMMANDS "http://jabber.org/protocol/commands" #define XMPP_FEATURE_OMEMO_DEVICELIST_NOTIFY "eu.siacs.conversations.axolotl.devicelist+notify"