From bce405a7907bf33cb9cc99fc1bd30f06ba1c1c7f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 8 Jun 2020 16:38:58 +0300 Subject: unused shitty code removed --- protocols/JabberG/src/jabber_caps.h | 1 + protocols/JabberG/src/jabber_proto.cpp | 12 ------------ protocols/JabberG/src/jabber_proto.h | 2 -- protocols/JabberG/src/jabber_thread.cpp | 15 ++++++++++----- 4 files changed, 11 insertions(+), 19 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_caps.h b/protocols/JabberG/src/jabber_caps.h index 448c20952c..a76679a941 100755 --- a/protocols/JabberG/src/jabber_caps.h +++ b/protocols/JabberG/src/jabber_caps.h @@ -199,6 +199,7 @@ typedef unsigned __int64 JabberCapsBits; #define JABBER_FEAT_JUD "jabber:iq:search" #define JABBER_FEAT_IDLE "urn:xmpp:idle:1" #define JABBER_FEAT_SERVER_AVATAR "storage:client:avatar" +#define JABBER_FEAT_SID "urn:xmpp:sid:0" #define JABBER_FEAT_UPLOAD "urn:xmpp:http:upload" #define JABBER_FEAT_UPLOAD0 "urn:xmpp:http:upload:0" diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 09384da56e..2da7fcb075 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -883,18 +883,6 @@ HANDLE CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, w return ft; } -//////////////////////////////////////////////////////////////////////////////////////// -// receives a message - -MEVENT CJabberProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) -{ - MEVENT res = CSuper::RecvMsg(hContact, pre); - if (pre->szMsgId) - m_arChatMarks.insert(new CChatMark(res, pre->szMsgId, (const char*)pre->lParam)); - - return res; -} - //////////////////////////////////////////////////////////////////////////////////////// // JabberSendMessage - sends a message diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index dcbf5984ea..deb3332a00 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -126,8 +126,6 @@ struct CJabberProto : public PROTO, public IJabberInterface HWND SearchAdvanced(HWND owner) override; HWND CreateExtendedSearchUI(HWND owner) override; - MEVENT RecvMsg(MCONTACT hContact, PROTORECVEVENT *) override; - int SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList) override; HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override; int SendMsg(MCONTACT hContact, int flags, const char *msg) override; diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index fb01d0f0c5..30a2128c29 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1165,6 +1165,11 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) if (bodyNode != nullptr) szMessage.Append(bodyNode->GetText()); + // check MAM support + const char *szMsgId = nullptr; + if (auto *n = XmlGetChildByTag(node, "stanza-id", "xmlns", JABBER_FEAT_SID)) + szMsgId = n->GetText(); + // If message is from a stranger (not in roster), item is nullptr JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, from); if (item == nullptr) @@ -1398,11 +1403,11 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) } recv.timestamp = (DWORD)msgTime; recv.szMessage = szMessage.GetBuffer(); - if (bSendMark) { - recv.szMsgId = idStr; - recv.lParam = (LPARAM)from; - } - ProtoChainRecvMsg(hContact, &recv); + recv.szMsgId = szMsgId; + + MEVENT hDbEVent = (MEVENT)ProtoChainRecvMsg(hContact, &recv); + if (idStr) + m_arChatMarks.insert(new CChatMark(hDbEVent, idStr, from)); } // XEP-0115: Entity Capabilities -- cgit v1.2.3