diff options
23 files changed, 92 insertions, 207 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 56d7f7db8d..c9e220b219 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 3a2e54ddc6..4611781acd 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 3788b87334..2821d6c39a 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -570,8 +570,8 @@ LBL_Def:  			if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) {
  				p = cfg::getCache(hContact, szProto);
  				if (!dat->bisEmbedded && szProto) {				// may be a subcontact, forward the xstatus
 -					MCONTACT hMasterContact = db_mc_getMeta(hContact);
 -					if (hMasterContact && hMasterContact != hContact)				// avoid recursive call of settings handler
 +					MCONTACT hMasterContact = db_mc_tryMeta(hContact);
 +					if (hMasterContact != hContact)				// avoid recursive call of settings handler
  						cfg::writeByte(hMasterContact, META_PROTO, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0));
  					break;
  				}
 diff --git a/plugins/HistoryStats/src/mirandahistory.cpp b/plugins/HistoryStats/src/mirandahistory.cpp index 60c4df0ba0..656ce08870 100644 --- a/plugins/HistoryStats/src/mirandahistory.cpp +++ b/plugins/HistoryStats/src/mirandahistory.cpp @@ -118,7 +118,7 @@ void MirandaHistory::readContacts()  				}
  				else {
  					// ignore because of meta-contact?
 -					if (db_mc_getMeta(hContact))
 +					if (db_mc_isMeta(hContact))
  						break;
  				}
  			}
 diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 4cdd3c4296..2ae86f175b 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -589,7 +589,7 @@ void CAppletManager::HandleEvent(CEvent *pEvent)  	}
  	pEvent->bLog = pEvent->bNotification;
 -	if(CAppletManager::IsSubContact(pEvent->hContact))
 +	if(db_mc_isSub(pEvent->hContact))
  	{
  		pEvent->bLog = false;
  		pEvent->bNotification = false;
 @@ -756,16 +756,6 @@ void CAppletManager::CancelMessageJob(SMessageJob *pJob)  }
  //************************************************************************
 -// returns wether or not a contact is a subcontact
 -//************************************************************************
 -bool CAppletManager::IsSubContact(MCONTACT hContact)
 -{
 -	if(!db_get_b(0, "MetaContacts", "Enabled", 1))
 -		return false;
 -	return db_mc_isSub(hContact) != 0;
 -}
 -
 -//************************************************************************
  // sends typing notifications to the specified contact
  //************************************************************************
  void CAppletManager::SendTypingNotification(MCONTACT hContact,bool bEnable)
 diff --git a/plugins/MirandaG15/src/CAppletManager.h b/plugins/MirandaG15/src/CAppletManager.h index 13efb58c5d..e95a063cb8 100644 --- a/plugins/MirandaG15/src/CAppletManager.h +++ b/plugins/MirandaG15/src/CAppletManager.h @@ -89,8 +89,6 @@ public:  	// returns a formatted timestamp string
  	static tstring GetFormattedTimestamp(tm *time);
 -	// returns wether or not a contact is a subcontact
 -	static bool IsSubContact(MCONTACT hContact);
  	// returns the contacts group
  	static tstring GetContactGroup(MCONTACT hContact);
  	// returns the contacts displayname
 diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 904090ddd8..3f951be342 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -81,7 +81,7 @@ CContactListEntry *CContactList::GetContactData(CListEntry<CContactListEntry*,CC  tstring CContactList::GetContactGroupPath(MCONTACT hContact)
  {
  	tstring strGroup = _T("");
 -	if(db_get_b(0, "MetaContacts", "Enabled", 1) && CAppletManager::IsSubContact(hContact))
 +	if(db_get_b(0, "MetaContacts", "Enabled", 1) && db_mc_isSub(hContact))
  	{
  		MCONTACT hMetaContact = db_mc_getMeta(hContact);
  		if(CConfig::GetBoolSetting(CLIST_USEGROUPS))
 @@ -159,7 +159,7 @@ void CContactList::AddContact(MCONTACT hContact)  		}
  		return;
  	}
 -	else if(CAppletManager::IsSubContact(hContact)) {
 +	else if(db_mc_isSub(hContact)) {
  		MCONTACT hMetaContact = db_mc_getMeta(hContact);
  		// check that the metacontact exists
  		if(!FindContact(hMetaContact))
 @@ -167,7 +167,7 @@ void CContactList::AddContact(MCONTACT hContact)  	}
  	CListItem<CContactListEntry*,CContactListGroup*> *pItem = NULL;
 -	if((!CAppletManager::IsSubContact(hContact) && !CConfig::GetBoolSetting(CLIST_USEGROUPS)) || strGroup.empty())
 +	if((!db_mc_isSub(hContact) && !CConfig::GetBoolSetting(CLIST_USEGROUPS)) || strGroup.empty())
  	{
  		pItem = AddItem(psContact);
  		((CListContainer<CContactListEntry*,CContactListGroup*>*)this)->sort(CContactList::CompareEntries);
 @@ -180,7 +180,7 @@ void CContactList::AddContact(MCONTACT hContact)  		}
  		pItem = pGroup->AddItem(psContact);
 -		if(!CAppletManager::IsSubContact(hContact) && iStatus != ID_STATUS_OFFLINE)
 +		if(!db_mc_isSub(hContact) && iStatus != ID_STATUS_OFFLINE)
  			ChangeGroupObjectCounters(pGroup->GetGroupData()->strPath,0,1);
  		pGroup->sort(CContactList::CompareEntries);
 @@ -220,7 +220,7 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) {  		if(db_get_b(pEntry->hHandle,"CList","Hidden",0))
  			return false;
 -		if(CAppletManager::IsSubContact(pEntry->hHandle)) {
 +		if(db_mc_isSub(pEntry->hHandle)) {
  			MCONTACT hMetaContact = db_mc_getMeta(pEntry->hHandle);
  			if(db_get_b(hMetaContact,"CList","Hidden",0))
  				return false;
 @@ -266,10 +266,10 @@ void CContactList::RemoveContact(MCONTACT hContact) {  		// Update the contacts group if it has one
  		if(pGroup->GetType() != ROOT)
  		{
 -			if(!CAppletManager::IsSubContact(hContact) && pEntry->iStatus != ID_STATUS_OFFLINE)
 +			if(!db_mc_isSub(hContact) && pEntry->iStatus != ID_STATUS_OFFLINE)
  				ChangeGroupObjectCounters(pGroup->GetGroupData()->strPath,0,-1);
 -			if(!CAppletManager::IsSubContact(hContact) && pEntry->iMessages > 0)
 +			if(!db_mc_isSub(hContact) && pEntry->iMessages > 0)
  				ChangeGroupObjectCounters(pGroup->GetGroupData()->strPath,0,0,-pEntry->iMessages);
  		}
 @@ -739,10 +739,10 @@ void CContactList::OnStatusChange(MCONTACT hContact,int iStatus)  	CListContainer<CContactListEntry*,CContactListGroup*>* pGroup = ((CListContainer<CContactListEntry*,CContactListGroup*>*)pContactEntry->GetParent());
  	if(pGroup->GetType() != ROOT)
  	{
 -		if(!CAppletManager::IsSubContact(hContact) && iStatus == ID_STATUS_OFFLINE && iOldStatus != ID_STATUS_OFFLINE)
 +		if(!db_mc_isSub(hContact) && iStatus == ID_STATUS_OFFLINE && iOldStatus != ID_STATUS_OFFLINE)
  			ChangeGroupObjectCounters(pGroup->GetGroupData()->strPath,0,-1);
 -		else if(!CAppletManager::IsSubContact(hContact) && iStatus != ID_STATUS_OFFLINE && iOldStatus == ID_STATUS_OFFLINE)
 +		else if(!db_mc_isSub(hContact) && iStatus != ID_STATUS_OFFLINE && iOldStatus == ID_STATUS_OFFLINE)
  			ChangeGroupObjectCounters(pGroup->GetGroupData()->strPath,0,1);
  	}
 @@ -796,7 +796,7 @@ void CContactList::OnContactAdded(MCONTACT hContact)  		if(!pGroup)
  			pGroup = CreateGroupObjectByPath(strGroup);
 -		if(!CAppletManager::IsSubContact(hContact))
 +		if(!db_mc_isSub(hContact))
  			ChangeGroupObjectCounters(strGroup,1);
  	}
  }
 @@ -817,7 +817,7 @@ void CContactList::OnContactDeleted(MCONTACT hContact)  		CContactListGroup *pGroup = GetGroupObjectByPath(strGroup);
 -		if(!CAppletManager::IsSubContact(hContact))
 +		if(!db_mc_isSub(hContact))
  			ChangeGroupObjectCounters(strGroup,-1);
  		if(pGroup->iMembers <= 0)
 @@ -851,7 +851,7 @@ void CContactList::OnContactGroupChanged(MCONTACT hContact,tstring strGroup)  	if(pContainer->GetType() != ROOT)
  	{
  		pOldGroup = pContainer->GetGroupData();
 -		if(!CAppletManager::IsSubContact(hContact))
 +		if(!db_mc_isSub(hContact))
  			ChangeGroupObjectCounters(pOldGroup->strPath,-1);
  	}
 @@ -861,7 +861,7 @@ void CContactList::OnContactGroupChanged(MCONTACT hContact,tstring strGroup)  		CContactListGroup *pGroup = GetGroupObjectByPath(strGroup);
  		if(!pGroup)
  			pGroup = CreateGroupObjectByPath(strGroup);
 -		if(!CAppletManager::IsSubContact(hContact))
 +		if(!db_mc_isSub(hContact))
  			ChangeGroupObjectCounters(strGroup,1);
  	}
 @@ -1043,7 +1043,7 @@ void CContactList::InitializeGroupObjects()  				pGroup = CreateGroupObjectByPath(strGroup);
  			// update it's counters
 -			if(!CAppletManager::IsSubContact(hContact))
 +			if(!db_mc_isSub(hContact))
  				ChangeGroupObjectCounters(strGroup,1);
  		}
 diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index dffaad03bd..71493e49f2 100644 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -48,26 +48,18 @@ void setClistIcon(MCONTACT hContact)  {
  	bool enabled = isContactSecured(hContact);
  	extern HANDLE g_hCLIcon;
 -	MCONTACT hMC = hContact;
 -	if(db_mc_isSub(hContact))
 -		hMC = db_mc_getMeta(hContact);
 -	else if(metaIsProtoMetaContacts(hContact))
 -		hMC = db_mc_getMeta(hContact);
 +	MCONTACT hMC = db_mc_tryMeta(hContact);
  	const char *szIconId = (enabled) ? "secured" : NULL;
  	ExtraIcon_SetIcon(g_hCLIcon, hContact, szIconId);
 -	if(hMC)
 +	if(hMC != hContact)
  		ExtraIcon_SetIcon(g_hCLIcon, hMC, szIconId);
  }
  void setSrmmIcon(MCONTACT h)
  {
 -	MCONTACT hContact = metaIsProtoMetaContacts(h) ? metaGetMostOnline(h) : h;
 +	MCONTACT hContact = db_mc_isMeta(h) ? metaGetMostOnline(h) : h;
  	bool enabled = isContactSecured(hContact);	
 -	MCONTACT hMC = NULL;
 -	if(db_mc_isSub(hContact))
 -		hMC = db_mc_getMeta(hContact);
 -	else if(metaIsProtoMetaContacts(hContact))
 -		hMC = db_mc_getMeta(hContact);
 +	MCONTACT hMC = db_mc_tryMeta(hContact);
  	StatusIconData sid = { sizeof(sid) };
  	sid.szModule = szGPGModuleName;
 @@ -75,14 +67,14 @@ void setSrmmIcon(MCONTACT h)  	sid.dwId = 1;
  	sid.flags = enabled ? 0 : MBF_HIDDEN;
  	Srmm_ModifyIcon(hContact, &sid);
 -	if(hMC)
 +	if(hMC != hContact)
  		Srmm_ModifyIcon(hMC, &sid);
  	sid.hIcon = IconLibGetIcon("unsecured");
  	sid.dwId = 2;
  	sid.flags = enabled ? MBF_HIDDEN : 0;
  	Srmm_ModifyIcon(hContact, &sid);
 -	if(hMC)
 +	if(hMC != hContact)
  		Srmm_ModifyIcon(hMC, &sid);
  }
 diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 49651b7fb8..97ba1eabe9 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -2271,11 +2271,10 @@ void ImportKey()  	MCONTACT hContact = new_key_hcnt;  	new_key_hcnt_mutex.unlock();  	bool for_all_sub = false; -	if(metaIsProtoMetaContacts(hContact)) +	if(db_mc_isMeta(hContact)) {  		if(MessageBox(0, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES)  			for_all_sub = true; -	if(metaIsProtoMetaContacts(hContact)) -	{ +  		if(for_all_sub)  		{  			int count = db_mc_getSubCount(hContact); @@ -2286,11 +2285,10 @@ void ImportKey()  					db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", new_key.c_str());  			}  		} -		else -			db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str()); +		else db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str());  	} -	else -		db_set_ts(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str()); +	else db_set_ts(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str()); +  	new_key.clear();  	{ //gpg execute block  		std::vector<wstring> cmd; @@ -2306,7 +2304,7 @@ void ImportKey()  			_tcscat(tmp2, _T("temporary_exported.asc"));  			boost::filesystem::remove(tmp2);  			wfstream f(tmp2, std::ios::out); -			if(metaIsProtoMetaContacts(hContact)) +			if(db_mc_isMeta(hContact))  				ptmp = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", _T(""));  			else  				ptmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); @@ -2328,7 +2326,7 @@ void ImportKey()  		if(result == pxNotFound)  			return;  		{ -			if(metaIsProtoMetaContacts(hContact)) +			if(db_mc_isMeta(hContact))  			{  				if(for_all_sub)  				{ diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index dd05955bf6..fbc4f428ed 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -50,20 +50,19 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags  					}  					else  					{ -						db_set_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); +						db_set_b(db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1);  						setSrmmIcon(hContact);  						setClistIcon(hContact);  					}  					if(isContactHaveKey(hContact))  					{ -						db_set_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); +						db_set_b(db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1);  						setSrmmIcon(hContact);  						setClistIcon(hContact);  					}  				}  				else if(MessageBox(0, TranslateT("Do you want to try to decrypt encrypted message?"), TranslateT("Warning"), MB_YESNO) == IDNO)  				{ -					  					HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags));  					return;  				} @@ -95,7 +94,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags  				std::vector<wstring> cmd;  				cmd.push_back(L"--batch");  				{ -					char *inkeyid = UniGetContactSettingUtf(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", ""); +					char *inkeyid = UniGetContactSettingUtf(db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", "");  					TCHAR *pass = NULL;  					if(inkeyid[0])  					{ @@ -190,7 +189,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags  						s = out.find(" ID ", s);  						s += strlen(" ID ");  						string::size_type s2 = out.find(",",s); -						db_set_s(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); +						db_set_s(db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());  					}  					void ShowLoadKeyPasswordWindow();  					new_key_hcnt_mutex.lock(); @@ -319,14 +318,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags  							str.insert(0, inopentag);  							str.append(inclosetag);  						} -						if(db_mc_isSub(hContact)) -						{ -							char *msg = mir_strdup(toUTF8(str).c_str()); -							HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags|DBEF_READ)); -							HistoryLog(db_mc_getMeta(hContact), db_event(msg, timestamp, 0, dbflags)); -							mir_free(msg); -							return; -						} +  						char *tmp = mir_strdup(toUTF8(str).c_str());  						HistoryLog(hContact, db_event(tmp, timestamp, 0, dbflags));  						mir_free(tmp); @@ -336,14 +328,8 @@ 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(db_get_b(db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0))  	{ -		if(db_mc_isSub(hContact)) -		{ -			HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags|DBEF_READ)); -			HistoryLog(db_mc_getMeta(hContact), db_event(msg, timestamp, 0, dbflags)); -			return; -		}  		HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags|DBEF_READ));  		return;  	} @@ -363,7 +349,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)  	if (!msg)  		return CallService(MS_PROTO_CHAINRECV, w, l);  	DWORD dbflags = DBEF_UTF; -	if(metaIsProtoMetaContacts(ccs->hContact)) +	if(db_mc_isMeta(ccs->hContact))  	{  		if(!strstr(msg, "-----BEGIN PGP MESSAGE-----"))  			return CallService(MS_PROTO_CHAINRECV, w, l); @@ -491,7 +477,6 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)  					{  						setSrmmIcon(db_mc_getMeta(ccs->hContact));  						setClistIcon(db_mc_getMeta(ccs->hContact)); -						HistoryLog(db_mc_getMeta(ccs->hContact), "PGP Encryption turned on by key autoexchange feature");  					}  					HistoryLog(ccs->hContact, "PGP Encryption turned on by key autoexchange feature");  				} @@ -623,8 +608,6 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)  	{  		mir_free(tmp);  		HistoryLog(hContact, db_event("Failed to encrypt message with GPG (not found key for encryption in db)", 0,0, DBEF_SENT)); -//		hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG (not found key for encryption in db)"); -		//mir_free(msg);  		CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg);  		return;  	} @@ -754,10 +737,8 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)  	if(str.empty())  	{  		HistoryLog(hContact, db_event("Failed to encrypt message with GPG", 0,0, DBEF_SENT)); -//		hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG");  		if(bDebugLog)  			debuglog<<std::string(time_str()+": info: Failed to encrypt message with GPG"); -		//mir_free(msg);  		CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)msg);  		return;  	} @@ -767,26 +748,14 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)  		str_event.insert(0, toUTF8(outopentag));  		str_event.append(toUTF8(outclosetag));  	} -	/*if(db_mc_isSub(hContact)) -	{ -		hcontact_data[db_mc_getMeta(hContact)].msgs_to_pass.push_back(str_event); -		if(bDebugLog) -		{ -			debuglog<<std::string(time_str() + toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)) +"is subcontact of" + toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)db_mc_getMeta(hContact), GCDNF_TCHAR))); -			debuglog<<std::string(time_str()+": adding event to metacontact: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)db_mc_getMeta(hContact), GCDNF_TCHAR))+" on send message."); -		} -		HistoryLog(db_mc_getMeta(hContact), db_event((char*)str_event.c_str(), 0,0, DBEF_SENT|dbflags)); -	}*/  //unneeded ? -//	hcontact_data[hContact].msgs_to_pass.push_back(str_event); +  	if(bDebugLog)  		debuglog<<std::string(time_str()+": adding event to contact: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" on send message."); -	//HistoryLog(hContact, db_event((char*)str_event.c_str(), 0,0, dbflags|DBEF_SENT)); +  	if(!(flags & PREF_UTF))  		flags |= PREF_UTF;   	fix_line_term(str);  	sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)toUTF8(str).c_str())); -	//mir_free(msg); -	return;  }  INT_PTR SendMsgSvc(WPARAM w, LPARAM l) @@ -816,9 +785,9 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l)  	}  	if(bDebugLog)  		debuglog<<std::string(time_str()+": info: contact have key, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR))); -	if(bDebugLog && metaIsProtoMetaContacts(ccs->hContact)) +	if(bDebugLog && db_mc_isMeta(ccs->hContact))  		debuglog<<std::string(time_str()+": info: protocol is metacontacts, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR))); -	if(!isContactSecured(ccs->hContact) || metaIsProtoMetaContacts(ccs->hContact)) +	if(!isContactSecured(ccs->hContact) || db_mc_isMeta(ccs->hContact))  	{  		if(bDebugLog)  			debuglog<<std::string(time_str()+": info: contact not secured, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR))); @@ -854,7 +823,7 @@ int HookSendMsg(WPARAM w, LPARAM l)  			return 1;  		}  	} -	if(metaIsProtoMetaContacts(hContact)) +	if(db_mc_isMeta(hContact))  		return 0;  	if(!isContactHaveKey(hContact)) @@ -986,7 +955,7 @@ int HookSendMsg(WPARAM w, LPARAM l)  			debuglog<<std::string(time_str()+": event message: \""+(char*)dbei->pBlob+"\" passed event filter, contact "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" is unsecured");  		return 0;  	} -	if(!(dbei->flags & DBEF_SENT) && metaIsProtoMetaContacts((MCONTACT)w)) +	if(!(dbei->flags & DBEF_SENT) && db_mc_isMeta((MCONTACT)w))  	{  		char tmp[29];  		strncpy(tmp, (char*)dbei->pBlob, 27); diff --git a/plugins/New_GPG/src/metacontacts.cpp b/plugins/New_GPG/src/metacontacts.cpp index 7db1725be3..5a7fa5a031 100644 --- a/plugins/New_GPG/src/metacontacts.cpp +++ b/plugins/New_GPG/src/metacontacts.cpp @@ -16,15 +16,6 @@  #include "commonheaders.h"
 -bool metaIsProtoMetaContacts(MCONTACT hContact)
 -{
 -	LPSTR proto = GetContactProto(hContact);
 -	if(proto && strcmp(proto,"MetaContacts") == 0)
 -		return true;
 -
 -	return false;
 -}
 -
  bool metaIsDefaultSubContact(MCONTACT hContact) 
  {
  	return db_mc_getDefault(db_mc_getMeta(hContact)) == hContact;
 @@ -32,7 +23,7 @@ bool metaIsDefaultSubContact(MCONTACT hContact)  MCONTACT metaGetMostOnline(MCONTACT hContact) 
  {
 -	if(metaIsProtoMetaContacts(hContact))
 +	if(db_mc_isMeta(hContact))
  		return db_mc_getMostOnline(hContact);
  	return NULL;
  }
 diff --git a/plugins/New_GPG/src/metacontacts.h b/plugins/New_GPG/src/metacontacts.h index 4e43860c57..c0d2dd2b3b 100644 --- a/plugins/New_GPG/src/metacontacts.h +++ b/plugins/New_GPG/src/metacontacts.h @@ -14,7 +14,6 @@  // along with this program; if not, write to the Free Software
  // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -bool     metaIsProtoMetaContacts(MCONTACT hContact);
  bool     metaIsDefaultSubContact(MCONTACT hContact) ;
  MCONTACT metaGetMostOnline(MCONTACT hContact);
 diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index a8f5ff9193..8490ca1fd1 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -202,7 +202,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP  			  bool ismetacontact = false;
  			  MCONTACT meta = NULL;
  			  MCONTACT hContact = user_data[item_num+1];
 -			  if(metaIsProtoMetaContacts(hContact))
 +			  if(db_mc_isMeta(hContact))
  			  {
  				  meta = hContact;
  				  hContact = metaGetMostOnline(hContact);
 @@ -729,9 +729,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  			hContact = user_data[1];
  			SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
  			mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), editctrl_ctrl_a);
 -			MCONTACT hcnt = hContact;
 -			if(metaIsProtoMetaContacts(hcnt))
 -				hcnt = metaGetMostOnline(hcnt);
 +			MCONTACT hcnt = db_mc_tryMeta(hContact);
  			TranslateDialogDefault(hwndDlg);
  			{
  				wstring msg = TranslateT("Load Public GPG Key for ");
 @@ -875,7 +873,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  					ws2 += _tcslen(end);
  					bool allsubcontacts = false;
  					{
 -						if(metaIsProtoMetaContacts(hContact))
 +						if(db_mc_isMeta(hContact))
  						{
  							if(MessageBox(0, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES)
  							{
 @@ -888,11 +886,9 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  										db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
  								}
  							}
 -							else
 -								db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
 +							else db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
  						}
 -						else
 -							db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
 +						else db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
  					}
  					tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1));
  					_tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str());
 @@ -903,9 +899,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  						string output;
  						DWORD exitcode;
  						{
 -							MCONTACT hcnt = hContact;
 -							if(metaIsProtoMetaContacts(hcnt))
 -								hcnt = metaGetMostOnline(hcnt);
 +							MCONTACT hcnt = db_mc_tryMeta(hContact);
  							ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
  							_tcscpy(tmp2, ptmp);
  							mir_free(ptmp);
 @@ -940,7 +934,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  						mir_free(end);
  						if(hContact)
  						{
 -							if(metaIsProtoMetaContacts(hContact))
 +							if(db_mc_isMeta(hContact))
  							{
  								if(allsubcontacts)
  								{
 @@ -971,7 +965,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  							strcpy(tmp2, output.substr(s,s2-s).c_str());
  							mir_utf8decode(tmp2, 0);
  							{
 -								if(metaIsProtoMetaContacts(hContact))
 +								if(db_mc_isMeta(hContact))
  								{
  									if(allsubcontacts)
  									{
 @@ -1020,7 +1014,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  								mir_utf8decode(tmp2, 0);
  								if(hContact)
  								{
 -									if(metaIsProtoMetaContacts(hContact))
 +									if(db_mc_isMeta(hContact))
  									{
  										if(allsubcontacts)
  										{
 @@ -1032,11 +1026,9 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  													db_set_s(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
  											}
  										}
 -										else
 -											db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
 +										else db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
  									}
 -									else
 -										db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
 +									else db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
  								}
  								mir_free(tmp2);
  								tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str());
 @@ -1057,7 +1049,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  										mir_utf8decode(tmp2, 0);
  										if(hContact)
  										{
 -											if(metaIsProtoMetaContacts(hContact))
 +											if(db_mc_isMeta(hContact))
  											{
  												if(allsubcontacts)
  												{
 @@ -1069,11 +1061,9 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  															db_set_s(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
  													}
  												}
 -												else
 -													db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
 +												else db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
  											}
 -											else
 -												db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
 +											else db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
  										}
  										mir_free(tmp2);
  										s+=3;
 @@ -1083,7 +1073,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  										mir_utf8decode(tmp2, 0);
  										if(hContact)
  										{
 -											if(metaIsProtoMetaContacts(hContact))
 +											if(db_mc_isMeta(hContact))
  											{
  												if(allsubcontacts)
  												{
 @@ -1112,7 +1102,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  										mir_utf8decode(tmp2, 0);
  										if(hContact)
  										{
 -											if(metaIsProtoMetaContacts(hContact))
 +											if(db_mc_isMeta(hContact))
  											{
  												if(allsubcontacts)
  												{
 @@ -1183,7 +1173,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam  					{
  						if(hContact)
  						{
 -							if(metaIsProtoMetaContacts(hContact))
 +							if(db_mc_isMeta(hContact))
  							{
  								if(allsubcontacts)
  								{
 diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index 63ff84ff0f..1cca711d67 100644 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -36,7 +36,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam)  {
  	MCONTACT hContact = wParam;
  	MCONTACT hMeta = NULL;
 -	if(metaIsProtoMetaContacts(hContact))
 +	if(db_mc_isMeta(hContact))
  	{
  		hMeta = hContact;
  		hContact = metaGetMostOnline(hContact); // возьмем тот, через который пойдет сообщение
 diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index e5f67a539b..ece1904580 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -150,9 +150,7 @@ INT_PTR LoadKey(WPARAM w, LPARAM)  INT_PTR SendKey(WPARAM w, LPARAM l)  { -	MCONTACT hContact = (MCONTACT)w; -	if(metaIsProtoMetaContacts(hContact)) -		hContact = metaGetMostOnline(hContact); +	MCONTACT hContact = db_mc_tryMeta(w);  	char *szMessage;  	std::string key_id_str;  	{ @@ -204,13 +202,10 @@ INT_PTR SendKey(WPARAM w, LPARAM l)  INT_PTR ToggleEncryption(WPARAM w, LPARAM l)  {  	MCONTACT hContact = (MCONTACT)w; -	BYTE enc = 0; -	if(metaIsProtoMetaContacts(hContact)) -		enc = db_get_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); -	else -		enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); -	if(metaIsProtoMetaContacts(hContact)) +	BYTE enc; +	if(db_mc_isMeta(hContact))  	{ +		enc = db_get_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);  		if(MessageBox(0, TranslateT("Do you want to toggle encryption for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES)  		{  			int count = db_mc_getSubCount(hContact); @@ -223,8 +218,10 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l)  			db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);  		}  	} -	else +	else { +		enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);  		db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1); +	}  	void setSrmmIcon(MCONTACT hContact);  	void setClistIcon(MCONTACT hContact);  	setSrmmIcon(hContact); @@ -239,10 +236,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l)  int OnPreBuildContactMenu(WPARAM w, LPARAM l)  { -	MCONTACT hContact = (MCONTACT)w; -	if(metaIsProtoMetaContacts(hContact)) -		hContact = metaGetMostOnline(hContact); -	 +	MCONTACT hContact = db_mc_tryMeta(w);  	{  		CLISTMENUITEM mi2 = { sizeof(mi2) };  		LPSTR proto = GetContactProto(hContact); @@ -405,7 +399,7 @@ int onProtoAck(WPARAM w, LPARAM l)  								s = out.find(" ID ", s);  								s += strlen(" ID ");  								string::size_type s2 = out.find(",",s); -								if(metaIsProtoMetaContacts(ack->hContact)) +								if(db_mc_isMeta(ack->hContact))  									db_set_s(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());  								else  									db_set_s(ack->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); @@ -459,10 +453,7 @@ int onProtoAck(WPARAM w, LPARAM l)  			{  				std::list<HANDLE>::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess);  				if(it != sent_msgs.end()) -				{  					HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); -					 -				}  			}  			else if(ack->result == ACKRESULT_SUCCESS)  			{ @@ -480,7 +471,7 @@ std::wstring encrypt_file(MCONTACT hContact, TCHAR *filename)  	string out;  	DWORD code;  	pxResult result; -	MCONTACT hcnt = metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact; +	MCONTACT hcnt = db_mc_isMeta(hContact)?metaGetMostOnline(hContact):hContact;  	std::vector<wstring> cmd;  	cmd.push_back(L"--batch");  	cmd.push_back(L"--tes"); @@ -1081,7 +1072,7 @@ bool isContactSecured(MCONTACT hContact)  			debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));  		return false;  	} -	if(!metaIsProtoMetaContacts(hContact)) +	if(!db_mc_isMeta(hContact))  	{  		TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));  		if(!key[0]) diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h index 919d8fdb22..0fdc683385 100644 --- a/plugins/Nudge/src/headers.h +++ b/plugins/Nudge/src/headers.h @@ -66,11 +66,6 @@ int Preview();  /*
  *
  ****************************/
 -MCONTACT Nudge_GethContact(MCONTACT);
 -
 -/*
 -*
 -****************************/
  void Nudge_ShowPopup(CNudgeElement, MCONTACT, TCHAR *);
  /*
 diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 9605bb1072..03f5628709 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -430,7 +430,7 @@ int Preview()  void Nudge_ShowPopup(CNudgeElement n, MCONTACT hContact, TCHAR * Message)
  {
 -	hContact = Nudge_GethContact(hContact);
 +	hContact = db_mc_tryMeta(hContact);
  	TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
  	if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
 @@ -473,11 +473,6 @@ void Nudge_SentStatus(CNudgeElement n, MCONTACT hContact)  	dbei.eventType = 1;
  	dbei.cbBlob = (DWORD)strlen(buff) + 1;
  	dbei.pBlob = (PBYTE)buff;
 -
 -	MCONTACT hMetaContact = db_mc_getMeta(hContact);
 -	if (hMetaContact != NULL) // metacontact
 -		db_event_add(hMetaContact, &dbei);
 -
  	db_event_add(hContact, &dbei);
  	mir_free(buff);
  }
 @@ -497,15 +492,6 @@ void Nudge_ShowStatus(CNudgeElement n, MCONTACT hContact, DWORD timestamp)  	mir_free(buff);
  }
 -MCONTACT Nudge_GethContact(MCONTACT hContact)
 -{
 -	MCONTACT hMetaContact = db_mc_getMeta(hContact);
 -	if (hMetaContact != NULL)
 -		return hMetaContact;
 -
 -	return hContact;
 -}
 -
  void Nudge_AddAccount(PROTOACCOUNT *proto)
  {
  	char str[MAXMODULELABELLENGTH + 10];
 diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index 946768fd44..44d44ff919 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -50,7 +50,7 @@ INT_PTR ShakeChat(WPARAM wParam, LPARAM lParam)  	MessageWindowInputData mwid;
  	mwd.cbSize = sizeof(MessageWindowData);
 -	mwd.hContact = Nudge_GethContact(wParam);
 +	mwd.hContact = db_mc_tryMeta(wParam);
  	mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
  	mwid.cbSize = sizeof(MessageWindowInputData);
 diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 5e4a5d7cfd..5ae4dc4a2c 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -141,8 +141,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam)  static INT_PTR SendMessageCommandWorker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar)
  {
 -	if (db_mc_isSub(hContact))
 -		hContact = db_mc_getMeta(hContact);
 +	hContact = db_mc_tryMeta(hContact);
  	/* does the MCONTACT's protocol support IM messages? */
  	char *szProto = GetContactProto(hContact);
 @@ -200,8 +199,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)  	if (!(g_dat.flags2 & SMF2_SHOWTYPING))
  		return 0;
 -	if (db_mc_isSub(hContact))
 -		hContact = db_mc_getMeta(hContact);
 +	hContact = db_mc_tryMeta(hContact);
  	SkinPlaySound((lParam) ? "TNStart" : "TNStop");
 diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index e2af3f6161..b5808aa64c 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -654,20 +654,17 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb  			 !strncmp(pdbcws->szSetting, "Anniv", 5) ||
  			 !strncmp(pdbcws->szSetting, "DOB", 3)))
  	{
 -		MCONTACT hMeta = db_mc_getMeta(hContact);
 -		WORD LastAnswer = IDNONE;
 -		CEvent evt;
 -		MTime now;
 -
  		// check metacontact instead of subcontact
 -		if (hMeta)
 -			hContact = hMeta;
 +		hContact = db_mc_tryMeta(hContact);
 +		CEvent evt;
 +		MTime now;
  		now.GetLocalTime();
 -		if (!strcmp(pdbcws->szModule, SvcReminderGetMyBirthdayModule()))
 +		if (!strcmp(pdbcws->szModule, SvcReminderGetMyBirthdayModule())) {
 +			WORD LastAnswer = IDNONE;
  			CheckContact(hContact, now, evt, FALSE, &LastAnswer);
 -		else
 -			CheckContact(hContact, now, evt, FALSE, 0);
 +		}
 +		else CheckContact(hContact, now, evt, FALSE, 0);
  	}
  	return 0;
  }
 diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index 83eb7c9c30..89ef77dafe 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -66,11 +66,8 @@ TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size)  int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)
  {
 -	if (commonData.bIgnoreSubcontacts) {
 -		MCONTACT hMetacontact = db_mc_getMeta(hContact);
 -		if (hMetacontact && hMetacontact != hContact) //not main metacontact
 -			return 0;
 -	}
 +	if (commonData.bIgnoreSubcontacts && db_mc_isSub(hContact))
 +		return 0;
  	TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
 @@ -109,11 +106,8 @@ int PopupNotifyBirthday(MCONTACT hContact, int dtb, int age)  int PopupNotifyMissedBirthday(MCONTACT hContact, int dab, int age)
  {
 -	if (commonData.bIgnoreSubcontacts) {
 -		MCONTACT hMetacontact = db_mc_getMeta(hContact);
 -		if (hMetacontact && hMetacontact != hContact) //not main metacontact
 -			return 0;
 -	}
 +	if (commonData.bIgnoreSubcontacts && db_mc_isSub(hContact))
 +		return 0;
  	TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
 diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index f238a91199..5bed7dbd7b 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -139,8 +139,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO  		mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
  	if (hContact) {
 -		if (db_mc_isSub(hContact))
 -			hContact = db_mc_getMeta(hContact);
 +		hContact = db_mc_tryMeta(hContact);
  		REPLACEVARSDATA dat = { 0 };
  		REPLACEVARSARRAY rvaVarsToReplace[4];
 diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 50ac6ae753..66c8f739cb 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -108,8 +108,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, char* msg, int isWchar)  	if (!szProto || (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
  		return 1;
 -	if (db_mc_isSub(hContact))
 -		hContact = db_mc_getMeta(hContact);
 +	hContact = db_mc_tryMeta(hContact);
  	HWND hwnd;
  	if (hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact)) {
 @@ -160,8 +159,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam)  	if (!(g_dat.flags & SMF_SHOWTYPING))
  		return 0;
 -	if (db_mc_isSub(hContact))
 -		hContact = db_mc_getMeta(hContact);
 +	hContact = db_mc_tryMeta(hContact);
  	SkinPlaySound((lParam) ? "TNStart" : "TNStop");
  | 
