diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-09 21:50:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-09 21:50:49 +0000 |
commit | 0173277372e2962b8f5703a0ebad7892dda15e6c (patch) | |
tree | d1ff4bbecbc00f8d77b9a71c71579de53246303c /src | |
parent | 61dfdec9a37cc06a6ee624aaaf03df41f821c1c6 (diff) |
end of the old MC API
git-svn-id: http://svn.miranda-ng.org/main/trunk@8534 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/modules.cpp | 9 | ||||
-rw-r--r-- | src/mir_core/db.cpp | 30 | ||||
-rw-r--r-- | src/mir_core/mc.cpp | 148 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 6 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj | 1 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/mir_core/mir_core_12.vcxproj | 1 | ||||
-rw-r--r-- | src/mir_core/mir_core_12.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/mir_core/miranda.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/miranda.h | 1 | ||||
-rw-r--r-- | src/miranda32_10.vcxproj | 1 | ||||
-rw-r--r-- | src/miranda32_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_api.cpp | 98 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_edit.cpp | 4 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_menu.cpp | 17 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_services.cpp | 7 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_utils.cpp | 7 | ||||
-rw-r--r-- | src/modules/metacontacts/metacontacts.h | 2 |
18 files changed, 184 insertions, 159 deletions
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 3111bc9e7d..3243e81058 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -150,9 +150,8 @@ int LoadDefaultModules(void) if (LoadContactsModule()) return 1;
if (LoadContactListModule()) return 1; // prepare contact list interface
if (LoadAddContactModule()) return 1;
- #ifdef _DEBUG
- if (LoadMetacontacts()) return 1;
- #endif
+ if (LoadMetacontacts()) return 1;
+
if (LoadNewPluginsModule()) return 1; // will call Load(void) on everything, clist will load first
Langpack_SortDuplicates();
@@ -171,9 +170,7 @@ void UnloadDefaultModules(void) {
UnloadChatModule();
UnloadAccountsModule();
- #ifdef _DEBUG
- UnloadMetacontacts();
- #endif
+ UnloadMetacontacts();
UnloadNewPlugins();
UnloadProtocolsModule();
UnloadSkinSounds();
diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 140af537c0..1479748bf2 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-static MIDatabase* currDb = NULL;
+MIDatabase *currDb = NULL;
/////////////////////////////////////////////////////////////////////////////////////////
// getting data
@@ -321,34 +321,6 @@ MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent) }
/////////////////////////////////////////////////////////////////////////////////////////
-// metacontacts
-
-MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact)
-{
- if (currDb == NULL) return false;
-
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- return (cc == NULL) ? false : cc->nSubs != -1;
-}
-
-MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact)
-{
- if (currDb == NULL) return false;
-
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
- return (cc == NULL) ? false : cc->parentID != 0;
-}
-
-MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact)
-{
- if (currDb == NULL) return NULL;
-
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hSubContact);
- return (cc == NULL) ? NULL : cc->parentID;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////////////////
// misc functions
MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv)
diff --git a/src/mir_core/mc.cpp b/src/mir_core/mc.cpp new file mode 100644 index 0000000000..4970b135d8 --- /dev/null +++ b/src/mir_core/mc.cpp @@ -0,0 +1,148 @@ +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+static HANDLE hEventDefaultChanged;
+
+void InitMetaContacts()
+{
+ hEventDefaultChanged = CreateHookableEvent(ME_MC_DEFAULTTCHANGED);
+}
+
+DBCachedContact* CheckMeta(MCONTACT hMeta)
+{
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
+ return (cc == NULL || cc->nSubs == -1) ? NULL : cc;
+}
+
+int Meta_GetContactNumber(DBCachedContact *cc, MCONTACT hContact)
+{
+ for (int i = 0; i < cc->nSubs; i++)
+ if (cc->pSubs[i] == hContact)
+ return i;
+
+ return -1;
+}
+
+MCONTACT Meta_GetContactHandle(DBCachedContact *cc, int contact_number)
+{
+ if (contact_number >= cc->nSubs || contact_number < 0)
+ return 0;
+
+ return cc->pSubs[contact_number];
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// metacontacts
+
+MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact)
+{
+ if (currDb == NULL) return false;
+
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ return (cc == NULL) ? false : cc->nSubs != -1;
+}
+
+MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact)
+{
+ if (currDb == NULL) return false;
+
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ return (cc == NULL) ? false : cc->parentID != 0;
+}
+
+//returns a handle to the default contact, or null on failure
+MIR_CORE_DLL(MCONTACT) db_mc_getDefault(MCONTACT hMetaContact)
+{
+ DBCachedContact *cc = CheckMeta(hMetaContact);
+ if (cc == NULL)
+ return 0;
+
+ return (cc->nDefault != -1) ? Meta_GetContactHandle(cc, cc->nDefault) : 0;
+}
+
+//returns the default contact number, or -1 on failure
+MIR_CORE_DLL(int) db_mc_getDefaultNum(MCONTACT hMetaContact)
+{
+ DBCachedContact *cc = CheckMeta(hMetaContact);
+ return (cc == NULL) ? -1 : cc->nDefault;
+}
+
+//returns the number of subcontacts, or -1 on failure
+MIR_CORE_DLL(int) db_mc_getSubCount(MCONTACT hMetaContact)
+{
+ DBCachedContact *cc = CheckMeta(hMetaContact);
+ return (cc == NULL) ? -1 : cc->nSubs;
+}
+
+// returns parent hContact for a subcontact or INVALID_CONTACT_ID if it's not a sub
+MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact)
+{
+ if (currDb == NULL) return NULL;
+
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hSubContact);
+ return (cc == NULL) ? NULL : cc->parentID;
+}
+
+// returns a subcontact with the given index
+MIR_CORE_DLL(MCONTACT) db_mc_getSub(MCONTACT hMetaContact, int iNum)
+{
+ DBCachedContact *cc = CheckMeta(hMetaContact);
+ return (cc == NULL) ? 0 : Meta_GetContactHandle(cc, iNum);
+}
+
+//sets the default contact, using the subcontact's handle
+MIR_CORE_DLL(int) db_mc_setDefault(MCONTACT hMetaContact, MCONTACT hSub)
+{
+ DBCachedContact *cc = CheckMeta(hMetaContact);
+ if (cc == NULL)
+ return 1;
+
+ int contact_number = Meta_GetContactNumber(cc, hSub);
+ if (contact_number == -1)
+ return 1;
+
+ cc->nDefault = contact_number;
+ currDb->MetaSetDefault(cc);
+
+ NotifyEventHooks(hEventDefaultChanged, hMetaContact, hSub);
+ return 0;
+}
+
+//sets the default contact, using the subcontact's number
+MIR_CORE_DLL(int) db_mc_setDefaultNum(MCONTACT hMetaContact, int iNum)
+{
+ DBCachedContact *cc = CheckMeta(hMetaContact);
+ if (cc == NULL)
+ return 1;
+ if (iNum >= cc->nSubs || iNum < 0)
+ return 1;
+
+ cc->nDefault = iNum;
+ currDb->MetaSetDefault(cc);
+
+ NotifyEventHooks(hEventDefaultChanged, hMetaContact, Meta_GetContactHandle(cc, iNum));
+ return 0;
+}
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 0d8eaf3e21..647a78b946 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -252,3 +252,9 @@ db_mc_isMeta @249 db_mc_isSub @250
db_mc_getMeta @251
db_get_contact @252
+db_mc_getDefault @253
+db_mc_getDefaultNum @254
+db_mc_getSubCount @255
+db_mc_getSub @256
+db_mc_setDefault @257
+db_mc_setDefaultNum @258
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index f6f3f987db..2c3799288b 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -100,6 +100,7 @@ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="logger.cpp" />
+ <ClCompile Include="mc.cpp" />
<ClCompile Include="mstring.cpp" />
<ClCompile Include="protos.cpp" />
<ClCompile Include="stdafx.cpp">
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index b7a247b20b..1de8cfd829 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -106,6 +106,9 @@ <ClCompile Include="winver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="mc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj index c9926e96ef..fa8058a1df 100644 --- a/src/mir_core/mir_core_12.vcxproj +++ b/src/mir_core/mir_core_12.vcxproj @@ -96,6 +96,7 @@ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="logger.cpp" />
+ <ClCompile Include="mc.cpp" />
<ClCompile Include="mstring.cpp" />
<ClCompile Include="protos.cpp" />
<ClCompile Include="stdafx.cpp">
diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters index 3311ae3578..cf84f183a5 100644 --- a/src/mir_core/mir_core_12.vcxproj.filters +++ b/src/mir_core/mir_core_12.vcxproj.filters @@ -103,6 +103,9 @@ <ClCompile Include="winver.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="mc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp index 639de6b0c1..8779dee996 100644 --- a/src/mir_core/miranda.cpp +++ b/src/mir_core/miranda.cpp @@ -35,6 +35,7 @@ void InitLogs(); void UninitLogs();
void InitWinver();
+void InitMetaContacts();
int hLangpack = 0;
HINSTANCE hInst = 0;
@@ -93,6 +94,7 @@ static void LoadCoreModule(void) InitLogs();
InitialiseModularEngine();
InitProtocols();
+ InitMetaContacts();
}
MIR_CORE_DLL(void) UnloadCoreModule(void)
diff --git a/src/mir_core/miranda.h b/src/mir_core/miranda.h index 122d9fe21d..dc3d055cc0 100644 --- a/src/mir_core/miranda.h +++ b/src/mir_core/miranda.h @@ -42,6 +42,7 @@ extern HINSTANCE hInst; extern HWND hAPCWindow;
extern HANDLE hStackMutex, hThreadQueueEmpty;
extern bool g_bDebugMode;
+extern MIDatabase *currDb;
/**** modules.cpp **********************************************************************/
diff --git a/src/miranda32_10.vcxproj b/src/miranda32_10.vcxproj index b5defb0ab5..2980ebe9ff 100644 --- a/src/miranda32_10.vcxproj +++ b/src/miranda32_10.vcxproj @@ -237,6 +237,7 @@ <ClInclude Include="..\include\m_json.h" />
<ClInclude Include="..\include\m_langpack.h" />
<ClInclude Include="..\include\m_message.h" />
+ <ClInclude Include="..\include\m_metacontacts.h" />
<ClInclude Include="..\include\m_netlib.h" />
<ClInclude Include="..\include\m_options.h" />
<ClInclude Include="..\include\m_popup.h" />
diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters index 85eab76f51..69b91ede81 100644 --- a/src/miranda32_10.vcxproj.filters +++ b/src/miranda32_10.vcxproj.filters @@ -264,6 +264,9 @@ <ClInclude Include="modules\metacontacts\metacontacts.h">
<Filter>Modules\metacontacts</Filter>
</ClInclude>
+ <ClInclude Include="..\include\m_metacontacts.h">
+ <Filter>Modules\metacontacts</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="core\commonheaders.cpp">
diff --git a/src/modules/metacontacts/meta_api.cpp b/src/modules/metacontacts/meta_api.cpp index 553a6cbd6e..beca03b5ec 100644 --- a/src/modules/metacontacts/meta_api.cpp +++ b/src/modules/metacontacts/meta_api.cpp @@ -24,34 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "metacontacts.h"
-// gets the handle for the default contact
-// wParam=(MCONTACT)hMetaContact
-// lParam=0
-// returns a handle to the default contact, or null on failure
-
-static INT_PTR MetaAPI_GetDefault(WPARAM hMetaContact, LPARAM)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- if (cc == NULL)
- return 1;
-
- if (cc->nDefault != -1)
- return Meta_GetContactHandle(cc, cc->nDefault);
-
- return 0;
-}
-
-// gets the contact number for the default contact
-// wParam=(MCONTACT)hMetaContact
-// lParam=0
-// returns a DWORD contact number, or -1 on failure
-
-static INT_PTR MetaAPI_GetDefaultNum(WPARAM hMetaContact, LPARAM)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- return (cc == NULL) ? -1 : cc->nDefault;
-}
-
// gets the handle for the 'most online' contact
// wParam=(MCONTACT)hMetaContact
// lParam=0
@@ -66,70 +38,6 @@ static INT_PTR MetaAPI_GetMostOnline(WPARAM hMetaContact, LPARAM) return Meta_GetMostOnline(cc);
}
-// gets the number of subcontacts for a metacontact
-// wParam=(MCONTACT)hMetaContact
-// lParam=0
-// returns a DWORD representing the number of subcontacts for the given metacontact
-
-static INT_PTR MetaAPI_GetNumContacts(WPARAM hMetaContact, LPARAM)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- return (cc == NULL) ? -1 : cc->nSubs;
-}
-
-// gets the handle of a subcontact, using the subcontact's number
-// wParam=(MCONTACT)hMetaContact
-// lParam=(DWORD)contact number
-// returns a handle to the specified subcontact
-
-static INT_PTR MetaAPI_GetContact(WPARAM hMetaContact, LPARAM lParam)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- return (cc == NULL) ? 0 : Meta_GetContactHandle(cc, lParam);
-}
-
-// sets the default contact, using the subcontact's contact number
-// wParam=(MCONTACT)hMetaContact
-// lParam=(DWORD)contact number
-// returns 0 on success
-
-static INT_PTR MetaAPI_SetDefaultContactNum(WPARAM hMetaContact, LPARAM lParam)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- if (cc == NULL)
- return 1;
- if ((int)lParam >= cc->nSubs || (int)lParam < 0)
- return 1;
-
- cc->nDefault = lParam;
- currDb->MetaSetDefault(cc);
-
- NotifyEventHooks(hEventDefaultChanged, hMetaContact, Meta_GetContactHandle(cc, (int)lParam));
- return 0;
-}
-
-// sets the default contact, using the subcontact's handle
-// wParam=(MCONTACT)hMetaContact
-// lParam=(MCONTACT)hSubcontact
-// returns 0 on success
-
-static INT_PTR MetaAPI_SetDefaultContact(WPARAM hMetaContact, LPARAM lParam)
-{
- DBCachedContact *cc = CheckMeta(hMetaContact);
- if (cc == NULL)
- return 1;
-
- int contact_number = Meta_GetContactNumber(cc, lParam);
- if (contact_number == -1)
- return 1;
-
- cc->nDefault = contact_number;
- currDb->MetaSetDefault(cc);
-
- NotifyEventHooks(hEventDefaultChanged, hMetaContact, lParam);
- return 0;
-}
-
// forces the metacontact to send using a specific subcontact, using the subcontact's contact number
// wParam=(MCONTACT)hMetaContact
// lParam=(DWORD)contact number
@@ -264,13 +172,7 @@ static INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam) void CreateApiServices()
{
- CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
- CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
- CreateServiceFunction(MS_MC_GETNUMCONTACTS, MetaAPI_GetNumContacts);
- CreateServiceFunction(MS_MC_GETSUBCONTACT, MetaAPI_GetContact);
- CreateServiceFunction(MS_MC_SETDEFAULTCONTACTNUM, MetaAPI_SetDefaultContactNum);
- CreateServiceFunction(MS_MC_SETDEFAULTCONTACT, MetaAPI_SetDefaultContact);
CreateServiceFunction(MS_MC_FORCESENDCONTACTNUM, MetaAPI_ForceSendContactNum);
CreateServiceFunction(MS_MC_FORCESENDCONTACT, MetaAPI_ForceSendContact);
CreateServiceFunction(MS_MC_UNFORCESENDCONTACT, MetaAPI_UnforceSendContact);
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index 409d2d8d97..c950ca2569 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -148,9 +148,7 @@ static void ApplyChanges() NotifyEventHooks(hSubcontactsChanged, g_data.hMeta, g_data.hDefaultContact);
// set default
- g_data.cc->nDefault = (g_data.hDefaultContact) ? Meta_GetContactNumber(g_data.cc, g_data.hDefaultContact) : 0;
- currDb->MetaSetDefault(g_data.cc);
- NotifyEventHooks(hEventDefaultChanged, g_data.hMeta, g_data.hDefaultContact);
+ db_mc_setDefaultNum(g_data.hMeta, (g_data.hDefaultContact) ? Meta_GetContactNumber(g_data.cc, g_data.hDefaultContact) : 0);
// set offline
if (g_data.hOfflineContact)
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index 8524c1cdf0..c71c452c81 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -131,12 +131,10 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI // if the default contact was equal to or greater than 'number', decrement it (and deal with ends)
if (ccMeta->nDefault >= number) {
- ccMeta->nDefault--;
- if (ccMeta->nDefault < 0)
- ccMeta->nDefault = 0;
-
- currDb->MetaSetDefault(ccMeta);
- NotifyEventHooks(hEventDefaultChanged, ccMeta->contactID, Meta_GetContactHandle(ccMeta, ccMeta->nDefault));
+ int iNumber = ccMeta->nDefault-1;
+ if (iNumber < 0)
+ iNumber = 0;
+ db_mc_setDefaultNum(ccMeta->contactID, iNumber);
}
ccMeta->nSubs--;
@@ -221,11 +219,8 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion) INT_PTR Meta_Default(WPARAM hSub, LPARAM wParam)
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(db_mc_getMeta(hSub));
- if (cc && cc->IsMeta()) {
- cc->nDefault = Meta_GetContactNumber(cc, hSub);
- currDb->MetaSetDefault(cc);
- NotifyEventHooks(hEventDefaultChanged, cc->contactID, hSub);
- }
+ if (cc && cc->IsMeta())
+ db_mc_setDefault(cc->contactID, hSub);
return 0;
}
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index 467b4c4620..0f08521b0c 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -34,7 +34,6 @@ int previousMode, // Previous status of the MetaContacts Protocol mcStatus; // Current status of the MetaContacts Protocol
HANDLE
- hEventDefaultChanged, // HANDLE to the 'default changed' event
hEventForceSend, // HANDLE to the 'force send' event
hEventUnforceSend, // HANDLE to the 'unforce send' event
hSubcontactsChanged, // HANDLE to the 'contacts changed' event
@@ -672,9 +671,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM hMeta, LPARAM lParam) int caps = CallService(buffer, PFLAGNUM_1, 0);
if ((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) {
// set default contact for sending/status and open message window
- cc->nDefault = (int)lParam;
- currDb->MetaSetDefault(cc);
- NotifyEventHooks(hEventDefaultChanged, hMeta, (LPARAM)hContact);
+ db_mc_setDefaultNum(hMeta, lParam);
CallService(MS_MSG_SENDMESSAGE, hMeta, 0);
}
else // protocol does not support messaging - simulate double click
@@ -875,7 +872,6 @@ void Meta_InitServices() CreateProtoServiceFunction(META_PROTO, PS_SEND_NUDGE, Meta_SendNudge);
// create our hookable events
- hEventDefaultChanged = CreateHookableEvent(ME_MC_DEFAULTTCHANGED);
hEventForceSend = CreateHookableEvent(ME_MC_FORCESEND);
hEventUnforceSend = CreateHookableEvent(ME_MC_UNFORCESEND);
hSubcontactsChanged = CreateHookableEvent(ME_MC_SUBCONTACTSCHANGED);
@@ -902,7 +898,6 @@ void Meta_InitServices() void Meta_CloseHandles()
{
// destroy our hookable events
- DestroyHookableEvent(hEventDefaultChanged);
DestroyHookableEvent(hEventForceSend);
DestroyHookableEvent(hEventUnforceSend);
DestroyHookableEvent(hSubcontactsChanged);
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp index 990e3e10b4..8c32e25105 100644 --- a/src/modules/metacontacts/meta_utils.cpp +++ b/src/modules/metacontacts/meta_utils.cpp @@ -180,11 +180,8 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) ccDest->pSubs[ccDest->nSubs - 1] = hSub;
ccSub->parentID = hMeta;
- if (set_as_default) {
- ccDest->nDefault = ccDest->nSubs - 1;
- currDb->MetaSetDefault(ccDest);
- NotifyEventHooks(hEventDefaultChanged, hMeta, hSub);
- }
+ if (set_as_default)
+ db_mc_setDefaultNum(hMeta, ccDest->nSubs-1);
// set nick to most online contact that can message
MCONTACT most_online = Meta_GetMostOnline(ccDest);
diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h index d4dab57a54..df70f7ed4b 100644 --- a/src/modules/metacontacts/metacontacts.h +++ b/src/modules/metacontacts/metacontacts.h @@ -114,7 +114,7 @@ typedef enum {I_MENUOFF, I_MENU, I_CONVERT, I_ADD, I_EDIT, I_SETDEFAULT, I_REMOV HICON LoadIconEx(IconIndex i);
HANDLE GetIconHandle(IconIndex i);
-extern HANDLE hEventDefaultChanged, hEventForceSend, hEventUnforceSend, hSubcontactsChanged;
+extern HANDLE hEventForceSend, hEventUnforceSend, hSubcontactsChanged;
extern POINT menuMousePoint;
#define MAX_PROTOCOLS 20
|