From 94b79e81e2d4677815aaab9155fe341090822f83 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 31 Jul 2014 19:53:29 +0000 Subject: if sub setting doesn't change the active sub, no event should be fired git-svn-id: http://svn.miranda-ng.org/main/trunk@10010 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/mc.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/mir_core/mc.cpp b/src/mir_core/mc.cpp index ba9bbb7697..27a1626f67 100644 --- a/src/mir_core/mc.cpp +++ b/src/mir_core/mc.cpp @@ -153,11 +153,13 @@ MIR_CORE_DLL(int) db_mc_setDefault(MCONTACT hMetaContact, MCONTACT hSub, BOOL bW if (contact_number == -1) return 1; - cc->nDefault = contact_number; - if (bWriteDb) - currDb->MetaSetDefault(cc); - - NotifyEventHooks(hEventDefaultChanged, hMetaContact, hSub); + if (cc->nDefault != contact_number) { + cc->nDefault = contact_number; + if (bWriteDb) + currDb->MetaSetDefault(cc); + + NotifyEventHooks(hEventDefaultChanged, hMetaContact, hSub); + } return 0; } @@ -170,11 +172,13 @@ MIR_CORE_DLL(int) db_mc_setDefaultNum(MCONTACT hMetaContact, int iNum, BOOL bWri if (iNum >= cc->nSubs || iNum < 0) return 1; - cc->nDefault = iNum; - if (bWriteDb) - currDb->MetaSetDefault(cc); + if (cc->nDefault != iNum) { + cc->nDefault = iNum; + if (bWriteDb) + currDb->MetaSetDefault(cc); - NotifyEventHooks(hEventDefaultChanged, hMetaContact, Meta_GetContactHandle(cc, iNum)); + NotifyEventHooks(hEventDefaultChanged, hMetaContact, Meta_GetContactHandle(cc, iNum)); + } return 0; } -- cgit v1.2.3