diff options
author | George Hazan <ghazan@miranda.im> | 2020-02-12 20:49:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-02-12 20:49:33 +0300 |
commit | c64e697b69c0c36c034f00683011894b7a41efea (patch) | |
tree | ec37956644bc7f354ae42525d6058bca90bac639 /protocols/JabberG/src/jabber_proto.cpp | |
parent | 4e6ceb0e009498b4589de4bbe012444ca79881ab (diff) |
Jabber: XEP-0333 implementation (chat markers)
Diffstat (limited to 'protocols/JabberG/src/jabber_proto.cpp')
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 74b957ef82..9a3008cfa8 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -56,6 +56,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : PROTO<CJabberProto>(aProtoName, aUserName),
m_impl(*this),
m_omemo(this),
+ m_arChatMarks(50, NumericKeySortT),
m_lstTransports(50, compareTransports),
m_lstRoster(50, compareListItems),
m_iqManager(this),
@@ -184,6 +185,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : HookProtoEvent(ME_LANGPACK_CHANGED, &CJabberProto::OnLangChanged);
HookProtoEvent(ME_OPT_INITIALISE, &CJabberProto::OnOptionsInit);
HookProtoEvent(ME_SKIN_ICONSCHANGED, &CJabberProto::OnReloadIcons);
+ HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CJabberProto::OnDbMarkedRead);
HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CJabberProto::OnDbSettingChanged);
m_iqManager.FillPermanentHandlers();
@@ -906,6 +908,18 @@ 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
struct TFakeAckParams
@@ -956,7 +970,7 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz int isEncrypted, id = SerialNext();
if (!strncmp(pszSrc, PGP_PROLOG, mir_strlen(PGP_PROLOG))) {
const char *szEnd = strstr(pszSrc, PGP_EPILOG);
- char *tempstring = (char*)alloca(mir_strlen(pszSrc) + 2);
+ char *tempstring = (char *)alloca(mir_strlen(pszSrc) + 2);
size_t nStrippedLength = mir_strlen(pszSrc) - mir_strlen(PGP_PROLOG) - (szEnd ? mir_strlen(szEnd) : 0) + 1;
strncpy_s(tempstring, nStrippedLength, pszSrc + mir_strlen(PGP_PROLOG), _TRUNCATE);
tempstring[nStrippedLength] = 0;
@@ -1006,8 +1020,10 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz m << XATTR("to", szClientJid);
bool bSendReceipt = (m_bMsgAck || getByte(hContact, "MsgAck", false));
- if (bSendReceipt)
+ if (bSendReceipt) {
m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
+ m << XCHILDNS("markable", JABBER_FEAT_CHAT_MARKERS);
+ }
if (
// if message delivery check disabled by entity caps manager
|