diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2017-03-12 09:52:39 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2017-03-12 09:52:39 +0300 |
commit | 9826bda7bcd2a2024eac0fcecffc9633f5ac79f6 (patch) | |
tree | 09bc48ee64ac6ca5e2b49776ae326dd99b37754a /protocols/JabberG/src | |
parent | ed99a12b8304dc9396072c98004d694ab19f05d1 (diff) |
omemo: working on 4.3
started implementation of xep-0060 8.1.1 as required by xep-0.163 3
please corect me if it already done somewhere in jabber
i still need a way to get pubsub address of current jabber server via some jabber api
//oh... i can't use this shitty one word useless comments, i am starting to hate myself, sorry...
//so i will write normal long comments as always )
Diffstat (limited to 'protocols/JabberG/src')
-rwxr-xr-x | protocols/JabberG/src/jabber_omemo.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index c699d759b2..232f1ea78c 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -584,6 +584,17 @@ void CJabberProto::OmemoHandleDeviceList(HXML node) }
}
+void pubsub_createnode(wchar_t *node_name, wchar_t *pubsub_addr, CJabberProto *proto)
+{
+ //xep-0060 8.1.1 required by xep-0163 3
+ XmlNodeIq iq(L"set", proto->SerialNext());
+ iq << XATTR(L"from", proto->m_ThreadInfo->fullJID); //full unstripped jid used here
+ iq << XATTR(L"to", pubsub_addr);
+ HXML create_node = iq << XCHILDNS(L"pubsub", L"http://jabber.org/protocol/pubsub") << XCHILD(L"create");
+ create_node << XATTR(L"node", node_name);
+ proto->m_ThreadInfo->send(iq);
+}
+
void CJabberProto::OmemoAnnounceDevice()
{
// check "OmemoDeviceId%d" for own id and send updated list if not exist
@@ -602,8 +613,11 @@ void CJabberProto::OmemoAnnounceDevice() // add own device id
// construct node
wchar_t szBareJid[JABBER_MAX_JID_LEN];
- XmlNodeIq iq(L"set", SerialNext()); iq << XATTR(L"from", JabberStripJid(m_ThreadInfo->fullJID, szBareJid, _countof(szBareJid)));
+ XmlNodeIq iq(L"set", SerialNext());
+ iq << XATTR(L"from", JabberStripJid(m_ThreadInfo->fullJID, szBareJid, sizeof(szBareJid))); //_countof is not portable
HXML publish_node = iq << XCHILDNS(L"pubsub", L"http://jabber.org/protocol/pubsub") << XCHILD(L"publish") << XATTR(L"node", JABBER_FEAT_OMEMO L":devicelist");
+ //pubsub_createnode(JABBER_FEAT_OMEMO L":devicelist", L"TODO_pubsub_address", this); //TODO: get pubsub address somehow
+ //TODO: handle reply of createnode
HXML list_node = publish_node << XCHILDNS(L"list", JABBER_FEAT_OMEMO);
for (int i = 0; ; ++i) {
@@ -627,14 +641,16 @@ void CJabberProto::OmemoSendBundle() // construct bundle node
wchar_t szBareJid[JABBER_MAX_JID_LEN];
- XmlNodeIq iq(L"set", SerialNext()); iq << XATTR(L"from", JabberStripJid(m_ThreadInfo->fullJID, szBareJid, _countof(szBareJid)));
+ XmlNodeIq iq(L"set", SerialNext());
+ iq << XATTR(L"from", JabberStripJid(m_ThreadInfo->fullJID, szBareJid, sizeof(szBareJid))); //_countof is not portable
- // TODO: add "from"
HXML publish_node = iq << XCHILDNS(L"pubsub", L"http://jabber.org/protocol/pubsub") << XCHILD(L"publish");
{
wchar_t attr_val[128];
mir_snwprintf(attr_val, L"%s:bundles:%d", JABBER_FEAT_OMEMO, own_id);
publish_node << XATTR(L"node", attr_val);
+ //pubsub_createnode(attr_val, L"TODO_pubsub_address", this); //TODO: get pubsub address somehow
+ //TODO: handle reply of createnode
}
HXML bundle_node = publish_node << XCHILD(L"item") << XCHILDNS(L"bundle", JABBER_FEAT_OMEMO);
|