Пример #1
0
int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam)
{
	if (m_state != 1 || !getByte(AIM_KEY_MG, 1))
		return 0;

	CLISTGROUPCHANGE *grpchg = (CLISTGROUPCHANGE*)lParam;

	if (hContact == NULL) {
		if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) {
			T2Utf szOldName(grpchg->pszOldName);
			unsigned short group_id = m_group_list.find_id(szOldName);
			if (group_id) {
				aim_delete_contact(m_hServerConn, m_seqno, szOldName, 0, group_id, 1, false);
				m_group_list.remove_by_id(group_id);
				update_server_group("", 0);
			}
		}
		else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) {
			unsigned short group_id = m_group_list.find_id(T2Utf(grpchg->pszOldName));
			if (group_id)
				update_server_group(T2Utf(grpchg->pszNewName), group_id);
		}
	}
	else {
		if (is_my_contact(hContact) && getBuddyId(hContact, 1) && !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) {
			if (grpchg->pszNewName)
				add_contact_to_group(hContact, T2Utf(grpchg->pszNewName));
			else
				add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
		}
	}
	return 0;
}
Пример #2
0
INT_PTR CAimProto::AddToServerList(WPARAM hContact, LPARAM)
{
	if (m_state != 1)
		return 0;

	DBVARIANT dbv;
	if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) {
		add_contact_to_group(hContact, dbv.pszVal);
		db_free(&dbv);
	}
	else add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
	return 0;
}
Пример #3
0
int CAimProto::OnGroupChange(WPARAM wParam,LPARAM lParam)
{
	if (state != 1 || !getByte(AIM_KEY_MG, 1)) return 0;

	const HANDLE hContact = (HANDLE)wParam;
	const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam;

	if (hContact == NULL)
	{
		if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL)
		{
			char* szOldName = mir_utf8encodeT(grpchg->pszOldName);
			unsigned short group_id = group_list.find_id(szOldName);
			if (group_id)
			{
				aim_delete_contact(hServerConn, seqno, szOldName, 0, group_id, 1, false);
				group_list.remove_by_id(group_id);
				update_server_group("", 0);
			}
			mir_free(szOldName);
		}
		else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL)
		{
			char* szOldName = mir_utf8encodeT(grpchg->pszOldName);
			unsigned short group_id = group_list.find_id(szOldName);
			if (group_id)
			{
				char* szNewName = mir_utf8encodeT(grpchg->pszNewName);
				update_server_group(szNewName, group_id);
				mir_free(szNewName);
			}
			mir_free(szOldName);
		}
	}
	else
	{
		if (is_my_contact(hContact) && getBuddyId(hContact, 1) && 
			!DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
		{
			if (grpchg->pszNewName)
			{
				char* szNewName = mir_utf8encodeT(grpchg->pszNewName);
				add_contact_to_group(hContact, szNewName);
				mir_free(szNewName);
			}
			else
				add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
		}
	}
	return 0;
}
Пример #4
0
int CAimProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam)
{
	DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;

	if (strcmp(cws->szModule, MOD_KEY_CL) == 0 && state == 1 && wParam)
	{
		HANDLE hContact = (HANDLE)wParam;
		if (strcmp(cws->szSetting, AIM_KEY_NL) == 0)
		{
			if (cws->value.type == DBVT_DELETED)
			{
				DBVARIANT dbv;
				if(!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
				{
					add_contact_to_group(hContact, dbv.pszVal);
					DBFreeVariant(&dbv);
				}
				else
					add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
			}
		}
		else if (strcmp(cws->szSetting, "MyHandle") == 0)
		{
			char* name;
			switch (cws->value.type)
			{
			case DBVT_DELETED:
				set_local_nick(hContact, NULL, NULL);
				break;

			case DBVT_ASCIIZ:
				name = mir_utf8encode(cws->value.pszVal);
				set_local_nick(hContact, name, NULL);
				mir_free(name);
				break;

			case DBVT_UTF8:
				set_local_nick(hContact, cws->value.pszVal, NULL);
				break;

			case DBVT_WCHAR:
				name = mir_utf8encodeW(cws->value.pwszVal);
				set_local_nick(hContact, name, NULL);
				mir_free(name);
				break;
			}
		}
	}

	return 0;
}
Пример #5
0
INT_PTR CAimProto::AddToServerList(WPARAM wParam, LPARAM /*lParam*/)
{
	if (state != 1) return 0;

	HANDLE hContact = (HANDLE)wParam;
	DBVARIANT dbv;
	if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
	{
		add_contact_to_group(hContact, dbv.pszVal);
		DBFreeVariant(&dbv);
	}
	else 
		add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
	return 0;
}
Пример #6
0
int __cdecl CAimProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
{
	//Not a real authrequest- only used b/c we don't know the group until now.
	if (state != 1)
		return 1;

	DBVARIANT dbv;
	if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
	{
		add_contact_to_group(hContact, dbv.pszVal);
		db_free(&dbv);
	}
	else add_contact_to_group(hContact, AIM_DEFAULT_GROUP);

	return 0;
}