diff options
58 files changed, 175 insertions, 267 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 7c5813b0ff..63f04f9dc4 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex 33b43189cf..670376cdbf 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib Binary files differindex edc6ccd46e..81e045fb27 100644 --- a/bin11/lib/mir_core.lib +++ b/bin11/lib/mir_core.lib diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib Binary files differindex 0d6bfe83fd..d94e790cb2 100644 --- a/bin11/lib/mir_core64.lib +++ b/bin11/lib/mir_core64.lib diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib Binary files differindex 8bd758cfd1..0ddb5ab484 100644 --- a/bin12/lib/mir_core.lib +++ b/bin12/lib/mir_core.lib diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib Binary files differindex 6f9817f2b0..8180f25634 100644 --- a/bin12/lib/mir_core64.lib +++ b/bin12/lib/mir_core64.lib diff --git a/include/delphi/m_metacontacts.inc b/include/delphi/m_metacontacts.inc index 7ad2bf77d4..c25dfeadc2 100644 --- a/include/delphi/m_metacontacts.inc +++ b/include/delphi/m_metacontacts.inc @@ -22,14 +22,6 @@  {$DEFINE M_METACONTACTS}
  const
 -  { get the handle for a contact's parent metacontact
 -    wParam=(HANDLE)hSubContact
 -    lParam=0
 -    returns a handle to the parent metacontact, or null if this contact is not
 -    a subcontact
 -  }
 -  MS_MC_GETMETACONTACT = 'MetaContacts/GetMeta';
 -
    { gets the handle for the default contact
      wParam=(HANDLE)hMetaContact
      lParam=0
 @@ -171,4 +163,9 @@ function db_mc_isMeta(hContact:MCONTACT):Integer; stdcall;  function db_mc_isSub(hContact:MCONTACT):Integer; stdcall;
                   external CoreDLL name 'db_mc_isSub';
 +{ returns a meta contact for a subcontact or 0 otherwise
 +}
 +function db_mc_getMeta(hContact:MCONTACT):MCONTACT; stdcall;
 +                 external CoreDLL name 'db_mc_getMeta';
 +
  {$ENDIF}
 diff --git a/include/m_metacontacts.h b/include/m_metacontacts.h index 94cda43bd8..02d0fece6f 100644 --- a/include/m_metacontacts.h +++ b/include/m_metacontacts.h @@ -26,12 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include <m_core.h>
 -//get the handle for a contact's parent metacontact
 -//wParam=(HANDLE)hSubContact
 -//lParam=0
 -//returns a handle to the parent metacontact, or null if this contact is not a subcontact
 -#define MS_MC_GETMETACONTACT				"MetaContacts/GetMeta"
 -
  //gets the handle for the default contact
  //wParam=(HANDLE)hMetaContact
  //lParam=0
 @@ -176,6 +170,9 @@ MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact);  // checks whether a contact is a subcontact of existing MC
  MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact);
 +// 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 defined(__cplusplus)
  }
  #endif
 diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index d56a2a20cf..ae493d33ad 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -156,18 +156,15 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)  					else
  						ShowDebugPopup(hContact, TranslateT("AVH Debug: File copied successfully"), history_filename);
 -					if (ServiceExists(MS_MC_GETMETACONTACT)) {
 -						MCONTACT hMetaContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 -
 -						if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY)) {
 -							TCHAR filename[MAX_PATH] = _T("");
 -
 -							GetOldStyleAvatarName(filename, hMetaContact);
 -							if (CopyImageFile(avatar->filename, filename))
 -								ShowPopup(hContact, TranslateT("Avatar History: Unable to save avatar"), filename);
 -							else
 -								ShowDebugPopup(hContact, TranslateT("AVH Debug: File copied successfully"), filename);
 -						}
 +					MCONTACT hMetaContact = db_mc_getMeta(hContact);
 +					if (hMetaContact && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY)) {
 +						TCHAR filename[MAX_PATH] = _T("");
 +
 +						GetOldStyleAvatarName(filename, hMetaContact);
 +						if (CopyImageFile(avatar->filename, filename))
 +							ShowPopup(hContact, TranslateT("Avatar History: Unable to save avatar"), filename);
 +						else
 +							ShowDebugPopup(hContact, TranslateT("AVH Debug: File copied successfully"), filename);
  					}
  				}
  			}
 @@ -201,11 +198,9 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)  				if (opts.log_per_contact_folders) {
  					CreateOldStyleShortcut(hContact, history_filename);
 -					if (ServiceExists(MS_MC_GETMETACONTACT)) {
 -						MCONTACT hMetaContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 -						if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY))
 -							CreateOldStyleShortcut(hMetaContact, history_filename);
 -					}
 +					MCONTACT hMetaContact = db_mc_getMeta(hContact);
 +					if (hMetaContact && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY))
 +						CreateOldStyleShortcut(hMetaContact, history_filename);
  				}
  			}
  		}
 diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 178c252ea9..f9ba750500 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -25,7 +25,7 @@ HGENMENU  g_hTogglePopupsMenuItem;  int       hLangpack;
  COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview)
 -BOOL bPopupExists = FALSE, bMetaContactsExists = FALSE, bFingerprintExists = FALSE, bVariablesExists = FALSE;
 +BOOL bPopupExists = FALSE, bFingerprintExists = FALSE, bVariablesExists = FALSE;
  PLUGININFOEX pluginInfo = {
  	sizeof(PLUGININFOEX),
 @@ -210,7 +210,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)  			return 0;
  		_ASSERT(szProto);
 -		if (bMetaContactsExists && !strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
 +		if (!strcmp(szProto, (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) // workaround for metacontacts
  			return 0;
  		sd.MirVer = db_get_s(hContact, szProto, DB_MIRVER, _T(""));
 @@ -230,7 +230,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)  		PopupOptPage.DBToMem();
  	}
 -	MCONTACT hContactOrMeta = (hContact && bMetaContactsExists) ? (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0) : hContact;
 +	MCONTACT hContactOrMeta = (hContact) ? db_mc_getMeta(hContact) : 0;
  	if (!hContactOrMeta)
  		hContactOrMeta = hContact;
 @@ -369,7 +369,6 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM  static int ModuleLoad(WPARAM wParam, LPARAM lParam)
  {
  	bPopupExists = ServiceExists(MS_POPUP_ADDPOPUP);
 -	bMetaContactsExists = ServiceExists(MS_MC_GETPROTOCOLNAME) && ServiceExists(MS_MC_GETMETACONTACT);
  	bFingerprintExists = ServiceExists(MS_FP_SAMECLIENTST) && ServiceExists(MS_FP_GETCLIENTICONT);
  	bVariablesExists = ServiceExists(MS_VARS_FORMATSTRING);
  	return 0;
 diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index 09bb9a3e91..e0a1b83b5b 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -253,11 +253,11 @@ void CDb3Mmap::FillContacts()  			for (int i = 0; i < cc->nSubs; i++) {
  				char setting[100];
  				mir_snprintf(setting, sizeof(setting), "Handle%d", i);
 -				cc->pSubs[i] = (0 != GetContactSetting(dwContactID, "MetaContacts", setting, &dbv)) ? INVALID_CONTACT_ID : dbv.dVal;
 +				cc->pSubs[i] = (0 != GetContactSetting(dwContactID, "MetaContacts", setting, &dbv)) ? NULL : dbv.dVal;
  			}
  		}
 -		cc->activeID = (0 != GetContactSetting(dwContactID, "MetaContacts", "Default", &dbv)) ? INVALID_CONTACT_ID : dbv.dVal;
 -		cc->parentID = (0 != GetContactSetting(dwContactID, "MetaContacts", "Handle", &dbv)) ? INVALID_CONTACT_ID : dbv.dVal;
 +		cc->activeID = (0 != GetContactSetting(dwContactID, "MetaContacts", "Default", &dbv)) ? NULL : dbv.dVal;
 +		cc->parentID = (0 != GetContactSetting(dwContactID, "MetaContacts", "Handle", &dbv)) ? NULL : dbv.dVal;
  		dwOffset = p->ofsNext;
  	}
 diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index cb04157a35..39d6549624 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -20,7 +20,7 @@ HGENMENU hmenuVis,hmenuOff,hmenuHide,hmenuIgnore,hmenuProto,hmenuAdded,hmenuAuth  HGENMENU hmenuCopyID,hmenuRecvFiles,hmenuStatusMsg,hmenuCopyIP,hmenuCopyMirVer;
  static HGENMENU hIgnoreItem[9], hProtoItem[MAX_PROTOS];
  HICON hIcon[5];
 -BOOL bMetaContacts = FALSE, bPopupService = FALSE;
 +BOOL bPopupService = FALSE;
  PROTOACCOUNT **accs;
  OPENOPTIONSDIALOG ood;
  int protoCount;
 @@ -261,28 +261,21 @@ void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg)  BOOL isMetaContact(MCONTACT hContact)
  {
 -	char *proto;
 -	if (bMetaContacts) {
 -		proto = GetContactProto(hContact);
 -		if ( lstrcmpA(proto, "MetaContacts") == 0 ) {
 -			return TRUE;
 -		}
 -	}
 +	char *proto = GetContactProto(hContact);
 +	if (lstrcmpA(proto, "MetaContacts") == 0)
 +		return TRUE;
 +
  	return FALSE;
  }
  MCONTACT getDefaultContact(MCONTACT hContact)
  {
 -	if (bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, hContact, 0);
 -	return 0;
 +	return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, hContact, 0);
  }
  MCONTACT getMostOnline(MCONTACT hContact)
  {
 -	if (bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
 -	return 0;
 +	return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
  }
  void GetID(MCONTACT hContact, LPSTR szProto, LPSTR szID)
 @@ -980,7 +973,6 @@ static int ContactWindowOpen(WPARAM wparam, LPARAM lParam)  static int ModuleLoad(WPARAM wParam, LPARAM lParam)
  {
  	bPopupService = ServiceExists(MS_POPUP_ADDPOPUP);
 -	bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT);
  	return 0;
  }
 diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index c3ebb7f95a..953ac2adfc 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -196,7 +196,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam)  	if (!db_event_get((HANDLE)lParam, &info)) {
  		if(info.eventType == EVENTTYPE_MESSAGE) {
  			MCONTACT hSub;
 -			if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
 +			if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
  				hContact = hSub;
  			ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
 @@ -252,7 +252,7 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) {  	if(mwd->uType != MSG_WINDOW_EVT_OPEN) return 0;
  	MCONTACT hContact = mwd->hContact, hTemp;
 -	if(options.bHaveMetaContacts && (hTemp = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
 +	if((hTemp = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
  		hContact = hTemp;
  	if (!CallService(MS_PROTO_ISPROTOONCONTACT, hContact, (LPARAM)MODULENAME))
 diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp index 65d489d1cc..317fcd749f 100644 --- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp @@ -86,7 +86,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM)  		return TRUE;
  	MCONTACT hContact = (MCONTACT)pcpp->wParam, hSub;
 -	if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
 +	if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
  		hContact = hSub;
  	TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact));
 diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index b6792618d5..59e32e72b2 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -89,7 +89,6 @@ void LoadOptions() {  	options.end_offline = (db_get_b(0, MODULENAME, "EndOffline", 1) == 1);
  	options.end_window_close = (db_get_b(0, MODULENAME, "EndWindowClose", 0) == 1);
 -	options.bHaveMetaContacts = 0 != ServiceExists(MS_MC_GETMETACONTACT);
  	options.bHavePopups = 0 != ServiceExists(MS_POPUP_ADDPOPUPT) && ServiceExists(MS_POPUP_SHOWMESSAGE);
  	options.bHaveSecureIM = 0 != ServiceExists("SecureIM/IsContactSecured");
  	options.bHaveButtonsBar = 0 != ServiceExists(MS_BB_ADDBUTTON);
 diff --git a/plugins/MirOTR/MirOTR/src/options.h b/plugins/MirOTR/MirOTR/src/options.h index ee74c7b9cc..27a3f06223 100644 --- a/plugins/MirOTR/MirOTR/src/options.h +++ b/plugins/MirOTR/MirOTR/src/options.h @@ -32,7 +32,7 @@ typedef struct {  	bool end_offline, end_window_close;
  	// temporary options
 -	bool bHaveMetaContacts, bHavePopups, bHaveSecureIM, bHaveButtonsBar;
 +	bool bHavePopups, bHaveSecureIM, bHaveButtonsBar;
  } Options;
 diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index 0db55124ea..010ef9077b 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -26,7 +26,7 @@ int StartOTR(MCONTACT hContact) {  INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam)
  {
  	MCONTACT hSub;
 -	if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
 +	if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
  		hContact = hSub;
  	if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) {
 @@ -46,7 +46,7 @@ INT_PTR SVC_StartOTR(WPARAM hContact, LPARAM lParam)  INT_PTR SVC_RefreshOTR(WPARAM hContact, LPARAM lParam)
  {
  	MCONTACT hSub;
 -	if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
 +	if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
  		hContact = hSub;
  	if ( options.bHaveSecureIM && CallService("SecureIM/IsContactSecured", hContact, 0) != 0 ) {
 @@ -100,7 +100,7 @@ INT_PTR SVC_StopOTR(WPARAM hContact, LPARAM lParam)  INT_PTR SVC_VerifyOTR(WPARAM hContact, LPARAM lParam)
  {
  	MCONTACT hSub;
 -	if(options.bHaveMetaContacts && (hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
 +	if((hSub = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0)) != 0)
  		hContact = hSub;
  	ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
 diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index fcc4b5e85a..fc273282b2 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -69,8 +69,8 @@ void SetEncryptionStatus(MCONTACT hContact, TrustLevel level)  	if (options.bHaveButtonsBar) CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&button);
  	db_set_dw(hContact, MODULENAME, "TrustLevel", level);
 -	if (!chat_room && options.bHaveMetaContacts) {
 -		MCONTACT hMeta = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 +	if (!chat_room) {
 +		MCONTACT hMeta = db_mc_getMeta(hContact);
  		MCONTACT hMostOnline = (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0);
  		if(hMeta && hContact == hMostOnline)
  			SetEncryptionStatus(hMeta, level);
 diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index f457542ec0..c9f01b8187 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -83,7 +83,7 @@ tstring CContactList::GetContactGroupPath(MCONTACT hContact)  	tstring strGroup = _T("");
  	if(db_get_b(0, "MetaContacts", "Enabled", 1) && CAppletManager::IsSubContact(hContact))
  	{
 -		MCONTACT hMetaContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, NULL);
 +		MCONTACT hMetaContact = db_mc_getMeta(hContact);
  		if(CConfig::GetBoolSetting(CLIST_USEGROUPS))
  			strGroup = CAppletManager::GetContactGroup(hMetaContact);
 @@ -160,11 +160,10 @@ void CContactList::AddContact(MCONTACT hContact)  		return;
  	}
  	else if(CAppletManager::IsSubContact(hContact)) {
 -		MCONTACT hMetaContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 +		MCONTACT hMetaContact = db_mc_getMeta(hContact);
  		// check that the metacontact exists
 -		if(!FindContact(hMetaContact)) {
 +		if(!FindContact(hMetaContact))
  			AddContact(hMetaContact);
 -		}
  	}
  	CListItem<CContactListEntry*,CContactListGroup*> *pItem = NULL;
 @@ -221,8 +220,9 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) {  	if(CConfig::GetBoolSetting(CLIST_USEIGNORE)) {	
  		if(db_get_b(pEntry->hHandle,"CList","Hidden",0))
  			return false;
 -		else if(CAppletManager::IsSubContact(pEntry->hHandle)) {
 -			MCONTACT hMetaContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)pEntry->hHandle, 0);
 +		
 +		if(CAppletManager::IsSubContact(pEntry->hHandle)) {
 +			MCONTACT hMetaContact = db_mc_getMeta(pEntry->hHandle);
  			if(db_get_b(hMetaContact,"CList","Hidden",0))
  				return false;
  		}
 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
 diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 7a946b16cf..9c5f46a6e2 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -71,7 +71,7 @@ int HookedNewEvent(WPARAM hContact, LPARAM lParam)  	db_event_get((HANDLE)lParam, &dbe);
  	//do not show popups for sub-contacts
 -	if (hContact && ServiceExists(MS_MC_GETMETACONTACT) && CallService(MS_MC_GETMETACONTACT, hContact, 0))
 +	if (hContact && db_mc_isSub(hContact))
  		return 0;
  	//custom database event types
 diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index ac41cb8788..2770d28b64 100644 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -49,7 +49,7 @@ void setClistIcon(MCONTACT hContact)  	bool enabled = isContactSecured(hContact);
  	extern HANDLE g_hCLIcon;
  	MCONTACT hMC = hContact;
 -	if(metaIsSubcontact(hContact))
 +	if(db_mc_isSub(hContact))
  		hMC = metaGetContact(hContact);
  	else if(metaIsProtoMetaContacts(hContact))
  		hMC = metaGetContact(hContact);
 @@ -64,7 +64,7 @@ void setSrmmIcon(MCONTACT h)  	MCONTACT hContact = metaIsProtoMetaContacts(h) ? metaGetMostOnline(h) : h;
  	bool enabled = isContactSecured(hContact);	
  	MCONTACT hMC = NULL;
 -	if(metaIsSubcontact(hContact))
 +	if(db_mc_isSub(hContact))
  		hMC = metaGetContact(hContact);
  	else if(metaIsProtoMetaContacts(hContact))
  		hMC = metaGetContact(hContact);
 diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 185cb0d774..633411c44a 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -17,7 +17,7 @@  #include "commonheaders.h"
  //global variables
 -bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
 +bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
  TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
  list <JabberAccount*> Accounts;
 @@ -140,8 +140,6 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)  	sid.szTooltip = LPGEN("GPG Turn on encryption");
  	Srmm_AddIcon(&sid);
 -	bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0;
 -	
  	if(bJabberAPI && bIsMiranda09)
  		GetJabberInterface(0,0);
 diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index af59cbe729..cada448160 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -319,7 +319,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags  							str.insert(0, inopentag);  							str.append(inclosetag);  						} -						if(metaIsSubcontact(hContact)) +						if(db_mc_isSub(hContact))  						{  							char *msg = mir_strdup(toUTF8(str).c_str());  							HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags|DBEF_READ)); @@ -338,7 +338,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags  	}  	if(db_get_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0))  	{ -		if(metaIsSubcontact(hContact)) +		if(db_mc_isSub(hContact))  		{  			HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags|DBEF_READ));  			HistoryLog(metaGetContact(hContact), db_event(msg, timestamp, 0, dbflags)); @@ -487,7 +487,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)  					db_set_b(ccs->hContact, szGPGModuleName, "bAlwatsTrust", 1);  					setSrmmIcon(ccs->hContact);  					setClistIcon(ccs->hContact); -					if(metaIsSubcontact(ccs->hContact)) +					if(db_mc_isSub(ccs->hContact))  					{  						setSrmmIcon(metaGetContact(ccs->hContact));  						setClistIcon(metaGetContact(ccs->hContact)); @@ -767,7 +767,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)  		str_event.insert(0, toUTF8(outopentag));  		str_event.append(toUTF8(outclosetag));  	} -	/*if(metaIsSubcontact(hContact)) +	/*if(db_mc_isSub(hContact))  	{  		hcontact_data[metaGetContact(hContact)].msgs_to_pass.push_back(str_event);  		if(bDebugLog) diff --git a/plugins/New_GPG/src/metacontacts.cpp b/plugins/New_GPG/src/metacontacts.cpp index 876071191a..9896393cbc 100644 --- a/plugins/New_GPG/src/metacontacts.cpp +++ b/plugins/New_GPG/src/metacontacts.cpp @@ -16,67 +16,47 @@  #include "commonheaders.h"
 -extern bool bMetaContacts;
 -
  bool metaIsProtoMetaContacts(MCONTACT hContact)
  {
 -	if(bMetaContacts) {
 -		LPSTR proto = GetContactProto(hContact);
 -		if( proto && strcmp(proto,"MetaContacts")==0 ) {
 -			return true;
 -		}
 -	}
 +	LPSTR proto = GetContactProto(hContact);
 +	if(proto && strcmp(proto,"MetaContacts") == 0)
 +		return true;
 +
  	return false;
  }
  bool metaIsDefaultSubContact(MCONTACT hContact) 
  {
 -	if(bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,hContact,0),0)==hContact;
 -	return false;
 +	return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, db_mc_getMeta(hContact), 0) == hContact;
  }
  MCONTACT metaGetContact(MCONTACT hContact) 
  {
 -	if(bMetaContacts)
 -		if(metaIsSubcontact(hContact))
 -			return (MCONTACT)CallService(MS_MC_GETMETACONTACT,hContact,0);
 +	if(db_mc_isSub(hContact))
 +		return db_mc_getMeta(hContact);
  	return NULL;
  }
 -bool metaIsSubcontact(MCONTACT hContact)
 -{
 -	if(bMetaContacts)
 -		return CallService(MS_MC_GETMETACONTACT,hContact,0) != 0;
 -	return false;
 -}
 -
  MCONTACT metaGetMostOnline(MCONTACT hContact) 
  {
 -	if(bMetaContacts)
 -		if(metaIsProtoMetaContacts(hContact))
 -			return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT,hContact,0);
 +	if(metaIsProtoMetaContacts(hContact))
 +		return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT,hContact,0);
  	return NULL;
  }
  MCONTACT metaGetDefault(MCONTACT hContact) 
  {
 -	if(bMetaContacts)
 -		if(metaIsProtoMetaContacts(hContact))
 -			return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT,hContact,0);
 +	if(metaIsProtoMetaContacts(hContact))
 +		return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT,hContact,0);
  	return NULL;
  }
  DWORD metaGetContactsNum(MCONTACT hContact)
  {
 -	if(bMetaContacts)
 -		return CallService(MS_MC_GETNUMCONTACTS, hContact, 0);
 -	return 0;
 +	return CallService(MS_MC_GETNUMCONTACTS, hContact, 0);
  }
  MCONTACT metaGetSubcontact(MCONTACT hContact, int num)
  {
 -	if(bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETSUBCONTACT, hContact, (LPARAM)num);
 -	return 0;
 +	return (MCONTACT)CallService(MS_MC_GETSUBCONTACT, hContact, (LPARAM)num);
  }
 diff --git a/plugins/New_GPG/src/metacontacts.h b/plugins/New_GPG/src/metacontacts.h index 396c3bcb43..d908d1e8a8 100644 --- a/plugins/New_GPG/src/metacontacts.h +++ b/plugins/New_GPG/src/metacontacts.h @@ -17,7 +17,6 @@  bool     metaIsProtoMetaContacts(MCONTACT hContact);
  bool     metaIsDefaultSubContact(MCONTACT hContact) ;
  MCONTACT metaGetContact(MCONTACT hContact);
 -bool     metaIsSubcontact(MCONTACT hContact);
  MCONTACT metaGetMostOnline(MCONTACT hContact);
  MCONTACT metaGetDefault(MCONTACT hContact);
  DWORD    metaGetContactsNum(MCONTACT hContact);
 diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index aab34ee826..24c00fd878 100644 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -41,7 +41,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam)  		hMeta = hContact;
  		hContact = metaGetMostOnline(hContact); // возьмем тот, через который пойдет сообщение
  	}
 -	else if(metaIsSubcontact(hContact))
 +	else if(db_mc_isSub(hContact))
  		hMeta = metaGetContact(hContact);
  	StatusIconClickData *sicd = (StatusIconClickData *)lParam;
  	if(strcmp(sicd->szModule, szGPGModuleName)) 
 diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 1c19a70d78..bf6258f156 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -459,12 +459,9 @@ void Nudge_SentStatus(CNudgeElement n, MCONTACT hContact)  	dbei.cbBlob = (DWORD)strlen(buff) + 1;
  	dbei.pBlob = (PBYTE)buff;
 -	INT_PTR res = CallService(MS_MC_GETMETACONTACT, hContact, 0); //try to retrieve the metacontact if some
 -	if (res != CALLSERVICE_NOTFOUND) {
 -		MCONTACT hMetaContact = (MCONTACT)res;
 -		if (hMetaContact != NULL) // metacontact
 -			db_event_add(hMetaContact, &dbei);
 -	}
 +	MCONTACT hMetaContact = db_mc_getMeta(hContact);
 +	if (hMetaContact != NULL) // metacontact
 +		db_event_add(hMetaContact, &dbei);
  	db_event_add(hContact, &dbei);
  	mir_free(buff);
 @@ -482,13 +479,10 @@ void Nudge_ShowStatus(CNudgeElement n, MCONTACT hContact, DWORD timestamp)  	dbei.cbBlob = (DWORD)strlen(buff) + 1;
  	dbei.pBlob = (PBYTE)buff;
 -	INT_PTR res = CallService(MS_MC_GETMETACONTACT, hContact, 0); //try to retrieve the metacontact if some
 -	if (res != CALLSERVICE_NOTFOUND) {
 -		MCONTACT hMetaContact = (MCONTACT)res;
 -		if (hMetaContact != NULL) { //metacontact
 -			db_event_add(hMetaContact, &dbei);
 -			dbei.flags |= DBEF_READ;
 -		}
 +	MCONTACT hMetaContact = db_mc_getMeta(hContact);
 +	if (hMetaContact != NULL) { //metacontact
 +		db_event_add(hMetaContact, &dbei);
 +		dbei.flags |= DBEF_READ;
  	}
  	db_event_add(hContact, &dbei);
 @@ -497,12 +491,9 @@ void Nudge_ShowStatus(CNudgeElement n, MCONTACT hContact, DWORD timestamp)  MCONTACT Nudge_GethContact(MCONTACT hContact)
  {
 -	INT_PTR res = CallService(MS_MC_GETMETACONTACT, hContact, 0);
 -	if (res != CALLSERVICE_NOTFOUND) {
 -		MCONTACT hMetaContact = (MCONTACT)res;
 -		if (hMetaContact != NULL)
 -			return hMetaContact;
 -	}
 +	MCONTACT hMetaContact = db_mc_getMeta(hContact);
 +	if (hMetaContact != NULL)
 +		return hMetaContact;
  	return hContact;
  }
 diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 80c4643996..0708700494 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -203,9 +203,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)  	mi.pszService = MS_QC_SHOW_DIALOG;
  	Menu_AddMainMenuItem(&mi);
 -	if (ServiceExists(MS_MC_GETPROTOCOLNAME) && ServiceExists(MS_MC_GETMETACONTACT))
 -		metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
 -
 +	metacontacts_proto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
  	return 0;
  }
 @@ -366,7 +364,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)  		if (metacontactsEnabled)
  		{
  			if ((!show_all && opts.hide_subcontacts) || opts.group_append)
 -				hMeta = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 +				hMeta = db_mc_getMeta(hContact);
  		}
  		else
  		{
 diff --git a/plugins/QuickSearch/i_ok.inc b/plugins/QuickSearch/i_ok.inc index cb4b161694..da9f138b81 100644 --- a/plugins/QuickSearch/i_ok.inc +++ b/plugins/QuickSearch/i_ok.inc @@ -233,7 +233,7 @@ begin          end
          else if (flags and QSF_SUBMETA)<>0 then
          begin
 -          lparam:=FindMeta(CallService(MS_MC_GETMETACONTACT,hContact,0),wparam);
 +          lparam:=FindMeta(db_mc_getMeta(hContact),wparam);
          end;
          if wparam>0 then
 diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas index d9b83503c9..0b4383fcc2 100644 --- a/plugins/QuickSearch/sr_window.pas +++ b/plugins/QuickSearch/sr_window.pas @@ -56,7 +56,7 @@ type      flags  :dword;
      status :dword;
  //--- Metacontacts only ---
 -    wparam :WPARAM; 
 +    wparam :WPARAM;
      lparam :LPARAM;
    end;
  var
 @@ -399,7 +399,7 @@ begin    begin
      if ListView_GetItemState(grid,i,LVIS_SELECTED)<>0 then
      begin
 -      tmp:=CallService(MS_MC_GETMETACONTACT,FlagBuf[LV_GetLParam(grid,i)].contact,0);
 +      tmp:=db_mc_getMeta(FlagBuf[LV_GetLParam(grid,i)].contact);
        if tmp<>0 then
          if hMeta=0 then
            hMeta:=tmp
 @@ -798,7 +798,7 @@ begin        col:=ListViewToColumn(col);
        if (qsopt.columns[col].setting_type=QST_SETTING) and
           // right now, not time or IP
 -         (qsopt.columns[col].datatype<>QSTS_IP) and 
 +         (qsopt.columns[col].datatype<>QSTS_IP) and
           (qsopt.columns[col].datatype<>QSTS_TIMESTAMP) then
        begin
          doit:=true;
 @@ -1388,7 +1388,7 @@ procedure SetCellColor(lplvcd:PNMLVCUSTOMDRAW;idx:integer);  begin
    if (qsopt.flags and QSO_COLORIZE)<>0 then
    begin
 -    with FlagBuf[idx] do 
 +    with FlagBuf[idx] do
      begin
        if (flags and QSF_ACCDEL)<>0 then
        begin
 @@ -1532,7 +1532,7 @@ var    count,current,next,perpage:integer;
  begin
    result:=0;
 -  case hMessage of 
 +  case hMessage of
      WM_CHAR: if wParam=27 then
      begin
        PostMessage(GetParent(Dialog),WM_COMMAND,(BN_CLICKED shl 16)+IDCANCEL,0);
 diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index db6ee76cd3..459c34a3b9 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -15,7 +15,7 @@ HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1+IEC_CNT*MODE_CNT] = {0};  HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
  int iBmpDepth;
 -BOOL bMetaContacts = false, bPopupExists = false;
 +BOOL bPopupExists = false;
  BOOL bPGPloaded = false, bPGPkeyrings = false, bUseKeyrings = false, bPGPprivkey = false;
  BOOL bGPGloaded = false, bGPGkeyrings = false, bSavePass = false;
  BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
 diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index 6fe89b1c81..c8c9a1fcb3 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -90,7 +90,7 @@ extern int iService, iHook;  extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT];
  extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
  extern int iBmpDepth;
 -extern BOOL bMetaContacts, bPopupExists;
 +extern BOOL bPopupExists;
  extern BOOL bPGPloaded, bPGPkeyrings, bUseKeyrings, bPGPprivkey;
  extern BOOL bGPGloaded, bGPGkeyrings, bSavePass;
  extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
 diff --git a/plugins/SecureIM/src/crypt.h b/plugins/SecureIM/src/crypt.h index e7e9398f69..42bbe51f9b 100644 --- a/plugins/SecureIM/src/crypt.h +++ b/plugins/SecureIM/src/crypt.h @@ -146,7 +146,6 @@ void showPopupRM(MCONTACT);  // crypt_meta.cpp
  BOOL isProtoMetaContacts(MCONTACT);
  BOOL isDefaultSubContact(MCONTACT);
 -MCONTACT getMetaContact(MCONTACT);
  MCONTACT getMostOnline(MCONTACT);
  void DeinitMetaContact(MCONTACT);
 diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index 1aa8a4f578..97c3631523 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -64,7 +64,7 @@ HANDLE mode2clicon(int mode, int type)  // обновляет иконки в clist и в messagew
  void ShowStatusIcon(MCONTACT hContact, int mode)
  {
 -	MCONTACT hMC = getMetaContact(hContact);
 +	MCONTACT hMC = db_mc_getMeta(hContact);
  	// обновить иконки в clist
  	if (mode != -1) {
 diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index e99328f1d6..c104044f87 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -2,42 +2,26 @@  BOOL isProtoMetaContacts(MCONTACT hContact)
  {
 -	if (bMetaContacts) {
 -		LPSTR proto = GetContactProto(hContact);
 -		if (proto && !strcmp(proto,"MetaContacts"))
 -			return true;
 -	}
 +	LPSTR proto = GetContactProto(hContact);
 +	if (proto && !strcmp(proto,"MetaContacts"))
 +		return true;
  	return false;
  }
  BOOL isDefaultSubContact(MCONTACT hContact)
  {
 -	if (bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,hContact,0),0) == hContact;
 -
 -	return false;
 -}
 -
 -MCONTACT getMetaContact(MCONTACT hContact)
 -{
 -	if (bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 -
 -	return 0;
 +	return (MCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, db_mc_getMeta(hContact), 0) == hContact;
  }
  MCONTACT getMostOnline(MCONTACT hContact)
  {
 -	if (bMetaContacts)
 -		return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
 -
 -	return 0;
 +	return (MCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, hContact, 0);
  }
  // remove all secureim connections on subcontacts
  void DeinitMetaContact(MCONTACT hContact)
  {
 -	MCONTACT hMetaContact = isProtoMetaContacts(hContact) ? hContact : getMetaContact(hContact);
 +	MCONTACT hMetaContact = isProtoMetaContacts(hContact) ? hContact : db_mc_getMeta(hContact);
   	if (hMetaContact) {
  		for (int i=0; i < CallService(MS_MC_GETNUMCONTACTS,(WPARAM)hMetaContact,0); i++) {
  			MCONTACT hSubContact = (MCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i);
 diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 63f191d663..2822625fbd 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -128,7 +128,6 @@ extern "C" __declspec(dllexport) int __cdecl Unload()  int ModuleLoad(WPARAM, LPARAM)
  {
  	bPopupExists = ServiceExists(MS_POPUP_ADDPOPUP);
 -	bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT);
  	return 0;
  }
 diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 732b3466a3..219aad76c9 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1065,7 +1065,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit)  	for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
  		pUinKey ptr = getUinKey(hContact);
 -		if (ptr && ptr->mode == MODE_PGP && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) {
 +		if (ptr && ptr->mode == MODE_PGP && isSecureProtocol(hContact) && !isChatRoom(hContact)) {
  			LPSTR szKeyID = db_get_sa(hContact,MODULENAME,"pgp_abbr");
  			lvi.iItem++;
 @@ -1125,7 +1125,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit)  	for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
  		pUinKey ptr = getUinKey(hContact);
 -		if (ptr && ptr->mode == MODE_GPG && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) {
 +		if (ptr && ptr->mode == MODE_GPG && isSecureProtocol(hContact) && !isChatRoom(hContact)) {
  			if (iInit )
  				ptr->tgpgMode = ptr->gpgMode;
 diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 028d76c8e7..66013573a2 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -774,16 +774,13 @@ void GetUserLanguageSetting(Dialog *dlg, char *setting)  	if (mc != CALLSERVICE_NOTFOUND) {  		char* metacontacts_proto = (char *) mc;  		if (metacontacts_proto != NULL) { -			mc = CallService(MS_MC_GETMETACONTACT, (WPARAM) dlg->hContact, 0); -			if (mc != CALLSERVICE_NOTFOUND) { -				MCONTACT hMetaContact = (MCONTACT)mc; -				if (hMetaContact != NULL) { -					GetUserProtoLanguageSetting(dlg, hMetaContact, metacontacts_proto, setting); -					if (dlg->lang_name[0] != _T('\0')) -						return; - -					GetUserProtoLanguageSetting(dlg, hMetaContact, "UserInfo", setting, FALSE); -				} +			MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact); +			if (hMetaContact != NULL) { +				GetUserProtoLanguageSetting(dlg, hMetaContact, metacontacts_proto, setting); +				if (dlg->lang_name[0] != _T('\0')) +					return; + +				GetUserProtoLanguageSetting(dlg, hMetaContact, "UserInfo", setting, FALSE);  			}  		}  	} @@ -814,19 +811,16 @@ void GetContactLanguage(Dialog *dlg)  		// Try from metacontact  		if (dlg->lang_name[0] == _T('\0')) { -			INT_PTR mc = CallService(MS_MC_GETMETACONTACT, (WPARAM) dlg->hContact, 0); -			if (mc != CALLSERVICE_NOTFOUND) { -				MCONTACT hMetaContact = (MCONTACT)mc; -				if (hMetaContact != NULL) { -					if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) { -						lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); -						db_free(&dbv); -					} - -					if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) { -						lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); -						db_free(&dbv); -					} +			MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact); +			if (hMetaContact != NULL) { +				if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) { +					lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); +					db_free(&dbv); +				} + +				if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) { +					lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); +					db_free(&dbv);  				}  			}  		} diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index bd4396612d..59e861d446 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -731,7 +731,7 @@ int MAnnivDate::BackupBirthday(MCONTACT hContact, LPSTR pszProto, const BYTE bDo  		if (pszProto) {
  			BYTE bIsMeta = DB::Module::IsMeta(pszProto);
 -			BYTE bIsMetaSub = !bIsMeta && DB::MetaContact::IsSub(hContact);
 +			BYTE bIsMetaSub = !bIsMeta && db_mc_isSub(hContact);
  			MAnnivDate mdbNewProto;
  			MAnnivDate mdbIgnore;
 diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 42e7d3e525..745a82caa7 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -829,7 +829,7 @@ class CAnnivList  		for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
  		{
  			// ignore meta subcontacts here, as they are not interesting.
 -			if (!DB::MetaContact::IsSub(hContact)) {
 +			if (!db_mc_isSub(hContact)) {
  				// filter protocol
  				pszProto = DB::Contact::Proto(hContact);
  				if (pszProto) {
 diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index f5da4c7488..b46b9a635f 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -1350,7 +1350,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar  			if (hContact != pPs->hContact) {
  				if (!myGlobals.szMetaProto)
  					break;
 -				if (pPs->hContact != (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, NULL))
 +				if (pPs->hContact != db_mc_getMeta(hContact))
  					break;
  				if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE))
  					break;
 diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 67681553b8..74cfe49000 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -242,7 +242,7 @@ MCONTACT CExImContactBase::toDB()  			return _hContact = INVALID_CONTACT_ID;
  		}
  		// Add the protocol to the new contact
 -		if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)_hContact, (LPARAM)_pszProto)) {
 +		if (CallService(MS_PROTO_ADDTOCONTACT, _hContact, (LPARAM)_pszProto)) {
  			DB::Contact::Delete(_hContact);
  			return _hContact = INVALID_CONTACT_ID;
  		}
 diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index de9db38883..a71efbfa07 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -511,7 +511,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact)  			if (vSub = xSub) {
  				// identify metacontact by the first valid subcontact in xmlfile
  				if (_hContact == INVALID_CONTACT_ID && vSub.handle() != INVALID_CONTACT_ID) {
 -					MCONTACT hMeta = (MCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)vSub.handle(), NULL);
 +					MCONTACT hMeta = db_mc_getMeta(vSub.handle());
  					if (hMeta != NULL) {
  						_hContact = hMeta;
  						break;
 @@ -636,7 +636,7 @@ int CExImContactXML::ImportNormalContact()  	int err = ImportContact();
  	// remove contact from a metacontact
 -	if (err == ERROR_OK && CallService(MS_MC_GETMETACONTACT, (WPARAM)_hContact, NULL))
 +	if (err == ERROR_OK && db_mc_getMeta(_hContact))
  		CallService(MS_MC_REMOVEFROMMETA, NULL, (LPARAM)_hContact);
  	return err;
 @@ -736,9 +736,9 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact)  		return err;
  	// check if contact is subcontact of the desired meta contact
 -	if ((MCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)_hContact, NULL) != pMetaContact->handle()) {
 +	if (db_mc_getMeta(_hContact) != pMetaContact->handle()) {
  		// add contact to the metacontact (this service returns TRUE if successful)	
 -		err = CallService(MS_MC_ADDTOMETA, (WPARAM)_hContact, (LPARAM)pMetaContact->handle());
 +		err = CallService(MS_MC_ADDTOMETA, _hContact, (LPARAM)pMetaContact->handle());
  		if (err == FALSE) {
  			// ask to delete new contact
  			if (_isNewContact && _hContact != NULL) {
 diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 6a5f9154dc..ed8c032472 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -158,7 +158,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)  					case EXIM_ALL:
  					case EXIM_GROUP:
  						// dont export meta subcontacts by default
 -						if (!DB::MetaContact::IsSub(hContact)) {
 +						if (!db_mc_isSub(hContact)) {
  							if (vContact.fromDB(hContact)) {
  								vContact.Export(xmlfile, &Modules);
  							}
 @@ -167,7 +167,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)  					case EXIM_SUBGROUP:
  						// dont export meta subcontacts by default and
  						// export only contact with selectet group name
 -						if (!DB::MetaContact::IsSub(hContact) && 
 +						if (!db_mc_isSub(hContact) && 
  							mir_tcsncmp(ExImContact->ptszName, DB::Setting::GetTString(hContact, "CList", "Group"), mir_tcslen(ExImContact->ptszName))== 0)
  							{
  							if (vContact.fromDB(hContact)) {
 diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 48cc65751d..d759ebaf9b 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -46,18 +46,12 @@ MCONTACT Sub(MCONTACT hMetaContact, int idx)  	return NULL;
  }
 -bool IsSub(MCONTACT hContact)
 -{
 -	return db_mc_isSub(hContact);
 -}
 -
  MCONTACT GetMeta(MCONTACT hContact)
  {
  	if (!myGlobals.szMetaProto)
  		return NULL;
 -	MCONTACT result = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 -	return (result == (MCONTACT)CALLSERVICE_NOTFOUND) ? NULL : result;
 +	return db_mc_getMeta(hContact);
  }
  } /* namespace MetaContact */
 diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index 9d850c0006..ae6ec11c25 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -28,7 +28,6 @@ namespace MetaContact{  	INT_PTR  SubDefNum(MCONTACT hMetaContact);
  	MCONTACT Sub(MCONTACT hMetaContact, int idx);
 -	bool     IsSub(MCONTACT hContact);
  	MCONTACT GetMeta(MCONTACT hContact);
  } /* namespace MetaContact */
 diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 491a26685a..c22b9089c1 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -537,9 +537,7 @@ static BYTE CheckBirthday(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNoti  static void CheckContact(MCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = 0)
  {
  	// ignore meta subcontacts here as their birthday information are collected explicitly
 -	if (hContact &&
 -			(!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) &&
 -			(!DB::MetaContact::IsSub(hContact)))
 +	if (hContact && (!gRemindOpts.bCheckVisibleOnly || !db_get_b(hContact, MOD_CLIST, "Hidden", FALSE)) && !db_mc_isSub(hContact))
  	{
  		CEvent ca;
 @@ -738,7 +736,7 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam)  		//walk through all the contacts stored in the DB
  		for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
 -			if (!DB::MetaContact::IsSub(hContact) && !mdb.DBGetBirthDate(hContact))
 +			if (!db_mc_isSub(hContact) && !mdb.DBGetBirthDate(hContact))
  				mdb.BackupBirthday(hContact, NULL, TRUE, &a1);
  	}
 diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index ea35e86e51..bafb5b8a15 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -719,15 +719,12 @@ begin      if (result=0) and (DBReadByte(hContact,strCList,'Hidden',0)=0) then
      begin
        result:=255;
 -      if ServiceExists(MS_MC_GETMETACONTACT)<>0 then
 -      begin
 -        if CallService(MS_MC_GETMETACONTACT,hContact,0)<>0 then
 -          result:=2;
 -        if StrCmp(
 -           PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)),
 -           PAnsiChar(CallService(MS_MC_GETPROTOCOLNAME,0,0)))=0 then
 -         result:=1;
 -      end;
 +      if db_mc_getMeta(hContact)<>0 then
 +        result:=2;
 +      if StrCmp(
 +         PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)),
 +         PAnsiChar(CallService(MS_MC_GETPROTOCOLNAME,0,0)))=0 then
 +        result:=1;
      end;
      if proto<>nil then
        StrCopy(proto,@name);
 diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index e97447f967..f47600aa5e 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -40,7 +40,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)  		return NULL;
  	}
 -	hContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 +	hContact = db_mc_getMeta(hContact);
  	if (hContact == NULL)
  		return NULL;
 diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index ccf8737629..3fb1dbf078 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -70,7 +70,7 @@ int EnablePopupsGroup(HWND hWnd, int enable)  	EnableWindow(GetDlgItem(hWnd, IDC_FOREGROUND), enable);
  	EnableWindow(GetDlgItem(hWnd, IDC_BACKGROUND), enable);
  	EnableWindow(GetDlgItem(hWnd, IDC_NOBIRTHDAYS_POPUP), enable);
 -	EnableWindow(GetDlgItem(hWnd, IDC_IGNORE_SUBCONTACTS), (ServiceExists(MS_MC_GETMETACONTACT)) ? enable : FALSE);
 +	EnableWindow(GetDlgItem(hWnd, IDC_IGNORE_SUBCONTACTS), enable);
  	EnableWindow(GetDlgItem(hWnd, IDC_PREVIEW), enable);
  	EnableWindow(GetDlgItem(hWnd, IDC_LEFT_CLICK), enable);
  	EnableWindow(GetDlgItem(hWnd, IDC_RIGHT_CLICK), enable);
 diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index f6282045a3..83eb7c9c30 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -67,8 +67,8 @@ TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size)  int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
  {
  	if (commonData.bIgnoreSubcontacts) {
 -		MCONTACT hMetacontact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 -		if ((hMetacontact) && (hMetacontact != hContact)) //not main metacontact
 +		MCONTACT hMetacontact = db_mc_getMeta(hContact);
 +		if (hMetacontact && hMetacontact != hContact) //not main metacontact
  			return 0;
  	}
 @@ -110,7 +110,7 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)  int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
  {
  	if (commonData.bIgnoreSubcontacts) {
 -		MCONTACT hMetacontact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 +		MCONTACT hMetacontact = db_mc_getMeta(hContact);
  		if (hMetacontact && hMetacontact != hContact) //not main metacontact
  			return 0;
  	}
 diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 18a652801f..d370429c57 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -1222,7 +1222,7 @@ bool MSN_MsgWndExist(MCONTACT hContact)  	bool res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
  	res = res || msgWinData.hwndWindow;
  	if (res) {
 -		msgWinInData.hContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, hContact, 0);
 +		msgWinInData.hContact = db_mc_getMeta(hContact);
  		if (msgWinInData.hContact != NULL) {
  			res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
  			res |= (msgWinData.hwndWindow == NULL);
 diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 2880f4102a..3cc41e1113 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1443,8 +1443,8 @@ MCONTACT GetCallerContact(char *szSkypeMsg)  MCONTACT GetMetaHandle(DWORD dwId)
  {
  	for (MCONTACT hContact=db_find_first(); hContact != NULL; hContact=db_find_next(hContact)) {
 -		char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, hContact, 0 );
 -		if (szProto!=NULL && !strcmp(szProto, "MetaContacts") &&
 +		char *szProto = GetContactProto(hContact);
 +		if (szProto != NULL && !strcmp(szProto, "MetaContacts") &&
  			db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD)==dwId)
  			return hContact;
  	}      
 diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 2652278143..dafa2b2d93 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -325,8 +325,7 @@ MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent)  MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact)
  {
 -	if (currDb == NULL)
 -		return false;
 +	if (currDb == NULL) return false;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
  	return (cc == NULL) ? false : cc->nSubs != -1;
 @@ -334,13 +333,21 @@ MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact)  MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact)
  {
 -	if (currDb == NULL)
 -		return false;
 +	if (currDb == NULL) return false;
  	DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
  	return (cc == NULL) ? false : cc->parentID != INVALID_CONTACT_ID;
  }
 +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
 diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 5ff1a5efb5..6f8d466469 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -250,3 +250,4 @@ db_get_wstatic                @247  db_get_static_utf             @248
  db_mc_isMeta                  @249
  db_mc_isSub                   @250
 +db_mc_getMeta                 @251
 diff --git a/src/modules/metacontacts/meta_api.cpp b/src/modules/metacontacts/meta_api.cpp index 7cf4261617..66760b2442 100644 --- a/src/modules/metacontacts/meta_api.cpp +++ b/src/modules/metacontacts/meta_api.cpp @@ -24,14 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  #include "metacontacts.h"
 -//get the handle for a contact's parent metacontact
 -//wParam=(HANDLE)hSubContact
 -//lParam=0
 -//returns a handle to the parent metacontact, or null if this contact is not a subcontact
 -INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam) {
 -	return (INT_PTR)(HANDLE)db_get_dw(wParam, META_PROTO, "Handle", 0);
 -}
 -
  //gets the handle for the default contact
  //wParam=(HANDLE)hMetaContact
  //lParam=0
 diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index 7d6bd1228e..73b65cea79 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -1213,7 +1213,6 @@ void Meta_InitServices()  	CreateProtoServiceFunction(META_FILTER, PSS_MESSAGE, MetaFilter_SendMessage);
  	// API services and events
 -	CreateServiceFunction(MS_MC_GETMETACONTACT, MetaAPI_GetMeta);
  	CreateServiceFunction(MS_MC_GETDEFAULTCONTACT, MetaAPI_GetDefault);
  	CreateServiceFunction(MS_MC_GETDEFAULTCONTACTNUM, MetaAPI_GetDefaultNum);
  	CreateServiceFunction(MS_MC_GETMOSTONLINECONTACT, MetaAPI_GetMostOnline);
  | 
