summaryrefslogtreecommitdiff
path: root/plugins/NewAwaySysMod/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-27 20:50:07 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-27 20:50:07 +0000
commit13c033c257f6c083b0c46b4fa28601db5a0b6335 (patch)
treecb6c2d292df718d1cddd885ad1029a0b81f1b7e4 /plugins/NewAwaySysMod/src
parent367e673a5a3d4d49b2ef1bfbf57a1a5828a2d174 (diff)
MS_MC_GETMETACONTACT => db_mc_getMeta
git-svn-id: http://svn.miranda-ng.org/main/trunk@8317 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewAwaySysMod/src')
-rw-r--r--plugins/NewAwaySysMod/src/MsgEventAdded.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
index 87c6bf8c3d..a124a2a416 100644
--- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
+++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp
@@ -139,28 +139,28 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam)
int bMsgWindowIsOpen = MSGWNDOPEN_UNDEFINED;
if (dbei->flags & DBEF_READ) {
// if it's a subcontact of a metacontact
- MCONTACT hMetaContact;
- if (ServiceExists(MS_MC_GETMETACONTACT) && (hMetaContact = CallService(MS_MC_GETMETACONTACT, hContact, 0))) { // ugly workaround for metacontacts, part II
- // remove outdated events first
- DWORD CurTime = time(NULL);
- int i;
- for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
- if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
- MetacontactEvents.RemoveElem(i);
-
- // we compare only event timestamps, and do not look at the message itself. it's unlikely that there'll be two events from a contact at the same second, so it's a trade-off between speed and reliability
- for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--) {
- if (MetacontactEvents[i].timestamp == dbei->timestamp && MetacontactEvents[i].hMetaContact == hMetaContact) {
- bMsgWindowIsOpen = MetacontactEvents[i].bMsgWindowIsOpen;
- break;
- }
- }
- if (i < 0) {
- _ASSERT(0);
- return 0;
+ MCONTACT hMetaContact = db_mc_getMeta(hContact);
+ if (hMetaContact == 0)
+ return 0;
+
+ // remove outdated events first
+ DWORD CurTime = time(NULL);
+ int i;
+ for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--)
+ if (CurTime - MetacontactEvents[i].timestamp > MAX_REPLY_TIMEDIFF)
+ MetacontactEvents.RemoveElem(i);
+
+ // we compare only event timestamps, and do not look at the message itself. it's unlikely that there'll be two events from a contact at the same second, so it's a trade-off between speed and reliability
+ for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--) {
+ if (MetacontactEvents[i].timestamp == dbei->timestamp && MetacontactEvents[i].hMetaContact == hMetaContact) {
+ bMsgWindowIsOpen = MetacontactEvents[i].bMsgWindowIsOpen;
+ break;
}
}
- else return 0;
+ if (i < 0) {
+ _ASSERT(0);
+ return 0;
+ }
}
// ugly workaround for metacontacts, part i; store all metacontacts' events to a temporary array, so we'll be able to get the 'source' protocol when subcontact event happens later. we need the protocol to get its status and per-status settings properly