summaryrefslogtreecommitdiff
path: root/plugins/RecentContacts
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-24 11:11:26 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-24 11:11:26 +0300
commitd296f9f99daf102b9af5d56690e2bd00d61c1267 (patch)
tree39311caaf80abf0b47ecb78cf94dc8157b193575 /plugins/RecentContacts
parentffc521e5d5e9bd66feb65afe0046b3fc7e073356 (diff)
database:
- senseless fiels ptszVal removed from DBVARIANT, pwszVal is used instead; - if you want db_get to return a string, you need to use db_get_s.
Diffstat (limited to 'plugins/RecentContacts')
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp
index 2951ff1ce0..7ebf619817 100644
--- a/plugins/RecentContacts/src/RecentContacts.cpp
+++ b/plugins/RecentContacts/src/RecentContacts.cpp
@@ -51,14 +51,11 @@ void LoadDBSettings()
LastUCOpt.HideOffline = db_get_b(NULL, MODULENAME, dbLastUC_HideOfflineContacts, 0);
LastUCOpt.WindowAutoSize = db_get_b(NULL, MODULENAME, dbLastUC_WindowAutosize, 0);
- DBVARIANT dbv;
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = nullptr;
- if (db_get(NULL, MODULENAME, dbLastUC_DateTimeFormat, &dbv) == 0 && dbv.pszVal[0] != 0) {
- LastUCOpt.DateTimeFormat = dbv.pszVal;
- db_free(&dbv);
- }
- else LastUCOpt.DateTimeFormat = "(%Y-%m-%d %H:%M) ";
+ ptrA szFormat(db_get_sa(NULL, MODULENAME, dbLastUC_DateTimeFormat));
+ if (szFormat)
+ LastUCOpt.DateTimeFormat = szFormat;
+ else
+ LastUCOpt.DateTimeFormat = "(%Y-%m-%d %H:%M) ";
}
void ShowListMainDlgProc_AdjustListPos(HWND hDlg, LASTUC_DLG_DATA *DlgDat)
@@ -208,15 +205,9 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
std::wstring str;
char strtim[256 + 16];
- string strtimformat;
- DBVARIANT dbv;
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = nullptr;
- if (db_get(NULL, MODULENAME, dbLastUC_DateTimeFormat, &dbv) == 0) {
- strtimformat = dbv.pszVal;
- db_free(&dbv);
- }
- else strtimformat = dbLastUC_DateTimeFormatDefault;
+ ptrA szFormat(db_get_sa(NULL, MODULENAME, dbLastUC_DateTimeFormat));
+ if (!szFormat)
+ szFormat = mir_strdup(dbLastUC_DateTimeFormatDefault);
for (auto curContact = DlgDat->Contacts->begin(); curContact != DlgDat->Contacts->end(); curContact++) {
if (curContact->second != NULL && db_get_b(curContact->second, MODULENAME, dbLastUC_IgnoreContact, 0) == 0) {
@@ -234,7 +225,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
lvi.iSubItem = 0;
lvi.lParam = (LPARAM)curContact->second;
- strftime(strtim, 256, strtimformat.c_str(), _localtime64(&curContact->first));
+ strftime(strtim, 256, szFormat, _localtime64(&curContact->first));
strtim[255] = 0;
str = _A2T(strtim);
str += cname;