summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-06-06 21:19:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-06-06 21:19:49 +0300
commitecd56d476d8b0e3a8700e3a27a67f4c1e579f176 (patch)
treedda13df333464a9ded69af9038393f75dec6a761
parent55dbfad33560045e5e14e04c9ad11a38b9bcff09 (diff)
more portable version of previous patch
-rw-r--r--protocols/JabberG/src/jabber_events.cpp2
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp2
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp4
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp3
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
-rw-r--r--protocols/JabberG/src/jabber_util.cpp15
6 files changed, 22 insertions, 6 deletions
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 4116f78e4f..3dc078fa8d 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -170,7 +170,7 @@ int __cdecl CJabberProto::OnDbMarkedRead(WPARAM, LPARAM hDbEvent)
auto *pMark = m_arChatMarks.find((CChatMark *)&hDbEvent);
if (pMark) {
- if(m_bMsgAck) {
+ if (IsSendAck(hContact)) {
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);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index bdfdffe845..55002d6f59 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -800,7 +800,7 @@ bool CJabberProto::FtTryInlineFile(filetransfer *ft)
auto *nPara = nBody << XCHILD("p");
nPara << XCHILD("img") << XATTR("src", CMStringA(FORMAT, "cid:sha1+%s@bob.xmpp.org", szHash));
- if(m_bMsgAck) {
+ if (IsSendAck(ft->std.hContact)) {
m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
m << XCHILDNS("markable", JABBER_FEAT_CHAT_MARKERS);
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index c8b4562276..b73a2dba93 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -475,9 +475,9 @@ static bool SaveBlobToFile(const wchar_t *pwszFileName, const CMStringA &body)
void CJabberProto::OnGetBob(const TiXmlElement *node, CJabberIqInfo *pReq)
{
- auto pMark = ((CChatMark *)pReq->GetUserData());
+ auto *pMark = ((CChatMark *)pReq->GetUserData());
if (pMark) {
- if(m_bMsgAck) {
+ 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);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index bd76fd7aa3..24c9f5b7ba 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -951,8 +951,7 @@ int CJabberProto::SendMsg(MCONTACT hContact, int unused_unknown, const char *psz
m << XATTR("to", szClientJid);
- bool bSendReceipt = m_bMsgAck && (jcb & (JABBER_CAPS_CHAT_MARKERS | JABBER_CAPS_MESSAGE_RECEIPTS));
-
+ bool bSendReceipt = IsSendAck(hContact) && (jcb & (JABBER_CAPS_CHAT_MARKERS | JABBER_CAPS_MESSAGE_RECEIPTS));
if (bSendReceipt) {
m << XCHILDNS("request", JABBER_FEAT_MESSAGE_RECEIPTS);
m << XCHILDNS("markable", JABBER_FEAT_CHAT_MARKERS);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 8cd4ac4b64..bbf8fee6ce 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -870,7 +870,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount = JABBER_DEFAULT_RECENT_COUNT);
void ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param, const wchar_t *string, int recentCount = JABBER_DEFAULT_RECENT_COUNT);
BOOL EnterString(CMStringW &result, const wchar_t *caption, int type, char *windowName=nullptr, int recentCount = JABBER_DEFAULT_RECENT_COUNT, int timeout = 0);
+
bool IsMyOwnJID(const char *szJID);
+ bool IsSendAck(MCONTACT hContact);
void __cdecl LoadHttpAvatars(void* param);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 8c6856e41b..f620593fed 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -890,6 +890,8 @@ bool JabberReadXep203delay(const TiXmlElement *node, time_t &msgTime)
return msgTime != 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
bool CJabberProto::IsMyOwnJID(const char *szJID)
{
if (m_ThreadInfo == nullptr)
@@ -914,6 +916,19 @@ bool CJabberProto::IsMyOwnJID(const char *szJID)
return mir_strcmp(szFrom, szTo) == 0;
}
+bool CJabberProto::IsSendAck(MCONTACT hContact)
+{
+ if (getBool(hContact, "MsgAck"))
+ return true;
+
+ if (getBool(hContact, "MsgNoAck"))
+ return false;
+
+ return m_bMsgAck;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void __cdecl CJabberProto::LoadHttpAvatars(void* param)
{
Thread_SetName("Jabber: LoadHttpAvatars");