1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Handle MUC anonymous state when auto starting OMEMO

When auto joining a MUC we don't have access to required information so
we just don't start OMEMO at this time.

Once we receive disco info we then try to start OMEMO.
This commit is contained in:
Paul Fariello 2019-04-17 12:41:19 +02:00
parent a6eb0d2c43
commit 21ae946896
2 changed files with 15 additions and 3 deletions

View File

@ -55,7 +55,7 @@ mucwin_new(const char *const barejid)
ProfMucWin *mucwin = (ProfMucWin *)window;
#ifdef HAVE_OMEMO
if (omemo_automatic_start(barejid)) {
if (muc_anonymity_type(mucwin->roomjid) == MUC_ANONYMITY_TYPE_NONANONYMOUS && omemo_automatic_start(barejid)) {
omemo_start_muc_sessions(barejid);
mucwin->is_omemo = TRUE;
}

View File

@ -72,6 +72,10 @@
#include "xmpp/roster.h"
#include "xmpp/muc.h"
#ifdef HAVE_OMEMO
#include "omemo/omemo.h"
#endif
typedef struct p_room_info_data_t {
char *room;
gboolean display;
@ -2100,8 +2104,16 @@ _room_info_response_id_handler(xmpp_stanza_t *const stanza, void *const userdata
muc_set_features(cb_data->room, features);
ProfMucWin *mucwin = wins_get_muc(cb_data->room);
if (mucwin && cb_data->display) {
mucwin_room_disco_info(mucwin, identities, features);
if (mucwin) {
#ifdef HAVE_OMEMO
if (muc_anonymity_type(mucwin->roomjid) == MUC_ANONYMITY_TYPE_NONANONYMOUS && omemo_automatic_start(cb_data->room)) {
omemo_start_muc_sessions(cb_data->room);
mucwin->is_omemo = TRUE;
}
#endif
if (cb_data->display) {
mucwin_room_disco_info(mucwin, identities, features);
}
}
g_slist_free_full(features, free);