本文整理匯總了C++中DBGetContactSetting函數的典型用法代碼示例。如果您正苦於以下問題:C++ DBGetContactSetting函數的具體用法?C++ DBGetContactSetting怎麽用?C++ DBGetContactSetting使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DBGetContactSetting函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: import_ping_address
void import_ping_address(int index, PINGADDRESS &pa) {
DBVARIANT dbv;
char buf[256];
mir_snprintf(buf, 256, "Address%d", index);
if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszName, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
DBFreeVariant(&dbv);
} else
strcpy(pa.pszName, Translate("Unknown Address"));
mir_snprintf(buf, 256, "Label%d", index);
if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszLabel, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
DBFreeVariant(&dbv);
} else
strcpy(pa.pszLabel, Translate("Unknown"));
mir_snprintf(buf, 256, "Port%d", index);
pa.port = (int)DBGetContactSettingDword(0, "PingPlug", buf, -1);
mir_snprintf(buf, 256, "Proto%d", index);
if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) {
strncpy(pa.pszProto, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH);
DBFreeVariant(&dbv);
mir_snprintf(buf, 256, "Status%d", index);
pa.set_status = DBGetContactSettingWord(0, "PingPlug", buf, ID_STATUS_ONLINE);
mir_snprintf(buf, 256, "Status2%d", index);
pa.get_status = DBGetContactSettingWord(0, "PingPlug", buf, ID_STATUS_OFFLINE);
} else
pa.pszProto[0] = '\0';
pa.responding = false;
pa.round_trip_time = 0;
pa.miss_count = 0;
pa.index = index;
pa.pszCommand[0] = '\0';
pa.pszParams[0] = '\0';
pa.item_id = 0;
mir_snprintf(buf, 256, "Enabled%d", index);
if(DBGetContactSettingByte(0, "PingPlug", buf, 1) == 1)
pa.status = PS_NOTRESPONDING;
else
pa.status = PS_DISABLED;
}
示例2: TlenMenuHandleInbox
int TlenMenuHandleInbox(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
char *login = NULL, *password = NULL;
char szFileName[ MAX_PATH ];
if (DBGetContactSettingByte(NULL, jabberProtoName, "SavePassword", TRUE) == TRUE) {
int tPathLen;
CallService( MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM) szFileName );
tPathLen = strlen( szFileName );
tPathLen += mir_snprintf( szFileName + tPathLen, MAX_PATH - tPathLen, "\\%s\\", jabberModuleName);
CreateDirectoryA( szFileName, NULL );
mir_snprintf( szFileName + tPathLen, MAX_PATH - tPathLen, "openinbox.html" );
if (!DBGetContactSetting(NULL, jabberProtoName, "LoginName", &dbv)) {
login = mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
}
if (!DBGetContactSetting(NULL, jabberProtoName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
password = mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
}
}
if (login != NULL && password != NULL) {
FILE *out;
out = fopen( szFileName, "wt" );
if ( out != NULL ) {
fprintf(out, "<html><head></head><body OnLoad=\"document.forms[0].submit();\">"
"<form action=\"http://poczta.o2.pl/index.php\" method=\"post\" name=\"login_form\">"
"<input type=\"hidden\" name=\"username\" value=\"%s\">"
"<input type=\"hidden\" name=\"password\" value=\"%s\">"
"</form></body></html>", login, password);
fclose( out );
} else {
strcat(szFileName, "http://poczta.o2.pl/");
}
} else {
strcat(szFileName, "http://poczta.o2.pl/");
}
mir_free(login);
mir_free(password);
CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) szFileName);
return 0;
}
示例3: myDBGetString
LPSTR myDBGetString(HANDLE hContact,const char *szModule,const char *szSetting) {
char *val=NULL;
DBVARIANT dbv;
dbv.type = DBVT_ASCIIZ;
DBGetContactSetting(hContact,szModule,szSetting,&dbv);
if( dbv.pszVal && (dbv.type==DBVT_ASCIIZ || dbv.type==DBVT_UTF8 || dbv.type==DBVT_WCHAR) )
val = mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
return val;
}
示例4:
char *JabberJIDFromHContact(TlenProtocol *proto, HANDLE hContact)
{
char *p = NULL;
DBVARIANT dbv;
if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
p = mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
}
return p;
}
示例5: rsa_check_pub
int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int sigLen) {
int v=0, k=0;
pUinKey ptr = getUinCtx(context); if(!ptr) return 0;
LPSTR cnm = (LPSTR) mir_alloc(NAMSIZE); getContactNameA(ptr->hContact,cnm);
LPSTR uin = (LPSTR) mir_alloc(KEYSIZE); getContactUinA(ptr->hContact,uin);
LPSTR msg = (LPSTR) mir_alloc(MSGSIZE);
LPSTR sha = mir_strdup(to_hex(sig,sigLen));
LPSTR sha_old = NULL;
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: %s %s %s", cnm, uin, sha);
#endif
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
if( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
k = 1;
PBYTE buf = (PBYTE) alloca(sigLen); int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)buf,&len);
sha_old = mir_strdup(to_hex(buf,len));
DBFreeVariant(&dbv);
}
if( bAAK ) {
if( k ) mir_snprintf(msg,MSGSIZE,Translate(sim523),cnm,uin,sha,sha_old);
else mir_snprintf(msg,MSGSIZE,Translate(sim521),cnm,uin,sha);
showPopUpKRmsg(ptr->hContact,msg);
HistoryLog(ptr->hContact,msg);
v = 1;
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: auto accepted");
#endif
}
else {
if( k ) mir_snprintf(msg,MSGSIZE,Translate(sim522),cnm,sha,sha_old);
else mir_snprintf(msg,MSGSIZE,Translate(sim520),cnm,sha);
v = (msgbox(0,msg,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDYES);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: manual accepted %d",v);
#endif
}
if(v) {
DBCONTACTWRITESETTING cws;
cws.szModule = szModuleName;
cws.szSetting = "rsa_pub";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = pub;
cws.value.cpbVal = pubLen;
CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)ptr->hContact, (LPARAM)&cws);
ptr->keyLoaded = true;
}
mir_free(cnm);
mir_free(uin);
mir_free(msg);
mir_free(sha);
SAFE_FREE(sha_old);
return v;
}
示例6: FinalCommandSetup
void FinalCommandSetup(void) {
DBVARIANT dbv;
if(!DBGetContactSetting(0, "db3x", "ExitCommand", &dbv) && dbv.type == DBVT_ASCIIZ) {
strncpy(exit_command, dbv.pszVal, MAX_PATH);
command_valid = TRUE;
DBFreeVariant(&dbv);
if(!DBGetContactSetting(0, "db3x", "ExitCommandParams", &dbv) && dbv.type == DBVT_ASCIIZ) {
strncpy(exit_command_params, dbv.pszVal, MAX_PATH);
command_params_valid = TRUE;
DBFreeVariant(&dbv);
}
if(!DBGetContactSetting(0, "db3x", "ExitCommandDir", &dbv) && dbv.type == DBVT_ASCIIZ) {
strncpy(exit_command_dir, dbv.pszVal, MAX_PATH);
command_dir_valid = TRUE;
DBFreeVariant(&dbv);
}
}
}
示例7: TlenPrebuildContactMenu
static int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
DBVARIANT dbv;
CLISTMENUITEM clmi = {0};
JABBER_LIST_ITEM *item;
TlenProtocol *proto = (TlenProtocol *)ptr;
clmi.cbSize = sizeof(CLISTMENUITEM);
if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (item->subscription==SUB_NONE || item->subscription==SUB_FROM)
clmi.flags = CMIM_FLAGS;
else
clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
if (item->subscription==SUB_NONE || item->subscription==SUB_TO)
clmi.flags = CMIM_FLAGS;
else
clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
if (item->status!=ID_STATUS_OFFLINE)
clmi.flags = CMIM_FLAGS;
else
clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
if (item->status!=ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto))
clmi.flags = CMIM_FLAGS;
else
clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
if (item->status!=ID_STATUS_OFFLINE)
clmi.flags = CMIM_FLAGS;
else
clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuPicture, (LPARAM) &clmi);
DBFreeVariant(&dbv);
return 0;
}
DBFreeVariant(&dbv);
}
}
clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
return 0;
}
示例8: getSettingStringUtf
void CIcqProto::setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi)
{
if (szStatusMsg && szStatusMsg[0])
{
if (isAnsi)
{
char* szStatusNote = getSettingStringUtf(hContact, DBSETTING_STATUS_NOTE, "");
wchar_t* szStatusNoteW = make_unicode_string(szStatusNote);
int len = (int)wcslen(szStatusNoteW) * 3 + 1;
char* szStatusNoteAnsi = (char*)alloca(len);
WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, szStatusNoteW, -1, szStatusNoteAnsi, len, NULL, NULL);
bool notmatch = false;
for (int i=0; ;++i)
{
if (szStatusNoteAnsi[i] != szStatusMsg[i] && szStatusNoteAnsi[i] != '?' && szStatusMsg[i] != '?')
{
notmatch = true;
break;
}
if (!szStatusNoteAnsi[i] || !szStatusMsg[i])
break;
}
szStatusMsg = notmatch ? ansi_to_utf8(szStatusMsg) : szStatusNote;
SAFE_FREE(&szStatusNoteW);
if (notmatch) SAFE_FREE(&szStatusNote);
}
char* oldStatusMsg = NULL;
DBVARIANT dbv;
if (!DBGetContactSetting(hContact, "CList", "StatusMsg", &dbv))
{
switch (dbv.type)
{
case DBVT_UTF8:
oldStatusMsg = null_strdup(dbv.pszVal);
break;
case DBVT_WCHAR:
oldStatusMsg = make_utf8_string(dbv.pwszVal);
break;
}
ICQFreeVariant(&dbv);
}
if (!oldStatusMsg || strcmp(oldStatusMsg, szStatusMsg))
setSettingStringUtf(hContact, "CList", "StatusMsg", szStatusMsg);
SAFE_FREE(&oldStatusMsg);
if (isAnsi) SAFE_FREE(&szStatusMsg);
}
else
DBDeleteContactSetting(hContact, "CList", "StatusMsg");
}
示例9: isContactSecured
BYTE isContactSecured(HANDLE hContact) {
// нужна проверка на Offline и в этом случае другие статусы
if (!clist_cnt) return 0;
BYTE r=0;
if( isProtoMetaContacts(hContact) )
hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
for(int j=0;j<clist_cnt;j++) {
if( clist[j].hContact == hContact ) {
if( !clist[j].proto->inspecting ) break;
DBVARIANT dbv;
r=clist[j].mode;
switch(r) {
case MODE_NATIVE:
if(cpp_keyx(clist[j].cntx)!=0) r|=SECURED;
break;
case MODE_PGP:
DBGetContactSetting(hContact,szModuleName,"pgp",&dbv);
if( dbv.type!=0 ) r|=SECURED;
DBFreeVariant(&dbv);
break;
case MODE_GPG:
DBGetContactSetting(hContact,szModuleName,"gpg",&dbv);
if( dbv.type!=0 ) r|=SECURED;
DBFreeVariant(&dbv);
break;
case MODE_RSAAES:
if(exp->rsa_get_state(clist[j].cntx)==7) r|=SECURED;
break;
case MODE_RSA:
if(clist[j].cntx) r|=SECURED;
break;
}
break;
}
}
return r; // (mode&SECURED) - проверка на EST/DIS
}
示例10: TlenContactMenuHandleGrantAuth
INT_PTR TlenContactMenuHandleGrantAuth(void *ptr, WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam)!=NULL && proto->isOnline) {
if (!DBGetContactSetting(hContact, proto->iface.m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribed'/>", dbv.pszVal);
DBFreeVariant(&dbv);
}
}
return 0;
}
示例11: TlenContactMenuHandleGrantAuth
int TlenContactMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
DBVARIANT dbv;
if ((hContact=(HANDLE) wParam)!=NULL && jabberOnline) {
if (!DBGetContactSetting(hContact, jabberProtoName, "jid", &dbv)) {
JabberSend(jabberThreadInfo->s, "<presence to='%s' type='subscribed'/>", dbv.pszVal);
DBFreeVariant(&dbv);
}
}
return 0;
}
示例12: DBGetContactSetting
char *DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting)
{
char *str=NULL;
DBVARIANT dbv={0};
DBGetContactSetting(hContact,szModule,szSetting,&dbv);
if(dbv.type==DBVT_ASCIIZ)
{
str=mir_strdup(dbv.pszVal);
mir_free(dbv.pszVal);
}
DBFreeVariant(&dbv);
return str;
}
示例13: _strdup
static char *getDisplayName(const char *id)
{
char jid[256];
HANDLE hContact;
DBVARIANT dbv;
if (!DBGetContactSetting(NULL, jabberProtoName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%[email protected]%s", id, dbv.pszVal);
DBFreeVariant(&dbv);
if ((hContact=JabberHContactFromJID(jid)) != NULL) {
return _strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
}
}
return _strdup(id);
}
示例14: loadRSAkey
// загружает паблик-ключ в RSA контекст
BYTE loadRSAkey(pUinKey ptr) {
if( !ptr->keyLoaded ) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
if( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
ptr->keyLoaded = exp->rsa_set_pubkey(ptr->cntx,dbv.pbVal,dbv.cpbVal);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("loadRSAkey %d", ptr->keyLoaded);
#endif
DBFreeVariant(&dbv);
}
}
return ptr->keyLoaded;
}
示例15: TlenContactMenuHandleSendPicture
int TlenContactMenuHandleSendPicture(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact;
DBVARIANT dbv;
if ((hContact=(HANDLE) wParam)!=NULL && jabberOnline) {
if (!DBGetContactSetting(hContact, jabberProtoName, "jid", &dbv)) {
JabberSend(jabberThreadInfo->s, "<message type='pic' to='[email protected]' crc='da4fe23' idt='2174' size='21161'/>");
// JabberSend(jabberThreadInfo->s, "<message type='pic' to='%s' crc='b4f7bdd' idt='6195' size='5583'/>", dbv.pszVal);
DBFreeVariant(&dbv);
}
}
return 0;
}