From 13c033c257f6c083b0c46b4fa28601db5a0b6335 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Feb 2014 20:50:07 +0000 Subject: MS_MC_GETMETACONTACT => db_mc_getMeta git-svn-id: http://svn.miranda-ng.org/main/trunk@8317 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'plugins/NewAwaySysMod') 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 -- cgit v1.2.3