From fd1ca33248519ee530d1d05c6a451c9c63bf4e8a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Apr 2022 11:49:51 +0300 Subject: Jabber: old erroneous idea about subjects in group chats removed --- protocols/JabberG/src/jabber_chat.cpp | 2 +- protocols/JabberG/src/jabber_groupchat.cpp | 5 +++-- protocols/JabberG/src/jabber_list.h | 10 +++++----- protocols/JabberG/src/jabber_thread.cpp | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index c55f4fbd16..69cc778e26 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -148,7 +148,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) } item->bChatLogging = false; - item->dwChatInitTime = time(0); + item->iChatInitTime = time(0); for (int i = _countof(sttStatuses) - 1; i >= 0; i--) Chat_AddGroup(si, TranslateW(Utf2T(sttStatuses[i]))); diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 827e9575da..03d7d5c0a1 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -1009,7 +1009,6 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) resource = nullptr; if ((n = XmlFirstChild(node, "subject")) != nullptr) { - item->bChatLogging = true; msgText = n->GetText(); if (msgText == nullptr || msgText[0] == '\0') return; @@ -1065,7 +1064,9 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) if (!msgTime || msgTime > now) msgTime = now; - if (now - item->dwChatInitTime > 2) + // ugly hack to cut out group chat history: 2 seconds delay to skip all old messages + // unfortunately there's no other way to detect if that message came online or from history + if (now - item->iChatInitTime > 2) item->bChatLogging = true; if (resource != nullptr) { diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 83d2699ef9..082d247350 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -181,11 +181,11 @@ struct JABBER_LIST_ITEM : public MZeroedObject // LIST_CHATROOM // jid = room JID SESSION_INFO *si; - HWND hwndGcListBan; - HWND hwndGcListAdmin; - HWND hwndGcListOwner; - int iChatState; - uint32_t dwChatInitTime; + HWND hwndGcListBan; + HWND hwndGcListAdmin; + HWND hwndGcListOwner; + int iChatState; + time_t iChatInitTime; // LIST_FILE // jid = string representation of port number diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 78f9150aaf..dcd5e5d6b7 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -2000,7 +2000,7 @@ int ThreadData::recv(char* buf, size_t len) if (useZlib) return zlibRecv(buf, (long)len); - return proto->WsRecv(s, buf, len, MSG_DUMPASTEXT); + return proto->WsRecv(s, buf, (long)len, MSG_DUMPASTEXT); } int ThreadData::send(char* buf, int bufsize) -- cgit v1.2.3