summaryrefslogtreecommitdiff
path: root/plugins/AvatarHistory/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AvatarHistory/src')
-rw-r--r--plugins/AvatarHistory/src/AvatarDlg.cpp19
-rw-r--r--plugins/AvatarHistory/src/AvatarHistory.cpp6
-rw-r--r--plugins/AvatarHistory/src/utils.cpp2
3 files changed, 13 insertions, 14 deletions
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp
index 664f1892b8..cc5c63a9af 100644
--- a/plugins/AvatarHistory/src/AvatarDlg.cpp
+++ b/plugins/AvatarHistory/src/AvatarDlg.cpp
@@ -287,9 +287,9 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
case IDOK:
if (HIWORD(wParam) == BN_CLICKED) {
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- db_set_b(hContact, MODULENAME, "AvatarPopups", (BYTE)IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
- db_set_b(hContact, MODULENAME, "LogToDisk", (BYTE)IsDlgButtonChecked(hwnd, IDC_LOGUSER));
- db_set_b(hContact, MODULENAME, "LogToHistory", (BYTE)IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));
+ g_plugin.setByte(hContact, "AvatarPopups", (BYTE)IsDlgButtonChecked(hwnd, IDC_POPUPUSER));
+ g_plugin.setByte(hContact, "LogToDisk", (BYTE)IsDlgButtonChecked(hwnd, IDC_LOGUSER));
+ g_plugin.setByte(hContact, "LogToHistory", (BYTE)IsDlgButtonChecked(hwnd, IDC_HISTORYUSER));
CleanupAvatarPic(hwnd);
EndDialog(hwnd, 0);
@@ -540,16 +540,15 @@ int ShowSaveDialog(HWND hwnd, wchar_t* fn, MCONTACT hContact)
ofn.Flags = OFN_PATHMUSTEXIST | OFN_DONTADDTORECENT;
ofn.lpstrDefExt = wcsrchr(fn, '.') + 1;
- DBVARIANT dbvInitDir = { 0 };
- if (!db_get_ws(hContact, MODULENAME, "SavedAvatarFolder", &dbvInitDir)) {
- ofn.lpstrInitialDir = dbvInitDir.pwszVal;
- db_free(&dbvInitDir);
- }
- else ofn.lpstrInitialDir = L".";
+ ptrW wszInitDir(g_plugin.getWStringA(hContact, "SavedAvatarFolder"));
+ if (wszInitDir)
+ ofn.lpstrInitialDir = wszInitDir;
+ else
+ ofn.lpstrInitialDir = L".";
if (GetSaveFileName(&ofn)) {
CopyFile(fn, file, FALSE);
- db_set_ws(hContact, MODULENAME, "SavedAvatarFolder", file);
+ g_plugin.setWString(hContact, "SavedAvatarFolder", file);
}
return 0;
}
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp
index 7ed09f7e59..99632fc836 100644
--- a/plugins/AvatarHistory/src/AvatarHistory.cpp
+++ b/plugins/AvatarHistory/src/AvatarHistory.cpp
@@ -105,7 +105,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
return 0;
DBVARIANT dbvOldHash = { 0 };
- bool ret = (db_get_ws(hContact, MODULENAME, "AvatarHash", &dbvOldHash) == 0);
+ bool ret = (g_plugin.getWString(hContact, "AvatarHash", &dbvOldHash) == 0);
CONTACTAVATARCHANGEDNOTIFICATION* avatar = (CONTACTAVATARCHANGEDNOTIFICATION*)lParam;
if (avatar == nullptr) {
@@ -119,7 +119,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
Skin_PlaySound("avatar_removed");
// Is a flash avatar or avs could not load it
- db_set_ws(hContact, MODULENAME, "AvatarHash", L"-");
+ g_plugin.setWString(hContact, "AvatarHash", L"-");
if (ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) && opts.popup_show_removed)
ShowPopup(hContact, nullptr, opts.popup_removed);
@@ -132,7 +132,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
Skin_PlaySound("avatar_changed");
- db_set_ws(hContact, "AvatarHistory", "AvatarHash", avatar->hash);
+ g_plugin.setWString(hContact, "AvatarHash", avatar->hash);
wchar_t history_filename[MAX_PATH] = L"";
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp
index a3af7ab9bd..9c86cfbc72 100644
--- a/plugins/AvatarHistory/src/utils.cpp
+++ b/plugins/AvatarHistory/src/utils.cpp
@@ -39,7 +39,7 @@ bool ContactEnabled(MCONTACT hContact, char *setting, int def)
return false;
BYTE globpref = g_plugin.getByte(setting, def);
- BYTE userpref = db_get_b(hContact, MODULENAME, setting, BST_INDETERMINATE);
+ BYTE userpref = g_plugin.getByte(hContact, setting, BST_INDETERMINATE);
return (globpref && userpref == BST_INDETERMINATE) || userpref == BST_CHECKED;
}