From 0187ea2b4e05a9db837260bb1a581b9e86e280c2 Mon Sep 17 00:00:00 2001 From: sss Date: Sun, 13 Mar 2022 15:40:36 +0300 Subject: omemo: removed outdated comments, added non-standard complient hack for devicelist polling (still need response handler as it is not event and not handled by existing handler) --- protocols/JabberG/src/jabber_proto.cpp | 1 - protocols/JabberG/src/jabber_thread.cpp | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index cfdadd8696..6af5a01d2a 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -919,7 +919,6 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz // omemo enabled in options, omemo enabled for contact if (m_bUseOMEMO && OmemoIsEnabled(hContact) && !mir_strcmp(msgType, "chat")) { - // TODO: check if message encrypted for at least one session and return error if not if (!OmemoEncryptMessage(m, pszSrc, hContact)) { ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, 0, (LPARAM)TranslateT("No valid OMEMO session exists")); return 0; diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 3f23c57079..7aa94ca70c 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -941,7 +941,6 @@ void CJabberProto::OnProcessPubsubEvent(const TiXmlElement *node) OmemoHandleDeviceList(from, itemsNode); return; } - //TODO:handle omemo device list } if (m_bEnableUserTune) @@ -1571,6 +1570,16 @@ void CJabberProto::OnProcessPresence(const TiXmlElement *node, ThreadData *info) } hContact = DBCreateContact(from, nick, true, true); } + if (hContact && m_bUseOMEMO) + { + char szBareJid[JABBER_MAX_JID_LEN]; + XmlNodeIq iq("get", SerialNext()); + iq << XATTR("from", m_ThreadInfo->fullJID); + iq << XATTR("to", from); + iq << XCHILDNS("pubsub", "http://jabber.org/protocol/pubsub") + << XCHILD("items") << XATTR("node", JABBER_FEAT_OMEMO ".devicelist"); + m_ThreadInfo->send(iq); + } if (!ListGetItemPtr(LIST_ROSTER, from)) { debugLogA("Receive presence online from %s (who is not in my roster)", from); ListAdd(LIST_ROSTER, from, hContact); -- cgit v1.2.3