summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
commit007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch)
treeb1ee30b70c6e36d1a06aed6885cb80dc560a68ca /plugins/New_GPG/src
parentf4a1bbc6ba4b8137cb868639ac146aa97e97e9df (diff)
- rest of menus cleared;
- old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-xplugins/New_GPG/src/init.cpp48
-rwxr-xr-xplugins/New_GPG/src/main.cpp144
-rwxr-xr-xplugins/New_GPG/src/messages.cpp84
-rwxr-xr-xplugins/New_GPG/src/options.cpp128
-rwxr-xr-xplugins/New_GPG/src/srmm.cpp14
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp70
6 files changed, 244 insertions, 244 deletions
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index f40fcec786..af83770a2d 100755
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -67,35 +67,35 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l);
void init_vars()
{
- bAppendTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bAppendTags", 0);
- bStripTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bStripTags", 0);
+ bAppendTags = db_get_b(NULL, szGPGModuleName, "bAppendTags", 0);
+ bStripTags = db_get_b(NULL, szGPGModuleName, "bStripTags", 0);
inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("<GPGdec>"));
inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("</GPGdec>"));
outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("<GPGenc>"));
outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
- bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0);
- bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0);
- bSameAction = DBGetContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ bDebugLog = db_get_b(NULL, szGPGModuleName, "bDebugLog", 0);
+ bAutoExchange = db_get_b(NULL, szGPGModuleName, "bAutoExchange", 0);
+ bSameAction = db_get_b(NULL, szGPGModuleName, "bSameAction", 0);
password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
debuglog.init();
bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001?true:false;
- bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
- bPresenceSigning = DBGetContactSettingByte(NULL, szGPGModuleName, "bPresenceSigning", 0);
- bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0);
- firstrun_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", 0);
- firstrun_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", 0);
- key_password_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "PasswordWindowX", 0);
- key_password_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "PasswordWindowY", 0);
- key_gen_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowX", 0);
- key_gen_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowY", 0);
- load_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowX", 0);
- load_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", 0);
- import_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowX", 0);
- import_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowY", 0);
- new_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowX", 0);
- new_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", 0);
- load_existing_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0);
- load_existing_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0);
+ bJabberAPI = db_get_b(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
+ bPresenceSigning = db_get_b(NULL, szGPGModuleName, "bPresenceSigning", 0);
+ bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0);
+ firstrun_rect.left = db_get_dw(NULL, szGPGModuleName, "FirstrunWindowX", 0);
+ firstrun_rect.top = db_get_dw(NULL, szGPGModuleName, "FirstrunWindowY", 0);
+ key_password_rect.left = db_get_dw(NULL, szGPGModuleName, "PasswordWindowX", 0);
+ key_password_rect.top = db_get_dw(NULL, szGPGModuleName, "PasswordWindowY", 0);
+ key_gen_rect.left = db_get_dw(NULL, szGPGModuleName, "KeyGenWindowX", 0);
+ key_gen_rect.top = db_get_dw(NULL, szGPGModuleName, "KeyGenWindowY", 0);
+ load_key_rect.left = db_get_dw(NULL, szGPGModuleName, "LoadKeyWindowX", 0);
+ load_key_rect.top = db_get_dw(NULL, szGPGModuleName, "LoadKeyWindowY", 0);
+ import_key_rect.left = db_get_dw(NULL, szGPGModuleName, "ImportKeyWindowX", 0);
+ import_key_rect.top = db_get_dw(NULL, szGPGModuleName, "ImportKeyWindowY", 0);
+ new_key_rect.left = db_get_dw(NULL, szGPGModuleName, "NewKeyWindowX", 0);
+ new_key_rect.top = db_get_dw(NULL, szGPGModuleName, "NewKeyWindowY", 0);
+ load_existing_key_rect.left = db_get_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0);
+ load_existing_key_rect.top = db_get_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0);
tabsrmm_used = isTabsrmmUsed();
bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, _T("Arial"));
}
@@ -120,7 +120,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
void InitCheck();
void FirstRun();
FirstRun();
- if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1))
+ if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1))
InitCheck();
InitIconLib();
if(ServiceExists(MS_MSG_ADDICON))
@@ -244,7 +244,7 @@ extern list<wstring> transfers;
extern "C" int __declspec(dllexport) Unload(void)
{
// for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
-// DBDeleteContactSetting(hContact, szGPGModuleName, "KeyID_Prescense");
+// db_unset(hContact, szGPGModuleName, "KeyID_Prescense");
if(!transfers.empty())
{
for(list<wstring>::iterator p = transfers.begin(); p != transfers.end(); p++)
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 80a2b2837d..072b64a26e 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -323,21 +323,21 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63);
if(!strcmp(buf, Translate("Default")))
{
- DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
- DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyMainName", name);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp);
+ db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
+ db_set_ts(NULL, szGPGModuleName, "KeyMainName", name);
+ db_set_ts(NULL, szGPGModuleName, "KeyID", fp);
}
else
{
std::string acc_str = buf;
acc_str += "_GPGPubKey";
- DBWriteContactSettingString(NULL, szGPGModuleName, acc_str.c_str(), out.c_str());
+ db_set_s(NULL, szGPGModuleName, acc_str.c_str(), out.c_str());
acc_str = buf;
acc_str += "_KeyMainName";
- DBWriteContactSettingTString(NULL, szGPGModuleName, acc_str.c_str(), name);
+ db_set_ts(NULL, szGPGModuleName, acc_str.c_str(), name);
acc_str = buf;
acc_str += "_KeyID";
- DBWriteContactSettingTString(NULL, szGPGModuleName, acc_str.c_str(), fp);
+ db_set_ts(NULL, szGPGModuleName, acc_str.c_str(), fp);
}
if(!strcmp(buf, Translate("Default")))
{
@@ -357,7 +357,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
dbsetting += keyid;
mir_free(keyid);
dbsetting += "_Password";
- DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), passwd);
+ db_set_ts(NULL, szGPGModuleName, dbsetting.c_str(), passwd);
}
delete [] name;
}
@@ -500,33 +500,33 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63);
if(!strcmp(buf, Translate("Default")))
{
- DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey");
- DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID");
- DBDeleteContactSetting(NULL, szGPGModuleName, "KeyComment");
- DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainName");
- DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainEmail");
- DBDeleteContactSetting(NULL, szGPGModuleName, "KeyType");
+ db_unset(NULL, szGPGModuleName, "GPGPubKey");
+ db_unset(NULL, szGPGModuleName, "KeyID");
+ db_unset(NULL, szGPGModuleName, "KeyComment");
+ db_unset(NULL, szGPGModuleName, "KeyMainName");
+ db_unset(NULL, szGPGModuleName, "KeyMainEmail");
+ db_unset(NULL, szGPGModuleName, "KeyType");
}
else
{
std::string acc_str = buf;
acc_str += "_GPGPubKey";
- DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str());
+ db_unset(NULL, szGPGModuleName, acc_str.c_str());
acc_str = buf;
acc_str += "_KeyMainName";
- DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str());
+ db_unset(NULL, szGPGModuleName, acc_str.c_str());
acc_str = buf;
acc_str += "_KeyID";
- DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str());
+ db_unset(NULL, szGPGModuleName, acc_str.c_str());
acc_str = buf;
acc_str += "_KeyComment";
- DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str());
+ db_unset(NULL, szGPGModuleName, acc_str.c_str());
acc_str = buf;
acc_str += "_KeyMainEmail";
- DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str());
+ db_unset(NULL, szGPGModuleName, acc_str.c_str());
acc_str = buf;
acc_str += "_KeyType";
- DBDeleteContactSetting(NULL, szGPGModuleName, acc_str.c_str());
+ db_unset(NULL, szGPGModuleName, acc_str.c_str());
}
}
ListView_DeleteItem(hwndList, itemnum);
@@ -628,17 +628,17 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63);
if(!strcmp(buf, Translate("Default")))
{
- DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
- DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp);
+ db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
+ db_set_ts(NULL, szGPGModuleName, "KeyID", fp);
}
else
{
std::string acc_str = buf;
acc_str += "_GPGPubKey";
- DBWriteContactSettingString(NULL, szGPGModuleName, acc_str.c_str(), out.c_str());
+ db_set_s(NULL, szGPGModuleName, acc_str.c_str(), out.c_str());
acc_str = buf;
acc_str += "_KeyID";
- DBWriteContactSettingTString(NULL, szGPGModuleName, acc_str.c_str(), fp);
+ db_set_ts(NULL, szGPGModuleName, acc_str.c_str(), fp);
}
}
extern HWND hwndCurKey_p;
@@ -835,8 +835,8 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
case WM_DESTROY:
{
GetWindowRect(hwndDlg, &firstrun_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", firstrun_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", firstrun_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "FirstrunWindowX", firstrun_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "FirstrunWindowY", firstrun_rect.top);
}
hwndFirstRun = NULL;
break;
@@ -898,7 +898,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
bool bad_version = false;
if(gpg_exists/* && lang_exists*/)
{
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -911,7 +911,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
gpg_valid = true;
gpg_launcher(params);
gpg_valid = false;
- DBDeleteContactSetting(NULL, szGPGModuleName, "szGpgBinPath");
+ db_unset(NULL, szGPGModuleName, "szGpgBinPath");
string::size_type p1 = out.find("(GnuPG) ");
if(p1 != string::npos)
{
@@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
{
bool bad_version = false;
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -1036,7 +1036,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
gpg_valid = true;
gpg_launcher(params);
gpg_valid = false;
- DBDeleteContactSetting(NULL, szGPGModuleName, "szGpgBinPath");
+ db_unset(NULL, szGPGModuleName, "szGpgBinPath");
string::size_type p1 = out.find("(GnuPG) ");
if(p1 != string::npos)
{
@@ -1052,7 +1052,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if(bad_version)
MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK);
}
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512);
while(tmp[_tcslen(tmp)-1] == '\\')
tmp[_tcslen(tmp)-1] = '\0';
@@ -1061,7 +1061,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK);
break;
}
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
{
TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
DWORD dwFileAttr = GetFileAttributes(path);
@@ -1073,7 +1073,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
mir_free(path);
}
gpg_valid = true;
- DBWriteContactSettingByte(NULL, szGPGModuleName, "FirstRun", 0);
+ db_set_b(NULL, szGPGModuleName, "FirstRun", 0);
DestroyWindow(hwndDlg);
ShowFirstRunDialog();
}
@@ -1101,7 +1101,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
{
bool bad_version = false;
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -1114,7 +1114,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
gpg_valid = true;
gpg_launcher(params);
gpg_valid = false;
- DBDeleteContactSetting(NULL, szGPGModuleName, "szGpgBinPath");
+ db_unset(NULL, szGPGModuleName, "szGpgBinPath");
string::size_type p1 = out.find("(GnuPG) ");
if(p1 != string::npos)
{
@@ -1130,7 +1130,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if(bad_version)
MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK);
}
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512);
while(tmp[_tcslen(tmp)-1] == '\\')
tmp[_tcslen(tmp)-1] = '\0';
@@ -1139,7 +1139,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK);
break;
}
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
{
TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
DWORD dwFileAttr = GetFileAttributes(path);
@@ -1239,15 +1239,15 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
out.erase(s, 1);
}
- DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
- DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", path.c_str());
+ db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str());
+ db_set_ts(NULL, szGPGModuleName, "KeyID", path.c_str());
extern HWND hwndCurKey_p;
SetWindowText(hwndCurKey_p, path.c_str());
}
}
bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange");
gpg_valid = true;
- DBWriteContactSettingByte(NULL, szGPGModuleName, "FirstRun", 0);
+ db_set_b(NULL, szGPGModuleName, "FirstRun", 0);
DestroyWindow(hwndDlg);
break;
default:
@@ -1296,7 +1296,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
TranslateDialogDefault(hwndDlg);
TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0]?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?"));
- EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1);
SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept"));
mir_free(tmp);
tmp = new TCHAR [256];
@@ -1318,7 +1318,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
break;
case IDC_IMPORT_AND_USE:
ImportKey();
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
void setSrmmIcon(HANDLE hContact);
void setClistIcon(HANDLE hContact);
setSrmmIcon(hContact);
@@ -1350,8 +1350,8 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
case WM_DESTROY:
{
GetWindowRect(hwndDlg, &new_key_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top);
}
hwndNewKey = NULL;
break;
@@ -1653,8 +1653,8 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
case WM_DESTROY:
{
GetWindowRect(hwndDlg, &key_gen_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowX", key_gen_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "KeyGenWindowY", key_gen_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "KeyGenWindowX", key_gen_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "KeyGenWindowY", key_gen_rect.top);
}
hwndKeyGen = NULL;
break;
@@ -1902,8 +1902,8 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar
case WM_DESTROY:
{
GetWindowRect(hwndDlg, &load_existing_key_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", load_existing_key_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", load_existing_key_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowX", load_existing_key_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "LoadExistingKeyWindowY", load_existing_key_rect.top);
}
hwndSelectExistingKey = NULL;
break;
@@ -1981,8 +1981,8 @@ static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wP
case WM_DESTROY:
{
GetWindowRect(hwndDlg, &import_key_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowX", import_key_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "ImportKeyWindowY", import_key_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowX", import_key_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowY", import_key_rect.top);
}
break;
@@ -2048,7 +2048,7 @@ void ShowImportKeyDialog()
void FirstRun()
{
DWORD pid = 0;
- if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1))
+ if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1))
return;
ShowSetDirsDialog();
}
@@ -2204,7 +2204,7 @@ void InitCheck()
keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
void ShowFirstRunDialog();
- if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0]))
+ if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0]))
{
question = Translate("You didn't set a private key.\nWould you like to set it now?");
if(MessageBoxA(0, question.c_str(), Translate("Own private key warning"), MB_YESNO) == IDYES)
@@ -2337,14 +2337,14 @@ void ImportKey()
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingTString(hcnt, szGPGModuleName, "GPGPubKey", new_key.c_str());
+ db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", new_key.c_str());
}
}
else
- DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str());
+ db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str());
}
else
- DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str());
+ db_set_ts(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str());
new_key.clear();
{ //gpg execute block
std::vector<wstring> cmd;
@@ -2396,7 +2396,7 @@ void ImportKey()
char *tmp = NULL;
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
+ db_set_s(hcnt, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
s = output.find("“", s2);
if(s == string::npos)
{
@@ -2421,7 +2421,7 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1));
strcpy(tmp, output.substr(s,s2-s-(uncommon?1:0)).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainName", tmp);
+ db_set_s(hcnt, szGPGModuleName, "KeyMainName", tmp);
mir_free(tmp);
}
@@ -2437,7 +2437,7 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1));
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyComment", tmp);
+ db_set_s(hcnt, szGPGModuleName, "KeyComment", tmp);
mir_free(tmp);
s+=3;
s2 = output.find(">", s);
@@ -2446,7 +2446,7 @@ void ImportKey()
tmp = (char*) mir_alloc(sizeof(char)*(output.substr(s,s2-s).length()+1));
strcpy(tmp, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", tmp);
+ db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", tmp);
mir_free(tmp);
}
}
@@ -2455,11 +2455,11 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1));
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
mir_free(tmp);
}
}
- DBDeleteContactSetting(hcnt, szGPGModuleName, "bAlwatsTrust");
+ db_unset(hcnt, szGPGModuleName, "bAlwatsTrust");
}
}
}
@@ -2468,7 +2468,7 @@ void ImportKey()
char *tmp = NULL;
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
s = output.find("“", s2);
if(s == string::npos)
{
@@ -2493,7 +2493,7 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1));
strcpy(tmp, output.substr(s,s2-s-(uncommon?1:0)).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", tmp);
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", tmp);
mir_free(tmp);
}
if((s = output.find(")", s2)) == string::npos)
@@ -2508,7 +2508,7 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1));
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", tmp);
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", tmp);
mir_free(tmp);
s+=3;
s2 = output.find(">", s);
@@ -2517,7 +2517,7 @@ void ImportKey()
tmp = (char*) mir_alloc(sizeof(char)*(output.substr(s,s2-s).length()+1));
strcpy(tmp, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", tmp);
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", tmp);
mir_free(tmp);
}
}
@@ -2526,11 +2526,11 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1));
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
mir_free(tmp);
}
}
- DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust");
+ db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust");
}
}
else
@@ -2538,7 +2538,7 @@ void ImportKey()
char *tmp = NULL;
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
s = output.find("“", s2);
if(s == string::npos)
{
@@ -2563,7 +2563,7 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)*(output.substr(s,s2-s-(uncommon?1:0)).length()+1));
strcpy(tmp, output.substr(s,s2-s-(uncommon?1:0)).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", tmp);
+ db_set_s(hContact, szGPGModuleName, "KeyMainName", tmp);
mir_free(tmp);
}
if((s = output.find(")", s2)) == string::npos)
@@ -2578,7 +2578,7 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1));
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", tmp);
+ db_set_s(hContact, szGPGModuleName, "KeyComment", tmp);
mir_free(tmp);
s+=3;
s2 = output.find(">", s);
@@ -2587,7 +2587,7 @@ void ImportKey()
tmp = (char*) mir_alloc(sizeof(char)*(output.substr(s,s2-s).length()+1));
strcpy(tmp, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", tmp);
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", tmp);
mir_free(tmp);
}
}
@@ -2596,11 +2596,11 @@ void ImportKey()
tmp = (char*)mir_alloc(sizeof(char)* (output.substr(s2,s-s2).length()+1));
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
mir_free(tmp);
}
}
- DBDeleteContactSetting(hContact, szGPGModuleName, "bAlwatsTrust");
+ db_unset(hContact, szGPGModuleName, "bAlwatsTrust");
}
}
ptmp = mir_wstrdup(toUTF16(output).c_str());
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index b9c87a5595..7ad33d4cc6 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -55,13 +55,13 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
}
else
{
- DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1);
setSrmmIcon(hContact);
setClistIcon(hContact);
}
if(isContactHaveKey(hContact))
{
- DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1);
setSrmmIcon(hContact);
setClistIcon(hContact);
}
@@ -154,11 +154,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
{
boost::filesystem::remove(path);
HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags));
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message");
HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
return;
}
if(result == pxNotFound)
@@ -183,11 +183,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR))+" password needed, trying to get one");
if(_terminate)
{
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message");
HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
break;
}
{ //save inkey id
@@ -195,7 +195,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
s = out.find(" ID ", s);
s += strlen(" ID ");
string::size_type s2 = out.find(",",s);
- DBWriteContactSettingString(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
+ db_set_s(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
}
void ShowLoadKeyPasswordWindow();
new_key_hcnt_mutex.lock();
@@ -221,11 +221,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
{
boost::filesystem::remove(path);
HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags));
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message");
HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
return;
}
if(result == pxNotFound)
@@ -240,11 +240,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
{
boost::filesystem::remove(path);
HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags));
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message");
HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
return;
}
if(result == pxNotFound)
@@ -271,11 +271,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
char *tmp = (char*)mir_alloc(sizeof(char)*(str.length()+1));
strcpy(tmp, str.c_str());
HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags));
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message");
HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
mir_free(tmp);
return;
}
@@ -308,11 +308,11 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
debuglog<<std::string(time_str()+": info: Failed to decrypt GPG encrypted message.");
char *tmp = mir_strdup(str.c_str());
HistoryLog(hContact, db_event(msg, timestamp, 0, dbflags));
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"Unable to decrypt PGP encrypted message");
HistoryLog(hContact, db_event("Error message sent", 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
mir_free(tmp);
return;
}
@@ -341,7 +341,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
}
}
}
- if(DBGetContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0))
+ if(db_get_b(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0))
{
if(metaIsSubcontact(hContact))
{
@@ -392,7 +392,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
if(bDebugLog)
debuglog<<std::string(time_str()+": info(autoexchange): found pubkey block:"+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----"));
- DBWriteContactSettingTString(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str());
+ db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str());
{ //gpg execute block
std::vector<wstring> cmd;
TCHAR tmp2[MAX_PATH] = {0};
@@ -441,7 +441,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
char *tmp = NULL;
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
string::size_type s2 = output.find(":", s);
- DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
+ db_set_s(ccs->hContact, szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str());
s2+=2;
s = output.find("“", s2);
if(s == string::npos)
@@ -458,7 +458,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
tmp = (char*)mir_alloc(output.substr(s,s2-s-1).length()+1);
strcpy(tmp, output.substr(s,s2-s-1).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyMainName", tmp);
+ db_set_s(ccs->hContact, szGPGModuleName, "KeyMainName", tmp);
mir_free(tmp);
if((s = output.find(")", s2)) == string::npos)
s = output.find(">", s2);
@@ -470,14 +470,14 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
tmp = (char*)mir_alloc(output.substr(s2,s-s2).length()+1);
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyComment", tmp);
+ db_set_s(ccs->hContact, szGPGModuleName, "KeyComment", tmp);
mir_free(tmp);
s+=3;
s2 = output.find(">", s);
tmp = (char*)mir_alloc(output.substr(s,s2-s).length()+1);
strcpy(tmp, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyMainEmail", tmp);
+ db_set_s(ccs->hContact, szGPGModuleName, "KeyMainEmail", tmp);
mir_free(tmp);
}
else
@@ -485,11 +485,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
tmp = (char*)mir_alloc(output.substr(s2,s-s2).length()+1);
strcpy(tmp, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp, 0);
- DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(ccs->hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
mir_free(tmp);
}
- DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1);
- DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "bAlwatsTrust", 1);
+ db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(ccs->hContact, szGPGModuleName, "bAlwatsTrust", 1);
void setSrmmIcon(HANDLE);
void setClistIcon(HANDLE);
setSrmmIcon(ccs->hContact);
@@ -541,14 +541,14 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
char *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
if(tmp[0])
{
- int enc_state = DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 0);
+ int enc_state = db_get_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 0);
if(enc_state)
- DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 0);
string str = "-----PGP KEY RESPONSE-----";
str.append(tmp);
CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)str.c_str());
if(enc_state)
- DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(ccs->hContact, szGPGModuleName, "GPGEncryption", 1);
}
mir_free(tmp);
return 0;
@@ -556,7 +556,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
else if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist)
{
char *proto = GetContactProto(ccs->hContact);
- DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0);
+ DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0);
if(uin) {
char svc[64];
strcpy(svc, proto);
@@ -645,7 +645,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
cmd.push_back(L"\"\"");
cmd.push_back(L"--no-version");
}
- if(DBGetContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 0))
+ if(db_get_b(hContact, szGPGModuleName, "bAlwaysTrust", 0))
{
cmd.push_back(L"--trust-model");
cmd.push_back(L"always");
@@ -696,7 +696,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
out.clear();
if(MessageBox(0, TranslateT("We trying to encrypt with untrusted key, do you want to trust this key permanently ?"), TranslateT("Warning"), MB_YESNO) == IDYES)
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 1);
+ db_set_b(hContact, szGPGModuleName, "bAlwaysTrust", 1);
std::vector<std::wstring> tmp;
tmp.push_back(L"--trust-model");
tmp.push_back(L"always");
@@ -833,7 +833,7 @@ int SendMsgSvc(WPARAM w, LPARAM l)
debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
void send_encrypted_msgs_thread(HANDLE hContact);
LPSTR proto = GetContactProto(ccs->hContact);
- DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0);
+ DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0);
if(uin)
{
if(bDebugLog)
@@ -959,7 +959,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
void send_encrypted_msgs_thread(HANDLE hContact);
LPSTR proto = GetContactProto(hContact);
- DWORD uin = DBGetContactSettingDword(hContact, proto, "UIN", 0);
+ DWORD uin = db_get_dw(hContact, proto, "UIN", 0);
if(uin)
{
if(bDebugLog)
@@ -1138,10 +1138,10 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam
string dbsetting = "szKey_";
dbsetting += inkeyid;
dbsetting += "_Password";
- DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp);
+ db_set_ts(NULL, szGPGModuleName, dbsetting.c_str(), tmp);
}
else
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szKeyPassword", tmp);
}
if(password)
mir_free(password);
@@ -1182,8 +1182,8 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_DESTROY:
{
GetWindowRect(hwndDlg, &key_password_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "PasswordWindowX", key_password_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "PasswordWindowY", key_password_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "PasswordWindowX", key_password_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "PasswordWindowY", key_password_rect.top);
}
break;
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 3f378fa70f..26c7fd010e 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -25,7 +25,7 @@ static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef)
{
- BOOL state = DBGetContactSettingByte(NULL, szGPGModuleName, szSetting, bDef);
+ BOOL state = db_get_b(NULL, szGPGModuleName, szSetting, bDef);
CheckDlgButton(hwndDlg, idCtrl, state);
return state;
}
@@ -33,7 +33,7 @@ BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef
BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting)
{
BOOL state = IsDlgButtonChecked(hwndDlg, idCtrl);
- DBWriteContactSettingByte(NULL, szGPGModuleName, szSetting, (BYTE)state);
+ db_set_b(NULL, szGPGModuleName, szSetting, (BYTE)state);
return state;
}
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
mir_free(tmp2);
ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set"));
mir_free(tmp);
- if(DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0))
+ if(db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0))
ListView_SetCheckState(hwndList, iRow, 1);
user_data[i] = hContact;
ZeroMemory(&item,sizeof(item));
@@ -299,12 +299,12 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
hcnt = metaGetSubcontact(meta, i);
if(hcnt)
{
- DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyID");
- DBDeleteContactSetting(hcnt, szGPGModuleName, "GPGPubKey");
- DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyMainName");
- DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyType");
- DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyMainEmail");
- DBDeleteContactSetting(hcnt, szGPGModuleName, "KeyComment");
+ db_unset(hcnt, szGPGModuleName, "KeyID");
+ db_unset(hcnt, szGPGModuleName, "GPGPubKey");
+ db_unset(hcnt, szGPGModuleName, "KeyMainName");
+ db_unset(hcnt, szGPGModuleName, "KeyType");
+ db_unset(hcnt, szGPGModuleName, "KeyMainEmail");
+ db_unset(hcnt, szGPGModuleName, "KeyComment");
setClistIcon(hcnt);
setSrmmIcon(hcnt);
}
@@ -312,24 +312,24 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
else
{
- DBDeleteContactSetting(hContact, szGPGModuleName, "KeyID");
- DBDeleteContactSetting(hContact, szGPGModuleName, "GPGPubKey");
- DBDeleteContactSetting(hContact, szGPGModuleName, "KeyMainName");
- DBDeleteContactSetting(hContact, szGPGModuleName, "KeyType");
- DBDeleteContactSetting(hContact, szGPGModuleName, "KeyMainEmail");
- DBDeleteContactSetting(hContact, szGPGModuleName, "KeyComment");
+ db_unset(hContact, szGPGModuleName, "KeyID");
+ db_unset(hContact, szGPGModuleName, "GPGPubKey");
+ db_unset(hContact, szGPGModuleName, "KeyMainName");
+ db_unset(hContact, szGPGModuleName, "KeyType");
+ db_unset(hContact, szGPGModuleName, "KeyMainEmail");
+ db_unset(hContact, szGPGModuleName, "KeyComment");
setClistIcon(hContact);
setSrmmIcon(hContact);
}
}
else
{
- DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyID");
- DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "GPGPubKey");
- DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyMainName");
- DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyType");
- DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyMainEmail");
- DBDeleteContactSetting(user_data[item_num+1], szGPGModuleName, "KeyComment");
+ db_unset(user_data[item_num+1], szGPGModuleName, "KeyID");
+ db_unset(user_data[item_num+1], szGPGModuleName, "GPGPubKey");
+ db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainName");
+ db_unset(user_data[item_num+1], szGPGModuleName, "KeyType");
+ db_unset(user_data[item_num+1], szGPGModuleName, "KeyMainEmail");
+ db_unset(user_data[item_num+1], szGPGModuleName, "KeyComment");
setClistIcon(user_data[item_num+1]);
setSrmmIcon(user_data[item_num+1]);
}
@@ -440,9 +440,9 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
void setClistIcon(HANDLE hContact);
void setSrmmIcon(HANDLE hContact);
if(ListView_GetCheckState(hwndList, item_num))
- DBWriteContactSettingByte(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1);
else
- DBWriteContactSettingByte(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 0);
setClistIcon(user_data[item_num+1]);
setSrmmIcon(user_data[item_num+1]);
}
@@ -457,18 +457,18 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if(bDebugLog)
debuglog.init();
bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI");
- bool old_bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0);
+ bool old_bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0);
bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers");
if(bFileTransfers != old_bFileTransfers)
{
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 0);
bSameAction = false;
}
bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange");
{
TCHAR tmp[512];
GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szLogFilePath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp);
}
return TRUE;
}
@@ -516,7 +516,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
bool bad_version = false;
TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T(""));
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -527,7 +527,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
params.code = &code;
params.result = &result;
gpg_launcher(params);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp_path);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp_path);
mir_free(tmp_path);
string::size_type p1 = out.find("(GnuPG) ");
if(p1 != string::npos)
@@ -593,11 +593,11 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
TCHAR tmp[512];
GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512);
while(tmp[_tcslen(tmp)-1] == '\\')
tmp[_tcslen(tmp)-1] = '\0';
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
return TRUE;
}
}
@@ -660,22 +660,22 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
{
TCHAR tmp[128];
GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szInOpenTag", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(inopentag, tmp);
GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, 128);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szInCloseTag", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(inclosetag, tmp);
GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, 128);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szOutOpenTag", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(outopentag, tmp);
GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, 128);
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szOutCloseTag", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1));
_tcscpy(outclosetag, tmp);
@@ -927,14 +927,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingTString(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
+ db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
}
}
else
- DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
+ db_set_ts(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
}
else
- DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
+ db_set_ts(hContact, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str());
}
tmp = (TCHAR*)mir_alloc(sizeof( TCHAR) * (key_buf.length()+1));
_tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str());
@@ -992,14 +992,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBDeleteContactSetting(hcnt, szGPGModuleName, "bAlwatsTrust");
+ db_unset(hcnt, szGPGModuleName, "bAlwatsTrust");
}
}
else
- DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust");
+ db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust");
}
else
- DBDeleteContactSetting(hContact, szGPGModuleName, "bAlwatsTrust");
+ db_unset(hContact, szGPGModuleName, "bAlwatsTrust");
}
{
TCHAR *tmp;
@@ -1026,14 +1026,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyID", tmp2);
+ db_set_s(hcnt, szGPGModuleName, "KeyID", tmp2);
}
}
else
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2);
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", tmp2);
}
else
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2);
+ db_set_s(hContact, szGPGModuleName, "KeyID", tmp2);
}
mir_free(tmp2);
tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str());
@@ -1076,14 +1076,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
+ db_set_s(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
}
}
else
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
}
else
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
}
mir_free(tmp2);
tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s-1)).c_str());
@@ -1114,14 +1114,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
+ db_set_s(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
}
}
else
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
}
else
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
}
mir_free(tmp2);
s+=3;
@@ -1141,14 +1141,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
+ db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
}
}
else
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
}
else
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
}
mir_free(tmp2);
tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str());
@@ -1173,14 +1173,14 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingString(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
}
}
else
- DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
}
else
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
}
mir_free(tmp2);
tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str());
@@ -1224,7 +1224,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
{
out.erase(s, 1);
}
- DBWriteContactSettingString(hContact, szGPGModuleName, "GPGPubKey", out.c_str());
+ db_set_s(hContact, szGPGModuleName, "GPGPubKey", out.c_str());
}
}
tmp = mir_wstrdup(toUTF16(output).c_str());
@@ -1251,23 +1251,23 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
if(hcnt)
{
if(!isContactSecured(hcnt))
- DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 1);
else
- DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hcnt, szGPGModuleName, "GPGEncryption", 0);
setSrmmIcon(hContact);
setClistIcon(hContact);
}
}
}
else if(!isContactSecured(hContact))
- DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1);
else
- DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);
}
else if(!isContactSecured(hContact))
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
else
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
}
}
DestroyWindow(hwndDlg);
@@ -1351,8 +1351,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
case WM_DESTROY:
GetWindowRect(hwndDlg, &load_key_rect);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left);
- DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top);
+ db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowX", load_key_rect.left);
+ db_set_dw(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top);
break;
}
diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp
index 6fc204a9a9..85e149214e 100755
--- a/plugins/New_GPG/src/srmm.cpp
+++ b/plugins/New_GPG/src/srmm.cpp
@@ -49,11 +49,11 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) {
void setSrmmIcon(HANDLE);
void setClistIcon(HANDLE);
bool isContactHaveKey(HANDLE hContact);
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
if(enc)
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 0):0;
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 0):0;
setSrmmIcon(hContact);
setClistIcon(hContact);
}
@@ -70,16 +70,16 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) {
}
else
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
- hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
+ hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
setSrmmIcon(hContact);
setClistIcon(hContact);
return 0;
}
if(isContactHaveKey(hContact))
{
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
- hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
+ hMeta?db_set_b(hMeta, szGPGModuleName, "GPGEncryption", 1):0;
setSrmmIcon(hContact);
setClistIcon(hContact);
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 82976fa50d..4dd31b3a1a 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -22,11 +22,11 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,c
{
DBVARIANT dbv = {DBVT_DELETED};
TCHAR* szRes;
- if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
+ if (db_get_ts(hContact, szModule, szSetting, &dbv))
return mir_tstrdup(szDef);
if(dbv.pszVal)
szRes = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return szRes;
}
@@ -34,11 +34,11 @@ char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,co
{
DBVARIANT dbv = {DBVT_DELETED};
char* szRes;
- if (DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
+ if (db_get_s(hContact, szModule, szSetting, &dbv))
return mir_strdup(szDef);
if(dbv.pszVal)
szRes = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return szRes;
}
@@ -66,7 +66,7 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx
ofn.nMaxFileTitle=MAX_PATH;
if(!GetOpenFileName(&ofn))
return;
- DBWriteContactSettingTString(0, szGPGModuleName, szSetting, str);
+ db_set_ts(0, szGPGModuleName, szSetting, str);
}
TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file)
@@ -119,7 +119,7 @@ void GetFolderPath(TCHAR *WindowTittle, char *szSetting)
TCHAR path[MAX_PATH];
if (SHGetPathFromIDList(pidl, path))
{
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", path);
+ db_set_ts(NULL, szGPGModuleName, "szHomePath", path);
}
IMalloc * imalloc = 0;
if (SUCCEEDED(SHGetMalloc(&imalloc)))
@@ -169,8 +169,8 @@ INT_PTR SendKey(WPARAM w, LPARAM l)
}
if(szMessage[0])
{
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 0);
CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage);
std::string msg = "Public key ";
char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, key_id_str.c_str(), "");
@@ -185,7 +185,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l)
mir_free(szMessage);
szMessage = mir_strdup(msg.c_str());
HistoryLog(hContact, db_event(szMessage, 0, 0, DBEF_SENT));
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc);
}
else
mir_free(szMessage);
@@ -199,9 +199,9 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l)
HANDLE hContact = (HANDLE)w;
BYTE enc = 0;
if(metaIsProtoMetaContacts(hContact))
- enc = DBGetContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);
+ enc = db_get_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0);
else
- enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
if(metaIsProtoMetaContacts(hContact))
{
HANDLE hcnt = NULL;
@@ -212,13 +212,13 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l)
{
hcnt = metaGetSubcontact(hContact, i);
if(hcnt)
- DBWriteContactSettingByte(hcnt, szGPGModuleName, "GPGEncryption", enc?0:1);
+ db_set_b(hcnt, szGPGModuleName, "GPGEncryption", enc?0:1);
}
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
}
}
else
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
void setSrmmIcon(HANDLE hContact);
void setClistIcon(HANDLE hContact);
setSrmmIcon(hContact);
@@ -267,12 +267,12 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l)
TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
if(_tcslen(tmp) < 1)
{
- DBDeleteContactSetting(hContact, szGPGModuleName, "GPGEncryption");
+ db_unset(hContact, szGPGModuleName, "GPGEncryption");
mi.flags += CMIM_FLAGS | CMIF_GRAYED;
}
else
mi.flags = CMIM_NAME | CMIM_FLAGS;
- mi.pszName = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption";
+ mi.pszName = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption";
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi);
return 0;
}
@@ -401,9 +401,9 @@ int onProtoAck(WPARAM w, LPARAM l)
s += strlen(" ID ");
string::size_type s2 = out.find(",",s);
if(metaIsProtoMetaContacts(ack->hContact))
- DBWriteContactSettingString(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
+ db_set_s(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
else
- DBWriteContactSettingString(ack->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
+ db_set_s(ack->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str());
}
void ShowLoadKeyPasswordWindow();
new_key_hcnt_mutex.lock();
@@ -490,7 +490,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename)
TCHAR *file_out = new TCHAR [_tcslen(filename)+4];
mir_sntprintf(file_out, _tcslen(name)+7, _T("%s.gpg"), name);
cmd.push_back(szKeyid);
- if(DBGetContactSettingByte(hcnt, szGPGModuleName, "bAlwaysTrust", 0))
+ if(db_get_b(hcnt, szGPGModuleName, "bAlwaysTrust", 0))
{
cmd.push_back(L"--trust-model");
cmd.push_back(L"always");
@@ -518,7 +518,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename)
out.clear();
if(MessageBox(0, TranslateT("We trying to encrypt with untrusted key, do you want to trust this key permanently ?"), TranslateT("Warning"), MB_YESNO) == IDYES)
{
- DBWriteContactSettingByte(hcnt, szGPGModuleName, "bAlwaysTrust", 1);
+ db_set_b(hcnt, szGPGModuleName, "bAlwaysTrust", 1);
std::vector<std::wstring> tmp;
tmp.push_back(L"--trust-model");
tmp.push_back(L"always");
@@ -541,7 +541,7 @@ int onSendFile(WPARAM w, LPARAM l)
if(isContactSecured(ccs->hContact))
{
char *proto = GetContactProto(ccs->hContact);
- DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0);
+ DWORD uin = db_get_dw(ccs->hContact, proto, "UIN", 0);
bool cap_found = false, supported_proto = false;
if(uin)
{
@@ -1072,7 +1072,7 @@ void AddHandlers()
bool isContactSecured(HANDLE hContact)
{
- BYTE gpg_enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ BYTE gpg_enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
if(!gpg_enc)
{
if(bDebugLog)
@@ -1155,7 +1155,7 @@ bool isGPGValid()
DWORD len = MAX_PATH;
if(gpg_exists)
{
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
string out;
DWORD code;
std::vector<wstring> cmd;
@@ -1206,7 +1206,7 @@ const bool StriStr(const char *str, const char *substr)
bool IsOnline(HANDLE hContact)
{
- if(DBGetContactSettingByte(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE)
+ if(db_get_b(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE)
return false;
return true;
}
@@ -1354,7 +1354,7 @@ int handleEnum(const char *szSetting, LPARAM lParam)
if(!*(bool*)lParam && szSetting[0] && StriStr(szSetting, "tabsrmm"))
{
bool f = false, *found = (bool*)lParam;
- f = !DBGetContactSettingByte(NULL, "PluginDisable", szSetting, 0);
+ f = !db_get_b(NULL, "PluginDisable", szSetting, 0);
if(f)
*found = f;
}
@@ -1810,7 +1810,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
tmp2 = (char*)mir_alloc((output.substr(s,s2-s).length()+1) * sizeof(char));
strcpy(tmp2, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp2, 0);
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyID", tmp2);
+ db_set_s(hContact, szGPGModuleName, "KeyID", tmp2);
mir_free(tmp2);
s = output.find("“", s2);
if(s == string::npos)
@@ -1831,7 +1831,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
mir_utf8decode(tmp2, 0);
if(hContact)
{
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str());
}
mir_free(tmp2);
if((s = output.find(")", s2)) == string::npos)
@@ -1845,7 +1845,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
strcpy(tmp2, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp2, 0);
if(hContact)
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str());
mir_free(tmp2);
s+=3;
s2 = output.find(">", s);
@@ -1853,7 +1853,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
strcpy(tmp2, output.substr(s,s2-s).c_str());
mir_utf8decode(tmp2, 0);
if(hContact)
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str());
mir_free(tmp2);
}
else
@@ -1862,12 +1862,12 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
strcpy(tmp2, output.substr(s2,s-s2).c_str());
mir_utf8decode(tmp2, 0);
if(hContact)
- DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
+ db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str());
mir_free(tmp2);
}
}
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
- DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str());
+ db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1);
+ db_set_ts(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str());
}
boost::filesystem::remove(path);
break;
@@ -1983,7 +1983,7 @@ static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARA
case IDC_IGNORE:
if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
{
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 1);
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 1);
bSameAction = true;
}
DestroyWindow(hwndDlg);
@@ -1993,9 +1993,9 @@ static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARA
file_msg_state = 1;
if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
{
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1);
+ db_set_b(NULL, szGPGModuleName, "bFileTransfers", 1);
bFileTransfers = true;
- DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 0);
bSameAction = false;
}