Пример #1
0
static int CheckProto(HANDLE hContact, const char *proto)
{
	static char protobuf[MAX_PATH] = {0};
	static DBVARIANT dbv;
	static DBCONTACTGETSETTING sVal = {proto_module,proto_setting,&dbv};

 	dbv.type = DBVT_ASCIIZ;
	dbv.pszVal = protobuf;
	dbv.cchVal = sizeof(protobuf);

	if (GetContactSettingStatic((WPARAM)hContact, (LPARAM )&sVal) != 0
		|| (dbv.type != DBVT_ASCIIZ)) return 0;

	return !strcmp(protobuf,proto);
}
Пример #2
0
int CDbxKV::CheckProto(DBCachedContact *cc, const char *proto)
{
	if (cc->szProto == NULL) {
		char protobuf[MAX_PATH] = { 0 };
		DBVARIANT dbv;
		dbv.type = DBVT_ASCIIZ;
		dbv.pszVal = protobuf;
		dbv.cchVal = sizeof(protobuf);
		if (GetContactSettingStatic(cc->contactID, "Protocol", "p", &dbv) != 0 || (dbv.type != DBVT_ASCIIZ))
			return 0;

		cc->szProto = m_cache->GetCachedSetting(NULL, protobuf, 0, (int)strlen(protobuf));
	}

	return !strcmp(cc->szProto, proto);
}
Пример #3
0
int CDataBase::CheckProto(HANDLE hContact, const char *proto)
{
	DBCachedContact *cc = m_cache->GetCachedContact(hContact);
	if (cc == NULL)
		cc = m_cache->AddContactToCache(hContact);

	if (cc->szProto == NULL) {
		char protobuf[MAX_PATH] = {0};
		DBVARIANT dbv;
		DBCONTACTGETSETTING sVal = { "Protocol", "p", &dbv };

 		dbv.type = DBVT_ASCIIZ;
		dbv.pszVal = protobuf;
		dbv.cchVal = sizeof(protobuf);
		if ( GetContactSettingStatic(hContact, &sVal) != 0 || (dbv.type != DBVT_ASCIIZ))
			return 0;

		cc->szProto = m_cache->GetCachedSetting(NULL, protobuf, 0, (int)strlen(protobuf));
	}

	return !strcmp(cc->szProto, proto);
}