From 743861f9421b190409c8420e2da37df27571783e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 16 Jun 2013 10:15:14 +0000 Subject: Chat API: added flag to not notify particular event Jabber: Fixed (changed) muc history filtering to not notifying git-svn-id: http://svn.miranda-ng.org/main/trunk@4972 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_groupchat.cpp | 28 ++++++++-------------------- protocols/JabberG/src/jabber_opt.cpp | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) (limited to 'protocols/JabberG') 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) { diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index e3397736fe..b481f8fe28 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -944,7 +944,7 @@ public: m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Affiliation changes"), m_proto->m_options.GcLogAffiliations); m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Role changes"), m_proto->m_options.GcLogRoles); m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Status changes"), m_proto->m_options.GcLogStatuses); - m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Filter history messages"), m_proto->m_options.GcLogChatHistory); + m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Don't notify history messages"), m_proto->m_options.GcLogChatHistory); } static CDlgBase *Create(void *param) { return new CDlgOptGc((CJabberProto *)param); } -- cgit v1.2.3