summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-06-16 10:15:14 +0000
committerRobert Pösel <robyer@seznam.cz>2013-06-16 10:15:14 +0000
commit743861f9421b190409c8420e2da37df27571783e (patch)
tree16e1b9b8306dfe7b8172fa4b64c42f4a40f8806f
parent0e88c1fc2f51c815e6b2ebd0ad79d5c0d0661a7c (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
-rw-r--r--include/m_chat.h2
-rw-r--r--plugins/Scriver/src/chat/services.cpp3
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp3
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp28
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp2
-rw-r--r--src/core/stdchat/src/services.cpp3
6 files changed, 17 insertions, 24 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 5007474709..3073b9b27f 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -511,6 +511,8 @@ typedef struct {
#define GCEF_ADDTOLOG 0x0001
#define GCEF_REMOVECONTACT 0x0002
+// Added in Miranda NG 0.94.4+
+#define GCEF_NOTNOTIFY 0x0004
// OK! That was about everything that you need to know about for operating Chat in a basic way.
// There are however some more things you will need to know about. Some you may use and some you may not need,
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp
index aaa5e8f604..a90addd341 100644
--- a/plugins/Scriver/src/chat/services.cpp
+++ b/plugins/Scriver/src/chat/services.cpp
@@ -561,7 +561,8 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
else if (si->hWnd)
SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
- DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ if (!gce->dwFlags & GCEF_NOTNOTIFY)
+ DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings.LoggingEnabled)
LogToFile(si, gce);
}
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index 3f5d199c0e..62cfb994f9 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -767,7 +767,8 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
else if (si->hWnd) {
SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
}
- DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ if (!gce->dwFlags & GCEF_NOTNOTIFY)
+ DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings.LoggingEnabled)
LogToFile(si, gce);
}
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); }
diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp
index 04d749ad2b..883459bf10 100644
--- a/src/core/stdchat/src/services.cpp
+++ b/src/core/stdchat/src/services.cpp
@@ -700,7 +700,8 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
g_TabSession.pLogEnd = si->pLogEnd;
SendMessage(si->hWnd, GC_REDRAWLOG2, 0, 0);
}
- DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ if (!gce->dwFlags & GCEF_NOTNOTIFY)
+ DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings.LoggingEnabled)
LogToFile(si, gce);
}