summaryrefslogtreecommitdiff
path: root/protocols/ICQ-WIM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-02-09 18:21:23 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-02-09 18:22:12 +0300
commit5ef0585dbd3bfbc09093bc8f24f41e4ae2349c59 (patch)
treeb76db3dc8173189591d65cc9a1a4e181331ca8f8 /protocols/ICQ-WIM
parent6ef65121fed3c38c467238a08bf96bf98a23d7d8 (diff)
SRMM: better support for group chats in database
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp2
-rw-r--r--protocols/ICQ-WIM/src/server.cpp35
2 files changed, 8 insertions, 29 deletions
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index f1ff831f63..ec3dd49ce6 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -83,7 +83,7 @@ CIcqProto::CIcqProto(const char *aProtoName, const wchar_t *aUserName) :
// group chats
GCREGISTER gcr = {};
- gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
+ gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR | GC_DATABASE;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index d8f203dfc9..562cdbaa8e 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -486,32 +486,6 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo
}
}
- if (isChatRoom(hContact)) {
- CMStringA reqId(it["reqId"].as_mstring());
- CheckOwnMessage(reqId, szMsgId, true);
-
- CMStringW wszSender(it["chat"]["sender"].as_mstring());
- CMStringW wszChatId(GetUserId(hContact));
-
- if (bIsFileTransfer) {
- wszText = pFileInfo->szUrl;
- if (!pFileInfo->wszDescr)
- wszText.AppendFormat(L"\r\n%s", pFileInfo->wszDescr.c_str());
- delete pFileInfo;
- }
-
- if (auto *si = Chat_Find(wszChatId, m_szModuleName)) {
- GCEVENT gce = { si, GC_EVENT_MESSAGE};
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.pszUID.w = wszSender;
- gce.pszText.w = wszText;
- gce.time = iMsgTime;
- gce.bIsMe = wszSender == m_szOwnId;
- Chat_Event(&gce);
- }
- return;
- }
-
// skip own messages, just set the server msgid
CMStringA reqId(it["reqId"].as_mstring());
if (CheckOwnMessage(reqId, szMsgId, true)) {
@@ -555,13 +529,18 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo
debugLogA("Adding message %d:%lld (CR=%d)", hContact, msgId, bCreateRead);
ptrA szUtf(mir_utf8encodeW(wszText));
+ CMStringA szSender(it["chat"]["sender"].as_mstring());
PROTORECVEVENT pre = {};
- if (bIsOutgoing) pre.flags |= PREF_SENT;
- if (bCreateRead) pre.flags |= PREF_CREATEREAD;
pre.szMsgId = szMsgId;
pre.timestamp = iMsgTime;
pre.szMessage = szUtf;
+ if (bIsOutgoing)
+ pre.flags |= PREF_SENT;
+ if (bCreateRead)
+ pre.flags |= PREF_CREATEREAD;
+ if (isChatRoom(hContact))
+ pre.szUserId = szSender;
ProtoChainRecvMsg(hContact, &pre);
}