Пример #1
0
// MsnBasicSearch - search contacts by e-mail
void __cdecl CMsnProto::MsnSearchAckThread(void* arg)
{
	const TCHAR* emailT = (TCHAR*)arg;
	T2Utf email(emailT);

	if (Lists_IsInList(LIST_FL, email)) {
		MSN_ShowPopup(emailT, TranslateT("Contact already in your contact list"), MSN_ALLOW_MSGBOX, NULL);
		ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		mir_free(arg);
		return;
	}

	if (MyOptions.netId == NETID_SKYPE) MSN_SKYABSearch(email, arg);
	else {
		unsigned res = MSN_ABContactAdd(email, NULL, NETID_MSN, NULL, 1, true);
		switch (res) {
		case 0:
		case 2:
		case 3:
		{
			PROTOSEARCHRESULT psr = { 0 };
			psr.cbSize = sizeof(psr);
			psr.flags = PSR_TCHAR;
			psr.id.t = (TCHAR*)emailT;
			psr.nick.t = (TCHAR*)emailT;
			psr.email.t = (TCHAR*)emailT;

			ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&psr);
			ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		}
		break;

		case 1:
			if (strstr(email, "@yahoo.com") == NULL)
				ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
	#ifdef OBSOLETE
			else {
				msnSearchId = arg;
				MSN_FindYahooUser(email);
			}
	#endif
			break;

		default:
			ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
			break;
		}
	}
	mir_free(arg);
}
Пример #2
0
void __cdecl CMsnProto::MsnSearchAckThread(void* arg)
{
	const TCHAR* emailT = (TCHAR*)arg;
	char *email = mir_utf8encodeT(emailT);

	if (Lists_IsInList(LIST_FL, email))
	{
		MSN_ShowPopup(emailT, _T("Contact already in your contact list"), MSN_ALLOW_MSGBOX, NULL);
		SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		mir_free(arg);
		return;
	}

	unsigned res = MSN_ABContactAdd(email, NULL, NETID_MSN, NULL, 1, true);
	switch(res)
	{
	case 0:
	case 2:
	case 3:
		{
			PROTOSEARCHRESULT isr = {0};
			isr.cbSize = sizeof(isr);
			isr.flags = PSR_TCHAR;
			isr.id  = (TCHAR*)emailT;
			isr.nick  = (TCHAR*)emailT;
			isr.email = (TCHAR*)emailT;

			SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, arg, (LPARAM)&isr);
			SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		}
		break;
	
	case 1:
		if (strstr(email, "@yahoo.com") == NULL)
			SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		else
		{
			msnSearchId = arg;
			MSN_FindYahooUser(email);
		}
		break;

	default:
		SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, arg, 0);
		break;
	}
	mir_free(email);
	mir_free(arg);
}