summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.h6
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp8
-rwxr-xr-xprotocols/JabberG/src/jabber_omemo.cpp17
-rwxr-xr-xprotocols/JabberG/src/jabber_opt.cpp4
5 files changed, 23 insertions, 14 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index 9fba101d53..f92bdc708b 100755
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -75,7 +75,7 @@ const JabberFeatCapPair g_JabberFeatCapPairs[] = {
{ JABBER_FEAT_JINGLE, JABBER_CAPS_JINGLE, LPGENW("Supports Jingle") },
{ JABBER_FEAT_ROSTER_EXCHANGE, JABBER_CAPS_ROSTER_EXCHANGE, LPGENW("Supports Roster Exchange") },
{ JABBER_FEAT_DIRECT_MUC_INVITE, JABBER_CAPS_DIRECT_MUC_INVITE, LPGENW("Supports direct chat invitations (XEP-0249)") },
- { JABBER_FEAT_OMEMO_NOTIFY, JABBER_CAPS_OMEMO_NOTIFY, LPGENW("Receives information about OMEMO devices") },
+ { JABBER_FEAT_OMEMO_DEVICELIST_NOTIFY, JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY, LPGENW("Receives information about OMEMO devices") },
{ NULL }
};
diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h
index 4e69e7c1bf..41d4a11abc 100755
--- a/protocols/JabberG/src/jabber_caps.h
+++ b/protocols/JabberG/src/jabber_caps.h
@@ -112,8 +112,8 @@ typedef unsigned __int64 JabberCapsBits;
#define JABBER_CAPS_NEWGPG ((JabberCapsBits)1<<43)
#define JABBER_FEAT_OMEMO L"eu.siacs.conversations.axolotl" //will become "urn:xmpp:omemo:0" once standard get accepted
#define JABBER_CAPS_OMEMO ((JabberCapsBits)1<<46)
-#define JABBER_FEAT_OMEMO_NOTIFY JABBER_FEAT_OMEMO L"+notify"
-#define JABBER_CAPS_OMEMO_NOTIFY ((JabberCapsBits)1<<47)
+#define JABBER_FEAT_OMEMO_DEVICELIST_NOTIFY JABBER_FEAT_OMEMO L":devicelist+notify"
+#define JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY ((JabberCapsBits)1<<47)
#define JABBER_CAPS_PLATFORMX86 ((JabberCapsBits)1<<44)
#define JABBER_CAPS_PLATFORMX64 ((JabberCapsBits)1<<45)
#define JABBER_FEAT_PRIVACY_LISTS L"jabber:iq:privacy"
@@ -167,7 +167,7 @@ typedef unsigned __int64 JabberCapsBits;
JABBER_CAPS_ROSTER_EXCHANGE | JABBER_CAPS_DIRECT_MUC_INVITE)
#define JABBER_CAPS_MIRANDA_ALL (JABBER_CAPS_MIRANDA_PARTIAL | JABBER_CAPS_COMMANDS | \
- JABBER_CAPS_USER_MOOD_NOTIFY | JABBER_CAPS_USER_TUNE_NOTIFY | JABBER_CAPS_USER_ACTIVITY_NOTIFY | JABBER_CAPS_OMEMO_NOTIFY \
+ JABBER_CAPS_USER_MOOD_NOTIFY | JABBER_CAPS_USER_TUNE_NOTIFY | JABBER_CAPS_USER_ACTIVITY_NOTIFY | JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY \
| JABBER_CAPS_PLATFORMX86 | JABBER_CAPS_PLATFORMX64)
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index e04c453978..d9cd46f0c3 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -207,9 +207,15 @@ void CJabberProto::OnLoggedIn()
setString("LastLoggedServer", m_ThreadInfo->conn.server);
m_pepServices.ResetPublishAll();
- //is it correct place ?
if (m_options.UseOMEMO)
+ {
+ if (m_PubsubServiceName) // this is required if login server is changed only
+ {
+ mir_free(m_PubsubServiceName);
+ m_PubsubServiceName = nullptr;
+ }
OmemoCreateNodes();
+ }
}
void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*)
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp
index db7ef41854..de38332f0c 100755
--- a/protocols/JabberG/src/jabber_omemo.cpp
+++ b/protocols/JabberG/src/jabber_omemo.cpp
@@ -471,8 +471,6 @@ namespace omemo {
mir_free(key);
signal_buffer_free(key_buf);
-
- //TODO: generate and store "bundle"
//TODO: is it required to resend bundle everytime with device ?
//generate and save signed pre key
@@ -550,6 +548,13 @@ namespace omemo {
iq << XATTR(L"from", proto->m_ThreadInfo->fullJID); //full unstripped jid used here
HXML create_node = iq << XCHILDNS(L"pubsub", L"http://jabber.org/protocol/pubsub") << XCHILD(L"create");
create_node << XATTR(L"node", node_name);
+ if(!mir_wstrcmp(node_name, JABBER_FEAT_OMEMO L":devicelist"))
+ {
+ DWORD own_id = omemo::GetOwnDeviceId(proto);
+ wchar_t attr_val[128];
+ mir_snwprintf(attr_val, L"%s:bundles:%d", JABBER_FEAT_OMEMO, own_id);
+ pubsub_createnode_impl(attr_val, proto);
+ }
proto->m_ThreadInfo->send(iq);
}
@@ -696,7 +701,9 @@ void CJabberProto::OmemoHandleDeviceList(HXML node)
node = XmlGetChildByTag(node, L"list", L"xmlns", JABBER_FEAT_OMEMO); //<list xmlns = 'urn:xmpp:omemo:0'>
if (!node)
return;
- bool own_jid = false; //TODO: detect own jid (not working due to jabber_thread.cpp:947+)
+ bool own_jid = false;
+ if (wcsstr(m_ThreadInfo->fullJID, jid))
+ own_jid = true;
DWORD current_id;
LPCTSTR current_id_str;
if (own_jid)
@@ -823,8 +830,4 @@ void CJabberProto::OmemoSendBundle()
void CJabberProto::OmemoCreateNodes()
{
omemo::pubsub_createnode(JABBER_FEAT_OMEMO L":devicelist", this);
- DWORD own_id = omemo::GetOwnDeviceId(this);
- wchar_t attr_val[128];
- mir_snwprintf(attr_val, L"%s:bundles:%d", JABBER_FEAT_OMEMO, own_id);
- omemo::pubsub_createnode(attr_val, this);
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index a604cd30fa..071c841546 100755
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -859,9 +859,9 @@ public:
for (int i = 0; i < m_proto->m_lstJabberFeatCapPairsDynamic.getCount(); i++)
jcb |= m_proto->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
if(m_proto->m_options.UseOMEMO)
- jcb |= JABBER_CAPS_OMEMO_NOTIFY;
+ jcb |= JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
else
- jcb &= ~JABBER_CAPS_OMEMO_NOTIFY;
+ jcb &= ~JABBER_CAPS_OMEMO_DEVICELIST_NOTIFY;
m_proto->m_clientCapsManager.SetClientCaps(JABBER_CAPS_MIRANDA_NODE, szCoreVersion, jcb);
}