summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprotocols/JabberG/src/jabber_caps.h1
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp12
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.h2
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp15
-rw-r--r--protocols/Twitter/src/connection.cpp5
-rw-r--r--protocols/Twitter/src/proto.cpp8
-rw-r--r--protocols/Twitter/src/proto.h1
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
@@ -884,18 +884,6 @@ HANDLE CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, w
}
////////////////////////////////////////////////////////////////////////////////////////
-// 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
static char PGP_PROLOG[] = "-----BEGIN PGP MESSAGE-----\r\n\r\n";
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<CJabberProto>, 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<char*>(text.c_str());
recv.timestamp = static_cast<DWORD>(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;