diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-06-16 10:15:14 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-06-16 10:15:14 +0000 |
commit | 743861f9421b190409c8420e2da37df27571783e (patch) | |
tree | 16e1b9b8306dfe7b8172fa4b64c42f4a40f8806f /protocols/JabberG/src | |
parent | 0e88c1fc2f51c815e6b2ebd0ad79d5c0d0661a7c (diff) |
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
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_groupchat.cpp | 28 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 2 |
2 files changed, 9 insertions, 21 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) {
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); }
|