From 2cf889e14cb73a24f0ab1a5cb5e2a5d09a98c895 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 21 Feb 2017 20:29:59 +0300 Subject: protocols: jabber: omemo: empty handlers for omemo message/key, omemo devicelist update --- protocols/JabberG/src/jabber_omemo.cpp | 10 ++++++++++ protocols/JabberG/src/jabber_proto.h | 4 ++++ protocols/JabberG/src/jabber_thread.cpp | 27 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) mode change 100644 => 100755 protocols/JabberG/src/jabber_proto.h (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index 6cd11cbe42..be4f896e49 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -412,3 +412,13 @@ namespace omemo { } }; + +void CJabberProto::OmemoHandleMessage(HXML /*node*/) +{ + //TODO: handle "encrypted" node here +} + +void CJabberProto::OmemoHandleDeviceList(HXML /*node*/) +{ + //TODO: handle omemo device list event node here +} \ No newline at end of file diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h old mode 100644 new mode 100755 index f62d73c528..b2042bcdd1 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -336,6 +336,10 @@ struct CJabberProto : public PROTO, public IJabberInterface void AddMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* str, const wchar_t* rsn); void DeleteMucListItem(JABBER_MUC_JIDLIST_INFO* jidListInfo, const wchar_t* jid); + //---- jabber_omemo.cpp -------------------------------------------------------------- + void OmemoHandleMessage(HXML node); + void OmemoHandleDeviceList(HXML node); + //---- jabber_console.cpp ------------------------------------------------------------ INT_PTR __cdecl OnMenuHandleConsole(WPARAM wParam, LPARAM lParam); diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 0b28ee9157..df32105d1d 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -949,6 +949,16 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) return; HXML itemsNode; + if (m_options.UseOMEMO) + { + itemsNode = XmlGetChildByTag(eventNode, "items", "node", JABBER_FEAT_OMEMO":devicelist"); + if (itemsNode) + { + OmemoHandleDeviceList(itemsNode); + return; + } + //TODO:handle omemo device list + } if (m_options.EnableUserTune && (itemsNode = XmlGetChildByTag(eventNode, "items", "node", JABBER_FEAT_USER_TUNE))) { // node retract? if (XmlGetChild(itemsNode, "retract")) { @@ -1183,6 +1193,23 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) // parsing extensions for (int i = 0; (xNode = XmlGetChild(node, i)) != NULL; i++) { + if (m_options.UseOMEMO) + { + //TODO: handle incomming omemo message/key + if ((xNode = XmlGetNthChild(node, L"encrypted", i + 1)) == NULL) + { + const wchar_t *ptszXmlns = XmlGetAttrValue(xNode, L"xmlns"); + if (ptszXmlns == NULL) + continue; + + if (!mir_wstrcmp(ptszXmlns, JABBER_FEAT_OMEMO)) + { + OmemoHandleMessage(xNode); + continue; + } + } + + } if ((xNode = XmlGetNthChild(node, L"x", i + 1)) == NULL) continue; -- cgit v1.2.3