예제 #1
0
static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param)
{
	Info *info = (Info *) param;
	if (info == NULL)
		return 0;

	HANDLE hContact = (HANDLE) wParam;
	if (hContact == NULL)
		return 0;

	char *proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
	if (IsEmpty(proto))
		return 0;

	bool found = false;
	for (unsigned int j = 0; !found && j < MAX_REGS(info->db); j += 2)
	{
		if (info->db[j + 1] == NULL)
			break;

		DBVARIANT dbv = { 0 };
		if (!DBGetContactSettingString(hContact, info->db[j] == NULL ? proto : info->db[j], info->db[j+1], &dbv))
		{
			if (!IsEmpty(dbv.ptszVal))
			{
				info->OnClick(info, dbv.ptszVal);
				found = true;
			}

			DBFreeVariant(&dbv);
		}
	}

	return 0;
}
예제 #2
0
static int DefaultOnClick(WPARAM hContact, LPARAM lParam, LPARAM param)
{
	Info *p = (Info*)param;
	if (p == NULL)
		return 0;

	if (hContact == NULL)
		return 0;

	char *proto = GetContactProto(hContact);
	if (IsEmpty(proto))
		return 0;

	bool found = false;
	for (int j = 0; !found && j < SIZEOF(p->db); j += 2) {
		if (p->db[j + 1] == NULL)
			break;

		ptrA szValue(db_get_sa(hContact, p->db[j] == NULL ? proto : p->db[j], p->db[j + 1]));
		if (!IsEmpty(szValue)) {
			p->OnClick(p, szValue);
			found = true;
		}
	}

	return 0;
}