diff options
Diffstat (limited to 'plugins/MirFox')
-rw-r--r-- | plugins/MirFox/src/MirandaOptions.cpp | 20 | ||||
-rw-r--r-- | plugins/MirFox/src/MirandaUtils.cpp | 8 | ||||
-rw-r--r-- | plugins/MirFox/src/MirfoxData.cpp | 49 |
3 files changed, 36 insertions, 41 deletions
diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index b316f3222b..03714b8c71 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -102,32 +102,32 @@ INT_PTR CALLBACK DlgProcOpts_Tab1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY){
//SaveOptions from tab1 mirfoxData to miranda database
mirfoxMiranda.getMirfoxData().leftClickSendMode = (MFENUM_SEND_MESSAGE_MODE)( 1 + (WORD)SendDlgItemMessage(hwndDlg, IDC1_COMBO1, CB_GETCURSEL, 0, 0));
- db_set_b(0, MODULENAME, "leftClickSendMode", (int)mirfoxMiranda.getMirfoxData().leftClickSendMode);
+ g_plugin.setByte("leftClickSendMode", (int)mirfoxMiranda.getMirfoxData().leftClickSendMode);
mirfoxMiranda.getMirfoxData().rightClickSendMode = (MFENUM_SEND_MESSAGE_MODE)( 1 + (WORD)SendDlgItemMessage(hwndDlg, IDC1_COMBO2, CB_GETCURSEL, 0, 0));
- db_set_b(0, MODULENAME, "rightClickSendMode", (int)mirfoxMiranda.getMirfoxData().rightClickSendMode);
+ g_plugin.setByte("rightClickSendMode", (int)mirfoxMiranda.getMirfoxData().rightClickSendMode);
mirfoxMiranda.getMirfoxData().middleClickSendMode = (MFENUM_SEND_MESSAGE_MODE)( 1 + (WORD)SendDlgItemMessage(hwndDlg, IDC1_COMBO3, CB_GETCURSEL, 0, 0));
- db_set_b(0, MODULENAME, "middleClickSendMode", (int)mirfoxMiranda.getMirfoxData().middleClickSendMode);
+ g_plugin.setByte("middleClickSendMode", (int)mirfoxMiranda.getMirfoxData().middleClickSendMode);
if (IsDlgButtonChecked(hwndDlg, IDC1_CHECK1) == BST_CHECKED){
mirfoxMiranda.getMirfoxData().setClientsProfilesFilterCheckbox(true);
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 1);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", 1);
} else {
mirfoxMiranda.getMirfoxData().setClientsProfilesFilterCheckbox(false);
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 2);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", 2);
}
if (IsDlgButtonChecked(hwndDlg, IDC1_CHECK2) == BST_CHECKED){
if (mirfoxMiranda.getMirfoxData().getAddAccountToContactNameCheckbox() != true){
mirfoxMiranda.getMirfoxData().setAddAccountToContactNameCheckbox(true);
- db_set_b(0, MODULENAME, "addAccountToContactNameCheckbox", 1);
+ g_plugin.setByte("addAccountToContactNameCheckbox", 1);
mirfoxMiranda.getMirfoxData().updateAllMirandaContactsNames(mirfoxMiranda.getSharedMemoryUtils());
}
} else {
if (mirfoxMiranda.getMirfoxData().getAddAccountToContactNameCheckbox() != false){
mirfoxMiranda.getMirfoxData().setAddAccountToContactNameCheckbox(false);
- db_set_b(0, MODULENAME, "addAccountToContactNameCheckbox", 2);
+ g_plugin.setByte("addAccountToContactNameCheckbox", 2);
mirfoxMiranda.getMirfoxData().updateAllMirandaContactsNames(mirfoxMiranda.getSharedMemoryUtils());
}
}
@@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM MFLogger* logger = MFLogger::getInstance();
logger->log_p(L"Options. Save clientsProfilesFilterString: [%s]", mirfoxMiranda.getMirfoxData().getClientsProfilesFilterStringPtr()->c_str());
- db_set_ws(0, MODULENAME, "clientsProfilesFilterString", mirfoxMiranda.getMirfoxData().getClientsProfilesFilterStringPtr()->c_str());
+ g_plugin.setWString("clientsProfilesFilterString", mirfoxMiranda.getMirfoxData().getClientsProfilesFilterStringPtr()->c_str());
//TODO fire actualization visableTo field at CSM record
@@ -641,9 +641,9 @@ INT_PTR CALLBACK DlgProcOpts_Tab3(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += accountId;
if (accountState == MFENUM_MIRANDAACCOUNT_STATE_OFF){
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 2);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 2);
} else {
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 1);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 1);
}
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 585a6bbdca..8e69fd7c72 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -351,7 +351,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) }
// show and focus window
- if (db_get_b(0, MODULENAME, "doNotFocusWhenOpenMW", 0) == 1){
+ if (g_plugin.getByte("doNotFocusWhenOpenMW", 0) == 1){
delete param;
return 0;
}
@@ -467,7 +467,7 @@ void MirandaUtils::translateOldDBNames() { //settings "clientsProfilesFilterCheckbox", "clientsProfilesFilterString"
int opt1KeyValue = db_get_b(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterCheckbox", 0);
if (opt1KeyValue != 0){
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", opt1KeyValue);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", opt1KeyValue);
db_unset(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterCheckbox");
logger->log(L"TranslateOldDBNames: 'clientsProfilesFilterCheckbox' db entry found and moved");
} else {
@@ -479,7 +479,7 @@ void MirandaUtils::translateOldDBNames() { INT_PTR opt2Result = db_get_s(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterString", &opt2Dbv, DBVT_WCHAR);
if (opt2Result == 0){ //success
std::wstring clientsProfilesFilterString = opt2Dbv.pwszVal;
- db_set_ws(0, MODULENAME, "clientsProfilesFilterString", clientsProfilesFilterString.c_str());
+ g_plugin.setWString("clientsProfilesFilterString", clientsProfilesFilterString.c_str());
db_unset(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterString");
logger->log(L"TranslateOldDBNames: 'clientsProfilesFilterString' db entry found and moved");
db_free(&opt2Dbv);
@@ -493,7 +493,7 @@ void MirandaUtils::translateOldDBNames() { mirandaAccountDBKey += pa->szModuleName;
int keyValue = db_get_b(0, OLD_PLUGIN_DB_ID, mirandaAccountDBKey.c_str(), 0);
if (keyValue != 0){
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), keyValue);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), keyValue);
db_unset(0, OLD_PLUGIN_DB_ID, mirandaAccountDBKey.c_str());
logger->log(L"TranslateOldDBNames: ACCOUNT db entry found and moved");
}
diff --git a/plugins/MirFox/src/MirfoxData.cpp b/plugins/MirFox/src/MirfoxData.cpp index 835f3d8c07..4f9611435d 100644 --- a/plugins/MirFox/src/MirfoxData.cpp +++ b/plugins/MirFox/src/MirfoxData.cpp @@ -268,7 +268,7 @@ void MirfoxData::refreshAccount_Add(SharedMemoryUtils& sharedMemoryUtils, char* MFENUM_MIRANDAACCOUNT_STATE getOrCreateAccountStateInDB(char* szModuleName);
std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += szModuleName;
- int keyValue = db_get_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 0);
+ int keyValue = g_plugin.getByte(mirandaAccountDBKey.c_str(), 0);
if (keyValue == 1 || keyValue == 2){
//setting exist
if (keyValue == 1){
@@ -280,10 +280,10 @@ void MirfoxData::refreshAccount_Add(SharedMemoryUtils& sharedMemoryUtils, char* //setting does not exist, or is invalid -> save default setting (1 - ON)
if (getAccountDefaultState(mirandaAccountItemPtr) == 1){ //on = 1
mirandaAccountItemPtr->accountState = MFENUM_MIRANDAACCOUNT_STATE_ON; //1
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 1);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 1);
} else { //off = 2
mirandaAccountItemPtr->accountState = MFENUM_MIRANDAACCOUNT_STATE_OFF; //2
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 2);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 2);
}
}
*/
@@ -337,7 +337,7 @@ void MirfoxData::refreshAccount_Delete(SharedMemoryUtils& sharedMemoryUtils, cha std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += szModuleName;
- db_unset(0, MODULENAME, mirandaAccountDBKey.c_str());
+ g_plugin.delSetting(mirandaAccountDBKey.c_str());
//del proto from SM
sharedMemoryUtils.refreshMsm_Delete('A', deletedId);
@@ -524,7 +524,7 @@ MirfoxData::createOrGetAccountStateFromDB(MirandaAccount* mirandaAccount){ std::string mirandaAccountDBKey("ACCOUNTSTATE_");
mirandaAccountDBKey += mirandaAccount->szModuleName;
- int keyValue = db_get_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 0);
+ int keyValue = g_plugin.getByte(mirandaAccountDBKey.c_str(), 0);
if (keyValue == 1 || keyValue == 2){
//setting exist
if (keyValue == 1){
@@ -535,10 +535,10 @@ MirfoxData::createOrGetAccountStateFromDB(MirandaAccount* mirandaAccount){ } else {
//setting does not exist, or is invalid -> save default setting (1 - ON)
if (getAccountDefaultState(mirandaAccount) == 1){ //on = 1
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 1);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 1);
return MFENUM_MIRANDAACCOUNT_STATE_ON; //1
} else { //off = 2
- db_set_b(0, MODULENAME, mirandaAccountDBKey.c_str(), 2);
+ g_plugin.setByte(mirandaAccountDBKey.c_str(), 2);
return MFENUM_MIRANDAACCOUNT_STATE_OFF; //2
}
}
@@ -658,7 +658,7 @@ void MirfoxData::initializeOptions() {
//addAccountToContactNameCheckbox
- int opt2KeyValue = db_get_b(0, MODULENAME, "addAccountToContactNameCheckbox", 0);
+ int opt2KeyValue = g_plugin.getByte("addAccountToContactNameCheckbox", 0);
if (opt2KeyValue == 1 || opt2KeyValue == 2){
//setting exist
if (opt2KeyValue == 1){
@@ -669,12 +669,12 @@ void MirfoxData::initializeOptions() } else {
//setting does not exist, or is invalid -> save default setting (2 - false)
setAddAccountToContactNameCheckbox(false); //2
- db_set_b(0, MODULENAME, "addAccountToContactNameCheckbox", 2);
+ g_plugin.setByte("addAccountToContactNameCheckbox", 2);
}
//clientsProfilesFilterCheckbox
- int opt1KeyValue = db_get_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 0);
+ int opt1KeyValue = g_plugin.getByte("clientsProfilesFilterCheckbox", 0);
if (opt1KeyValue == 1 || opt1KeyValue == 2){
//setting exist
if (opt1KeyValue == 1){
@@ -685,53 +685,48 @@ void MirfoxData::initializeOptions() } else {
//setting does not exist, or is invalid -> save default setting (2 - false)
setClientsProfilesFilterCheckbox(false); //2
- db_set_b(0, MODULENAME, "clientsProfilesFilterCheckbox", 2);
+ g_plugin.setByte("clientsProfilesFilterCheckbox", 2);
}
-
- //clientsProfilesFilterString
- DBVARIANT opt2Dbv = {0};
- INT_PTR opt2Result = db_get_s(0, MODULENAME, "clientsProfilesFilterString", &opt2Dbv, DBVT_WCHAR);
- if (opt2Result == 0){ //success
+ // clientsProfilesFilterString
+ ptrW opt2Result(g_plugin.getWStringA("clientsProfilesFilterString"));
+ if (opt2Result != nullptr) { // success
//option exists in DB, get value
- (* getClientsProfilesFilterStringPtr()) = opt2Dbv.pwszVal;
+ (* getClientsProfilesFilterStringPtr()) = opt2Result;
} else {
//option not exists in DB, set default value
(* getClientsProfilesFilterStringPtr()) = L"";
- db_set_ws(0, MODULENAME, "clientsProfilesFilterString", getClientsProfilesFilterStringPtr()->c_str());
+ g_plugin.setWString("clientsProfilesFilterString", getClientsProfilesFilterStringPtr()->c_str());
}
- db_free(&opt2Dbv);
-
-
- int opt3KeyValue = db_get_b(0, MODULENAME, "leftClickSendMode", 0);
+ int opt3KeyValue = g_plugin.getByte("leftClickSendMode", 0);
if (opt3KeyValue == MFENUM_SMM_ONLY_SEND || opt3KeyValue == MFENUM_SMM_SEND_AND_SHOW_MW || opt3KeyValue == MFENUM_SMM_ONLY_SHOW_MW){
//setting exist
leftClickSendMode = (MFENUM_SEND_MESSAGE_MODE)opt3KeyValue;
} else {
//setting does not exist, or is invalid -> save default setting (MFENUM_SMM_ONLY_SEND)
leftClickSendMode = MFENUM_SMM_ONLY_SEND;
- db_set_b(0, MODULENAME, "leftClickSendMode", MFENUM_SMM_ONLY_SEND);
+ g_plugin.setByte("leftClickSendMode", MFENUM_SMM_ONLY_SEND);
}
- int opt4KeyValue = db_get_b(0, MODULENAME, "rightClickSendMode", 0);
+ int opt4KeyValue = g_plugin.getByte("rightClickSendMode", 0);
if (opt4KeyValue == MFENUM_SMM_ONLY_SEND || opt4KeyValue == MFENUM_SMM_SEND_AND_SHOW_MW || opt4KeyValue == MFENUM_SMM_ONLY_SHOW_MW){
//setting exist
rightClickSendMode = (MFENUM_SEND_MESSAGE_MODE)opt4KeyValue;
} else {
//setting does not exist, or is invalid -> save default setting (MFENUM_SMM_SEND_AND_SHOW_MW)
rightClickSendMode = MFENUM_SMM_SEND_AND_SHOW_MW;
- db_set_b(0, MODULENAME, "rightClickSendMode", MFENUM_SMM_SEND_AND_SHOW_MW);
+ g_plugin.setByte("rightClickSendMode", MFENUM_SMM_SEND_AND_SHOW_MW);
}
- int opt5KeyValue = db_get_b(0, MODULENAME, "middleClickSendMode", 0);
+ int opt5KeyValue = g_plugin.getByte("middleClickSendMode", 0);
if (opt5KeyValue == MFENUM_SMM_ONLY_SEND || opt5KeyValue == MFENUM_SMM_SEND_AND_SHOW_MW || opt5KeyValue == MFENUM_SMM_ONLY_SHOW_MW){
//setting exist
middleClickSendMode = (MFENUM_SEND_MESSAGE_MODE)opt5KeyValue;
} else {
//setting does not exist, or is invalid -> save default setting (must be MFENUM_SMM_ONLY_SEND due to Firefox bug and crash)
middleClickSendMode = MFENUM_SMM_ONLY_SEND;
- db_set_b(0, MODULENAME, "middleClickSendMode", MFENUM_SMM_ONLY_SEND);
+ g_plugin.setByte("middleClickSendMode", MFENUM_SMM_ONLY_SEND);
}
|