Example #1
0
BOOL LoadKeyPGP(pUinKey ptr)
{
	int mode = db_get_b(ptr->hContact,MODULENAME,"pgp_mode",255);
	if (mode == 0) {
		DBVARIANT dbv;
		db_get(ptr->hContact,MODULENAME,"pgp",&dbv);
		BOOL r=(dbv.type == DBVT_BLOB);
		if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
		db_free(&dbv);
		return r;
	}
	if (mode == 1) {
		LPSTR key = db_get_sa(ptr->hContact,MODULENAME,"pgp");
		if (key) {
			pgp_set_key(ptr->cntx,key);
			mir_free(key);
			return 1;
		}
	}
	return 0;
}
Example #2
0
BOOL LoadKeyPGP(pUinKey ptr) {
   	int mode = DBGetContactSettingByte(ptr->hContact,szModuleName,"pgp_mode",255);
   	if(mode==0) {
   		DBVARIANT dbv;
   		DBGetContactSetting(ptr->hContact,szModuleName,"pgp",&dbv);
		BOOL r=(dbv.type==DBVT_BLOB);
		if(r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
		DBFreeVariant(&dbv);
		return r;
   	}
   	else
   	if(mode==1) {
   		LPSTR key = myDBGetStringDecode(ptr->hContact,szModuleName,"pgp");
		if( key ) {
   			pgp_set_key(ptr->cntx,key);
   			mir_free(key);
	   		return 1;
   		}
   	}
	return 0;
}