summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_groupchat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_groupchat.cpp')
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 4edc7787eb..dc7f1e3b8e 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -317,19 +317,6 @@ void CJabberProto::GroupchatJoinRoom(const TCHAR *server, const TCHAR *room, con
if (info.password && info.password[0])
x << XCHILD(_T("password"), info.password);
- if (m_options.GcLogChatHistory) {
- char setting[JABBER_MAX_JID_LEN + 14 + 1];
- mir_snprintf(setting, SIZEOF(setting), "muc_%s@%s_lastevent", _T2A(room), _T2A(server));
- time_t lasteventtime = this->JGetDword(NULL, setting, 0);
- if (lasteventtime > 0) {
- _tzset();
- lasteventtime += _timezone + 1;
-
- TCHAR lasteventdate[20 + 1];
- x << XCHILD(_T("history")) << XATTR(_T("since"), time2str(lasteventtime, lasteventdate, SIZEOF(lasteventdate)));
- }
- }
-
SendPresenceTo(status, text, x);
}
@@ -1243,16 +1230,11 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
msgTime = JabberIsoToUnixTime(p);
}
+ bool isHistory = msgTime != 0;
time_t now = time(NULL);
if (!msgTime || msgTime > now)
msgTime = now;
- if (m_options.GcLogChatHistory) {
- char setting[JABBER_MAX_JID_LEN + 14 + 1];
- mir_snprintf(setting, sizeof(setting), "muc_%s_lastevent", _T2A(gcd.ptszID));
- this->JSetDword(NULL, setting, msgTime + _timezone);
- }
-
if (resource != NULL) {
JABBER_RESOURCE_STATUS* r = GcFindResource(item, resource);
nick = r && r->nick ? r->nick : resource;
@@ -1268,9 +1250,15 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
gce.time = msgTime;
gce.ptszText = EscapeChatTags((TCHAR*)msgText);
gce.bIsMe = nick == NULL ? FALSE : (lstrcmp(resource, item->nick) == 0);
- gce.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
+ gce.dwFlags = GC_TCHAR;
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ if (!isHistory)
+ gce.dwFlags |= GCEF_ADDTOLOG;
+
+ if (m_options.GcLogChatHistory && isHistory)
+ gce.dwFlags |= GCEF_NOTNOTIFY;
+
item->bChatActive = 2;
if (gcd.iType == GC_EVENT_TOPIC) {