From b37a9860232c8f9bc8d0503783c53eb6abbae26e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 11 Sep 2020 20:15:37 +0300 Subject: Jabber: more correct way to detect chat initialization mode --- protocols/JabberG/src/jabber_chat.cpp | 1 + protocols/JabberG/src/jabber_groupchat.cpp | 6 +++--- protocols/JabberG/src/jabber_list.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 5d625b84b7..78756b8b6f 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -319,6 +319,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, const TiXmlElement * Contact_Hide(item->hContact, false); item->bChatActive = false; + item->bChatGotSubject = false; if (m_bJabberOnline) { m_ThreadInfo->send( diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 98fc55987d..1ec2e0203c 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -1026,6 +1026,7 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) } } + item->bChatGotSubject = true; item->getTemp()->m_szStatusMessage = mir_strdup(msgText); } else { @@ -1057,7 +1058,6 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) msgTime = JabberIsoToUnixTime(p); } - bool isHistory = msgTime != 0; time_t now = time(0); if (!msgTime || msgTime > now) msgTime = now; @@ -1078,10 +1078,10 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) gce.pszText.a = szText; gce.bIsMe = nick == nullptr ? FALSE : (mir_strcmp(resource, item->nick) == 0); - if (!isHistory) + if (item->bChatGotSubject) gce.dwFlags |= GCEF_ADDTOLOG; - if (m_bGcLogChatHistory && isHistory) + if (m_bGcLogChatHistory && !item->bChatGotSubject) gce.dwFlags |= GCEF_NOTNOTIFY; Chat_Event(&gce); diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 258f0c8a4e..2e57760cd2 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -206,6 +206,7 @@ struct JABBER_LIST_ITEM : public MZeroedObject char *password; // password for room bool bAutoJoin; + bool bChatGotSubject; // MUC received message with subject bool bUseResource; bool bHistoryRead; bool bRealContact; -- cgit v1.2.3