diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-06 20:36:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-06 20:36:31 +0300 |
commit | 55dbfad33560045e5e14e04c9ad11a38b9bcff09 (patch) | |
tree | bdda5c74012d083e0e3d222dbbe33ee39135229e /protocols/JabberG | |
parent | de1dcbef050238f3a35a73779e404f80afa031bf (diff) |
Jabber: option for message delivery to control all chat markers according to XEP-0333
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber_events.cpp | 10 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 7 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_misc.cpp | 8 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_notes.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_thread.cpp | 2 |
6 files changed, 19 insertions, 14 deletions
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index 8c53e05f94..4116f78e4f 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -170,10 +170,12 @@ int __cdecl CJabberProto::OnDbMarkedRead(WPARAM, LPARAM hDbEvent) auto *pMark = m_arChatMarks.find((CChatMark *)&hDbEvent);
if (pMark) {
- XmlNode reply("message"); reply << XATTR("to", pMark->szFrom) << XATTR("id", pMark->szId)
- << XCHILDNS("displayed", JABBER_FEAT_CHAT_MARKERS) << XATTR("id", pMark->szId);
- m_ThreadInfo->send(reply);
-
+ if(m_bMsgAck) {
+ XmlNode reply("message"); reply << XATTR("to", pMark->szFrom) << XATTR("id", pMark->szId)
+ << XCHILDNS("displayed", JABBER_FEAT_CHAT_MARKERS) << XATTR("id", pMark->szId);
+ m_ThreadInfo->send(reply);
+ }
+
m_arChatMarks.remove(pMark);
}
return 0;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index dbc6651514..bdfdffe845 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -800,8 +800,11 @@ bool CJabberProto::FtTryInlineFile(filetransfer *ft) auto *nPara = nBody << XCHILD("p");
nPara << XCHILD("img") << XATTR("src", CMStringA(FORMAT, "cid:sha1+%s@bob.xmpp.org", szHash));
- m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
- m << XCHILDNS("markable", JABBER_FEAT_CHAT_MARKERS);
+ if(m_bMsgAck) {
+ m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
+ m << XCHILDNS("markable", JABBER_FEAT_CHAT_MARKERS);
+ }
+
m_ThreadInfo->send(m);
// emulate a message for us
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 64a7126bc6..c8b4562276 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -477,9 +477,11 @@ void CJabberProto::OnGetBob(const TiXmlElement *node, CJabberIqInfo *pReq) {
auto pMark = ((CChatMark *)pReq->GetUserData());
if (pMark) {
- XmlNode reply("message"); reply << XATTR("to", pMark->szFrom) << XATTR("id", pMark->szId)
- << XCHILDNS("displayed", JABBER_FEAT_CHAT_MARKERS) << XATTR("id", pMark->szId);
- m_ThreadInfo->send(reply);
+ if(m_bMsgAck) {
+ XmlNode reply("message"); reply << XATTR("to", pMark->szFrom) << XATTR("id", pMark->szId)
+ << XCHILDNS("displayed", JABBER_FEAT_CHAT_MARKERS) << XATTR("id", pMark->szId);
+ m_ThreadInfo->send(reply);
+ }
delete pMark;
}
diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 18b328983f..e5015bb4c6 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -686,7 +686,7 @@ void CJabberProto::ProcessOutgoingNote(CNoteItem *pNote, bool ok) hXmlItem << XCHILD("text", T2Utf(pNote->GetText()));
// message receipts XEP priority
- if (jcb & JABBER_CAPS_MESSAGE_RECEIPTS)
+ if (m_bMsgAck && (jcb & JABBER_CAPS_MESSAGE_RECEIPTS))
m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
else
nMsgId = -1;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index a2ef33798d..bd76fd7aa3 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -951,9 +951,7 @@ 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 && jcb && !(jcb & (JABBER_CAPS_CHAT_MARKERS | JABBER_CAPS_MESSAGE_RECEIPTS)))
- bSendReceipt = false;
+ bool bSendReceipt = m_bMsgAck && (jcb & (JABBER_CAPS_CHAT_MARKERS | JABBER_CAPS_MESSAGE_RECEIPTS));
if (bSendReceipt) {
m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 152a0d0924..7c0376aa13 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1059,7 +1059,7 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) pResourceStatus pFromResource(ResourceInfoFromJID(from));
// Message receipts delivery request. Reply here, before a call to HandleMessagePermanent() to make sure message receipts are handled for external plugins too.
- if (bEnableDelivery && (!type || mir_strcmpi(type, "error"))) {
+ if (m_bMsgAck && bEnableDelivery && (!type || mir_strcmpi(type, "error"))) {
bool bSendReceipt = XmlGetChildByTag(node, "request", "xmlns", JABBER_FEAT_MESSAGE_RECEIPTS) != 0;
bool bSendMark = XmlGetChildByTag(node, "markable", "xmlns", JABBER_FEAT_CHAT_MARKERS) != 0;
if (bSendReceipt || bSendMark) {
|