From 3217d7889f3db73e145e74c60710440c34a83b7a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Oct 2022 20:02:46 +0300 Subject: =?UTF-8?q?fixes=20#3211=20(Jabber:=20=D0=BF=D1=80=D0=B8=20=D0=B2?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=B5=20=D0=B2=20=D1=87=D0=B0=D1=82=20=D0=B2?= =?UTF-8?q?=20=D0=BB=D0=BE=D0=B3=20=D0=BF=D1=80=D0=B8=D0=BB=D0=B5=D1=82?= =?UTF-8?q?=D0=B0=D1=8E=D1=82=20=D1=84=D0=B5=D0=B9=D0=BA=D0=BE=D0=B2=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=B2=D1=85=D0=BE=D0=B4=D1=8B=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D1=85=20=D0=BE=D1=81=D1=82=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5?= =?UTF-8?q?=20=D1=83=D1=87=D0=B0=D1=81=D1=82=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/JabberG/src/jabber_chat.cpp | 1 - protocols/JabberG/src/jabber_groupchat.cpp | 5 ----- protocols/JabberG/src/jabber_thread.cpp | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 2ebf696113..627b6668a8 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -154,7 +154,6 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) Chat_AddGroup(si, TranslateW(Utf2T(sttStatuses[i]))); Chat_Control(m_szModuleName, wszJid, (item->bAutoJoin && m_bAutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE); - Chat_Control(m_szModuleName, wszJid, SESSION_ONLINE); time_t lastDate = getDword(si->hContact, "LastGetVcard"), now = time(0); if (now - lastDate > 24 * 60 * 60) { diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index b4361422df..6c25309f6e 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -1069,11 +1069,6 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) if (!msgTime || msgTime > now) msgTime = now; - // 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) { pResourceStatus r(item->findResource(resource)); nick = (r && r->m_szNick) ? r->m_szNick.get() : resource; diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 1d9bd95910..f45e313e05 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -149,6 +149,20 @@ void CJabberProto::CheckKeepAlive() } } + // 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 + time_t now = time(0); + LISTFOREACH(i, this, LIST_CHATROOM) + { + if (auto *item = ListGetItemPtrFromIndex(i)) { + if (!item->bChatLogging && now - item->iChatInitTime > 2) { + item->bChatLogging = true; + Chat_Control(m_szModuleName, Utf2T(item->jid), SESSION_ONLINE); + } + } + } + + // check expired iq requests m_iqManager.CheckExpired(); -- cgit v1.2.3