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 ++++++++++----- protocols/Twitter/src/connection.cpp | 5 ++++- protocols/Twitter/src/proto.cpp | 8 -------- protocols/Twitter/src/proto.h | 1 - 7 files changed, 15 insertions(+), 29 deletions(-) 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 diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 0c4d4bcf6b..efe2170e17 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -582,7 +582,10 @@ void CTwitterProto::UpdateMessages(bool pre_read) recv.szMessage = const_cast(text.c_str()); recv.timestamp = static_cast(time); recv.szMsgId = msgid.c_str(); - ProtoChainRecvMsg(hContact, &recv); + + MEVENT hDbEVent = (MEVENT)ProtoChainRecvMsg(hContact, &recv); + if (!msgid.empty()) + m_arChatMarks.insert(new CChatMark(hDbEVent, msgid.c_str())); } db_pod_set(0, m_szModuleName, TWITTER_KEY_DMSINCEID, dm_since_id_); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index e2780da7b1..45746bc813 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -118,14 +118,6 @@ INT_PTR CTwitterProto::GetCaps(int type, MCONTACT) ///////////////////////////////////////////////////////////////////////////////////////// -MEVENT CTwitterProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) -{ - MEVENT res = CSuper::RecvMsg(hContact, pre); - if (pre->szMsgId) - m_arChatMarks.insert(new CChatMark(res, pre->szMsgId)); - - return res; -} int CTwitterProto::SendMsg(MCONTACT hContact, int, const char *msg) { if (m_iStatus != ID_STATUS_ONLINE) diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index ba2773a18c..af14d07b04 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -161,7 +161,6 @@ public: HANDLE SearchBasic(const wchar_t *) override; HANDLE SearchByEmail(const wchar_t *) override; - MEVENT RecvMsg(MCONTACT hContact, PROTORECVEVENT *) override; int SendMsg(MCONTACT, int, const char *) override; int SetStatus(int) override; -- cgit v1.2.3