From 30dd1623d85c3f8719b9668bc03b4bda26adc2e9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 23:50:45 +0300 Subject: SeenPlugin -> g_plugin --- plugins/SeenPlugin/src/file.cpp | 4 +- plugins/SeenPlugin/src/history.cpp | 32 +++++------ plugins/SeenPlugin/src/main.cpp | 12 ++-- plugins/SeenPlugin/src/menu.cpp | 8 +-- plugins/SeenPlugin/src/missed.cpp | 14 ++--- plugins/SeenPlugin/src/options.cpp | 96 +++++++++++++++---------------- plugins/SeenPlugin/src/stdafx.h | 2 +- plugins/SeenPlugin/src/userinfo.cpp | 2 +- plugins/SeenPlugin/src/utils.cpp | 112 ++++++++++++++++++------------------ 9 files changed, 142 insertions(+), 140 deletions(-) (limited to 'plugins/SeenPlugin') diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index ac3d85b774..e3e7d6b2e4 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -30,7 +30,7 @@ static wchar_t *g_ptszFileStamp, *g_ptszFileName; void InitFileOutput(void) { - ptrW tszFileName(db_get_wsa(NULL, S_MOD, "FileName")); + ptrW tszFileName(g_plugin.getWStringA("FileName")); if (tszFileName == NULL) tszFileName = mir_wstrdup(DEFAULT_FILENAME); replaceStrW(g_ptszFileName, VARSW(tszFileName)); @@ -40,7 +40,7 @@ void InitFileOutput(void) if (p) *p = 0; CreateDirectoryTreeW(tszPath); - ptrW tszFileStamp(db_get_wsa(NULL, S_MOD, "FileStamp")); + ptrW tszFileStamp(g_plugin.getWStringA("FileStamp")); replaceStrW(g_ptszFileStamp, (tszFileStamp == NULL) ? DEFAULT_FILESTAMP : tszFileStamp); } diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index befb0be96e..5284183ff8 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -34,7 +34,7 @@ char* BuildSetting(int historyLast) void HistoryWrite(MCONTACT hContact) { - int historyMax = db_get_w(0, S_MOD, "HistoryMax", 10); + int historyMax = g_plugin.getWord("HistoryMax", 10); if (historyMax < 0) historyMax = 0; else if (historyMax > 99) @@ -42,33 +42,33 @@ void HistoryWrite(MCONTACT hContact) if (historyMax == 0) return; - int historyFirst = db_get_w(hContact, S_MOD, "HistoryFirst", 0); + int historyFirst = g_plugin.getWord(hContact, "HistoryFirst", 0); if (historyFirst >= historyMax) historyFirst = 0; - int historyLast = db_get_w(hContact, S_MOD, "HistoryLast", 0); + int historyLast = g_plugin.getWord(hContact, "HistoryLast", 0); if (historyLast >= historyMax) historyLast = historyMax - 1; wchar_t *ptszString; DBVARIANT dbv; - if (!db_get_ws(NULL, S_MOD, "HistoryStamp", &dbv)) { + if (!g_plugin.getWString("HistoryStamp", &dbv)) { ptszString = ParseString(dbv.pwszVal, hContact); db_free(&dbv); } else ptszString = ParseString(DEFAULT_HISTORYSTAMP, hContact); - db_set_ws(hContact, S_MOD, BuildSetting(historyLast), ptszString); + g_plugin.setWString(hContact, BuildSetting(historyLast), ptszString); historyLast = (historyLast + 1) % historyMax; - db_set_w(hContact, S_MOD, "HistoryLast", historyLast); + g_plugin.setWord(hContact, "HistoryLast", historyLast); if (historyLast == historyFirst) - db_set_w(hContact, S_MOD, "HistoryFirst", (historyFirst + 1) % historyMax); + g_plugin.setWord(hContact, "HistoryFirst", (historyFirst + 1) % historyMax); } void LoadHistoryList(MCONTACT hContact, HWND hwnd, int nList) { SendDlgItemMessage(hwnd, nList, LB_RESETCONTENT, 0, 0); - int historyMax = db_get_w(0, S_MOD, "HistoryMax", 10); + int historyMax = g_plugin.getWord("HistoryMax", 10); if (historyMax < 0) historyMax = 0; else if (historyMax > 99) @@ -76,11 +76,11 @@ void LoadHistoryList(MCONTACT hContact, HWND hwnd, int nList) if (historyMax == 0) return; - int historyFirst = db_get_w(hContact, S_MOD, "HistoryFirst", 0); + int historyFirst = g_plugin.getWord(hContact, "HistoryFirst", 0); if (historyFirst >= historyMax) historyFirst = 0; - int historyLast = db_get_w(hContact, S_MOD, "HistoryLast", 0); + int historyLast = g_plugin.getWord(hContact, "HistoryLast", 0); if (historyLast >= historyMax) historyLast = historyMax - 1; @@ -88,7 +88,7 @@ void LoadHistoryList(MCONTACT hContact, HWND hwnd, int nList) i = (i - 1 + historyMax) % historyMax; DBVARIANT dbv; - if (!db_get_ws(hContact, S_MOD, BuildSetting(i), &dbv)) { + if (!g_plugin.getWString(hContact, BuildSetting(i), &dbv)) { SendDlgItemMessage(hwnd, nList, LB_ADDSTRING, 0, (LPARAM)dbv.pwszVal); db_free(&dbv); } @@ -178,7 +178,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA SetWindowText(hwndDlg, sztemp); Window_SetSkinIcon_IcoLib(hwndDlg, SKINICON_OTHER_MIRANDA); - if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) + if (g_plugin.getByte(hContact, "OnlineAlert")) CheckDlgButton(hwndDlg, IDC_STATUSCHANGE, BST_CHECKED); SendDlgItemMessage(hwndDlg, IDC_DETAILS, BM_SETIMAGE, IMAGE_ICON, (WPARAM)Skin_LoadIcon(SKINICON_OTHER_USERDETAILS)); @@ -190,7 +190,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA SendDlgItemMessage(hwndDlg, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)TranslateT("User Menu"), BATF_UNICODE); SendDlgItemMessage(hwndDlg, IDC_SENDMSG, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Send Instant Message"), BATF_UNICODE); - Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, S_MOD, "History_"); + Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, MODULENAME, "History_"); ShowWindow(hwndDlg, SW_SHOW); return TRUE; @@ -211,9 +211,9 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA break; case IDOK: if (IsDlgButtonChecked(hwndDlg, IDC_STATUSCHANGE) == BST_CHECKED) - db_set_b(hContact, S_MOD, "OnlineAlert", 1); + g_plugin.setByte(hContact, "OnlineAlert", 1); else - db_set_b(hContact, S_MOD, "OnlineAlert", 0); + g_plugin.setByte(hContact, "OnlineAlert", 0); SendMessage(hwndDlg, WM_CLOSE, 0, 0); break; case IDC_USERMENU: @@ -272,7 +272,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA break; case WM_DESTROY: - Utils_SaveWindowPosition(hwndDlg, NULL, S_MOD, "History_"); + Utils_SaveWindowPosition(hwndDlg, NULL, MODULENAME, "History_"); DestroyIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); DestroyIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); break; diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 0882cee00f..1024825b1c 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -43,7 +43,7 @@ PLUGININFOEX pluginInfoEx = }; CMPlugin::CMPlugin() : - PLUGIN(S_MOD, pluginInfoEx) + PLUGIN(MODULENAME, pluginInfoEx) {} ///////////////////////////////////////////////////////////////////////////////////////// @@ -69,13 +69,13 @@ void UninitHistoryDialog(void); static int MainInit(WPARAM, LPARAM) { - if (g_bFileActive = db_get_b(0, S_MOD, "FileOutput", 0)) + if (g_bFileActive = g_plugin.getByte("FileOutput", 0)) InitFileOutput(); - if (db_get_b(0, S_MOD, "MenuItem", 1)) + if (g_plugin.getByte("MenuItem", 1)) InitMenuitem(); - if (db_get_b(0, S_MOD, "UserinfoTab", 1)) + if (g_plugin.getByte("UserinfoTab", 1)) ehuserinfo = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit); if (ServiceExists(MS_TIPPER_ADDTRANSLATION)) @@ -102,9 +102,9 @@ int CMPlugin::Load() HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UpdateValues); HookEvent(ME_PROTO_ACK, ModeChange); - includeIdle = (BOOL)db_get_b(0, S_MOD, "IdleSupport", 1); + includeIdle = (BOOL)g_plugin.getByte("IdleSupport", 1); - if (db_get_b(0, S_MOD, "MissedOnes", 0)) + if (g_plugin.getByte("MissedOnes", 0)) ehmissed_proto = HookEvent(ME_PROTO_ACK, ModeChange_mo); LoadWatchedProtos(); diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 40c673ce79..75a35626d3 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -37,13 +37,13 @@ INT_PTR MenuitemClicked(WPARAM hContact, LPARAM) int BuildContactMenu(WPARAM hContact, LPARAM) { char *szProto = GetContactProto(hContact); - if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(0, S_MOD, "MenuItem", 1)) { + if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !g_plugin.getByte("MenuItem", 1)) { Menu_ShowItem(hmenuitem, false); return 0; } LPCTSTR ptszName; - ptrW tszStamp(db_get_wsa(NULL, S_MOD, "MenuStamp")); + ptrW tszStamp(g_plugin.getWStringA("MenuStamp")); if (tszStamp != NULL) ptszName = ParseString(tszStamp , hContact); else @@ -57,8 +57,8 @@ int BuildContactMenu(WPARAM hContact, LPARAM) else flags |= CMIF_HIDDEN; } - else if (db_get_b(0, S_MOD, "ShowIcon", 1)) { - int isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1); + else if (g_plugin.getByte("ShowIcon", 1)) { + int isetting = g_plugin.getWord(hContact, "StatusTriger", -1); hIcon = Skin_LoadProtoIcon(szProto, isetting | 0x8000); } Menu_ModifyItem(hmenuitem, ptszName, hIcon, flags); diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index b39024baa0..2faa45bea6 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -43,7 +43,7 @@ int RemoveUser(int pos) int ResetMissed(void) { for (auto &hContact : Contacts()) - db_set_b(hContact, S_MOD, "Missed", 0); + g_plugin.setByte(hContact, "Missed", 0); memset(&mcs, 0, sizeof(mcs)); return 0; @@ -53,7 +53,7 @@ int CheckIfOnline(void) { for (auto &hContact : Contacts()) if (Clist_GetContactIcon(hContact) != ICON_OFFLINE) - db_set_b(hContact, S_MOD, "Missed", 2); + g_plugin.setByte(hContact, "Missed", 2); return 0; } @@ -108,7 +108,7 @@ int ShowMissed(void) CMStringW buf; for (int loop = 0; loop < mcs.count; loop++) { buf.Append(Clist_GetContactDisplayName(mcs.wpcontact[loop])); - if (db_get_b(0, S_MOD, "MissedOnes_Count", 0)) + if (g_plugin.getByte("MissedOnes_Count", 0)) buf.AppendFormat(L" [%i]", mcs.times[loop]); buf.AppendChar('\n'); @@ -126,12 +126,12 @@ int Test(WPARAM wparam, LPARAM lparam) if (CallService(MS_IGNORE_ISIGNORED, wparam, IGNOREEVENT_USERONLINE)) return 0; - if (db_get_b((MCONTACT)wparam, S_MOD, "Missed", 0) == 2) + if (g_plugin.getByte((MCONTACT)wparam, "Missed", 0) == 2) return 0; switch (lparam) { case ICON_OFFLINE: - if (db_get_b((MCONTACT)wparam, S_MOD, "Missed", 0) == 1) { + if (g_plugin.getByte((MCONTACT)wparam, "Missed", 0) == 1) { WORD missed = IsUserMissed(wparam); if (!LOWORD(missed)) { mcs.times[mcs.count] = 1; @@ -139,7 +139,7 @@ int Test(WPARAM wparam, LPARAM lparam) } else mcs.times[HIWORD(missed)]++; - db_set_b((MCONTACT)wparam, S_MOD, "Missed", 0); + g_plugin.setByte((MCONTACT)wparam, "Missed", 0); } break; @@ -150,7 +150,7 @@ int Test(WPARAM wparam, LPARAM lparam) case ICON_DND: case ICON_FREE: case ICON_INVIS: - db_set_b((MCONTACT)wparam, S_MOD, "Missed", 1); + g_plugin.setByte((MCONTACT)wparam, "Missed", 1); break; } diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index f9bf061943..cb9ce008b0 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -97,7 +97,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp ShowWindow(GetDlgItem(hdlg, IDC_LABTEXT), hasPopups ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hdlg, IDC_LABTTITLE), hasPopups ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups ? SW_SHOW : SW_HIDE); - CheckDlgButton(hdlg, IDC_POPUPS, (db_get_b(0, S_MOD, "UsePopups", 0) & hasPopups) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_POPUPS, (g_plugin.getByte("UsePopups", 0) & hasPopups) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hdlg, IDC_POPUPS), hasPopups); hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS); EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups); @@ -105,7 +105,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { char szSetting[100]; mir_snprintf(szSetting, "Col_%d", i - ID_STATUS_OFFLINE); - DWORD sett = db_get_dw(0, S_MOD, szSetting, StatusColors15bits[i - ID_STATUS_OFFLINE]); + DWORD sett = g_plugin.getDword(szSetting, StatusColors15bits[i - ID_STATUS_OFFLINE]); COLORREF back, text; GetColorsFromDWord(&back, &text, sett); @@ -115,13 +115,13 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp EnableWindow(GetDlgItem(hdlg, i + 20), hasPopups); } - if (!db_get_ws(NULL, S_MOD, "PopupStamp", &dbv)) { + if (!g_plugin.getWString("PopupStamp", &dbv)) { SetDlgItemText(hdlg, IDC_POPUPSTAMP, dbv.pwszVal); db_free(&dbv); } else SetDlgItemText(hdlg, IDC_POPUPSTAMP, DEFAULT_POPUPSTAMP); - if (!db_get_ws(NULL, S_MOD, "PopupStampText", &dbv)) { + if (!g_plugin.getWString("PopupStampText", &dbv)) { SetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, dbv.pwszVal); db_free(&dbv); } @@ -187,14 +187,14 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp switch (((LPNMHDR)lparam)->code) { case PSN_APPLY: GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "PopupStamp", szstamp); + g_plugin.setWString("PopupStamp", szstamp); GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "PopupStampText", szstamp); + g_plugin.setWString("PopupStampText", szstamp); bchecked = (BYTE)IsDlgButtonChecked(hdlg, IDC_POPUPS); - if (db_get_b(0, S_MOD, "UsePopups", 0) != bchecked) - db_set_b(0, S_MOD, "UsePopups", bchecked); + if (g_plugin.getByte("UsePopups", 0) != bchecked) + g_plugin.setByte("UsePopups", bchecked); for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { COLORREF back = SendDlgItemMessage(hdlg, i, CPM_GETCOLOUR, 0, 0); @@ -204,9 +204,9 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp char szSetting[100]; mir_snprintf(szSetting, "Col_%d", i - ID_STATUS_OFFLINE); if (sett != StatusColors15bits[i - ID_STATUS_OFFLINE]) - db_set_dw(0, S_MOD, szSetting, sett); + g_plugin.setDword(szSetting, sett); else - db_unset(NULL, S_MOD, szSetting); + g_plugin.delSetting(szSetting); } break; //case PSN_APPLY } @@ -227,15 +227,15 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hdlg); - CheckDlgButton(hdlg, IDC_MENUITEM, db_get_b(0, S_MOD, "MenuItem", 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_USERINFO, db_get_b(0, S_MOD, "UserinfoTab", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_MENUITEM, g_plugin.getByte("MenuItem", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_USERINFO, g_plugin.getByte("UserinfoTab", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_FILE, g_bFileActive ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_HISTORY, db_get_b(0, S_MOD, "KeepHistory", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_IGNOREOFFLINE, db_get_b(0, S_MOD, "IgnoreOffline", 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_MISSEDONES, db_get_b(0, S_MOD, "MissedOnes", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_SHOWICON, db_get_b(0, S_MOD, "ShowIcon", 1) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_COUNT, db_get_b(0, S_MOD, "MissedOnes_Count", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hdlg, IDC_IDLESUPPORT, db_get_b(0, S_MOD, "IdleSupport", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_HISTORY, g_plugin.getByte("KeepHistory", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_IGNOREOFFLINE, g_plugin.getByte("IgnoreOffline", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_MISSEDONES, g_plugin.getByte("MissedOnes", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_SHOWICON, g_plugin.getByte("ShowIcon", 1) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_COUNT, g_plugin.getByte("MissedOnes_Count", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, IDC_IDLESUPPORT, g_plugin.getByte("IdleSupport", 1) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hdlg, IDC_MENUSTAMP), IsDlgButtonChecked(hdlg, IDC_MENUITEM)); EnableWindow(GetDlgItem(hdlg, IDC_SHOWICON), IsDlgButtonChecked(hdlg, IDC_MENUITEM)); @@ -246,37 +246,37 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM EnableWindow(GetDlgItem(hdlg, IDC_HISTORYSTAMP), IsDlgButtonChecked(hdlg, IDC_HISTORY)); EnableWindow(GetDlgItem(hdlg, IDC_COUNT), IsDlgButtonChecked(hdlg, IDC_MISSEDONES)); - if (!db_get_ws(NULL, S_MOD, "MenuStamp", &dbv)) { + if (!g_plugin.getWString("MenuStamp", &dbv)) { SetDlgItemText(hdlg, IDC_MENUSTAMP, dbv.pwszVal); db_free(&dbv); } else SetDlgItemText(hdlg, IDC_MENUSTAMP, DEFAULT_MENUSTAMP); - if (!db_get_ws(NULL, S_MOD, "UserStamp", &dbv)) { + if (!g_plugin.getWString("UserStamp", &dbv)) { SetDlgItemText(hdlg, IDC_USERSTAMP, dbv.pwszVal); db_free(&dbv); } else SetDlgItemText(hdlg, IDC_USERSTAMP, DEFAULT_USERSTAMP); - if (!db_get_ws(NULL, S_MOD, "FileStamp", &dbv)) { + if (!g_plugin.getWString("FileStamp", &dbv)) { SetDlgItemText(hdlg, IDC_FILESTAMP, dbv.pwszVal); db_free(&dbv); } else SetDlgItemText(hdlg, IDC_FILESTAMP, DEFAULT_FILESTAMP); - if (!db_get_ws(NULL, S_MOD, "FileName", &dbv)) { + if (!g_plugin.getWString("FileName", &dbv)) { SetDlgItemText(hdlg, IDC_FILENAME, dbv.pwszVal); db_free(&dbv); } else SetDlgItemText(hdlg, IDC_FILENAME, DEFAULT_FILENAME); - if (!db_get_ws(NULL, S_MOD, "HistoryStamp", &dbv)) { + if (!g_plugin.getWString("HistoryStamp", &dbv)) { SetDlgItemText(hdlg, IDC_HISTORYSTAMP, dbv.pwszVal); db_free(&dbv); } else SetDlgItemText(hdlg, IDC_HISTORYSTAMP, DEFAULT_HISTORYSTAMP); - SetDlgItemInt(hdlg, IDC_HISTORYSIZE, db_get_w(0, S_MOD, "HistoryMax", 10 - 1) - 1, FALSE); + SetDlgItemInt(hdlg, IDC_HISTORYSIZE, g_plugin.getWord("HistoryMax", 10 - 1) - 1, FALSE); // load protocol list SetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_PROTOCOLLIST), GWL_STYLE) | TVS_CHECKBOXES); @@ -344,32 +344,32 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM switch (((LPNMHDR)lparam)->code) { case PSN_APPLY: GetDlgItemText(hdlg, IDC_MENUSTAMP, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "MenuStamp", szstamp); + g_plugin.setWString("MenuStamp", szstamp); GetDlgItemText(hdlg, IDC_USERSTAMP, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "UserStamp", szstamp); + g_plugin.setWString("UserStamp", szstamp); GetDlgItemText(hdlg, IDC_FILESTAMP, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "FileStamp", szstamp); + g_plugin.setWString("FileStamp", szstamp); GetDlgItemText(hdlg, IDC_FILENAME, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "FileName", szstamp); + g_plugin.setWString("FileName", szstamp); GetDlgItemText(hdlg, IDC_HISTORYSTAMP, szstamp, _countof(szstamp)); - db_set_ws(0, S_MOD, "HistoryStamp", szstamp); + g_plugin.setWString("HistoryStamp", szstamp); - db_set_w(0, S_MOD, "HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, nullptr, FALSE) + 1)); + g_plugin.setWord("HistoryMax", (WORD)(GetDlgItemInt(hdlg, IDC_HISTORYSIZE, nullptr, FALSE) + 1)); BOOL bchecked = IsDlgButtonChecked(hdlg, IDC_MENUITEM); - if (db_get_b(0, S_MOD, "MenuItem", 1) != bchecked) { - db_set_b(0, S_MOD, "MenuItem", bchecked); + if (g_plugin.getByte("MenuItem", 1) != bchecked) { + g_plugin.setByte("MenuItem", bchecked); if (hmenuitem == nullptr && bchecked) InitMenuitem(); } bchecked = IsDlgButtonChecked(hdlg, IDC_USERINFO); - if (db_get_b(0, S_MOD, "UserinfoTab", 1) != bchecked) { - db_set_b(0, S_MOD, "UserinfoTab", bchecked); + if (g_plugin.getByte("UserinfoTab", 1) != bchecked) { + g_plugin.setByte("UserinfoTab", bchecked); if (bchecked) ehuserinfo = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit); else @@ -379,7 +379,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM bchecked = IsDlgButtonChecked(hdlg, IDC_FILE); if (g_bFileActive != bchecked) { g_bFileActive = bchecked; - db_set_b(0, S_MOD, "FileOutput", bchecked); + g_plugin.setByte("FileOutput", bchecked); if (bchecked) InitFileOutput(); else @@ -387,16 +387,16 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM } bchecked = IsDlgButtonChecked(hdlg, IDC_HISTORY); - if (db_get_b(0, S_MOD, "KeepHistory", 0) != bchecked) - db_set_b(0, S_MOD, "KeepHistory", bchecked); + if (g_plugin.getByte("KeepHistory", 0) != bchecked) + g_plugin.setByte("KeepHistory", bchecked); bchecked = IsDlgButtonChecked(hdlg, IDC_IGNOREOFFLINE); - if (db_get_b(0, S_MOD, "IgnoreOffline", 1) != bchecked) - db_set_b(0, S_MOD, "IgnoreOffline", bchecked); + if (g_plugin.getByte("IgnoreOffline", 1) != bchecked) + g_plugin.setByte("IgnoreOffline", bchecked); bchecked = IsDlgButtonChecked(hdlg, IDC_MISSEDONES); - if (db_get_b(0, S_MOD, "MissedOnes", 0) != bchecked) { - db_set_b(0, S_MOD, "MissedOnes", bchecked); + if (g_plugin.getByte("MissedOnes", 0) != bchecked) { + g_plugin.setByte("MissedOnes", bchecked); if (bchecked) ehmissed_proto = HookEvent(ME_PROTO_ACK, ModeChange_mo); else @@ -404,16 +404,16 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM } bchecked = IsDlgButtonChecked(hdlg, IDC_SHOWICON); - if (db_get_b(0, S_MOD, "ShowIcon", 1) != bchecked) - db_set_b(0, S_MOD, "ShowIcon", bchecked); + if (g_plugin.getByte("ShowIcon", 1) != bchecked) + g_plugin.setByte("ShowIcon", bchecked); bchecked = IsDlgButtonChecked(hdlg, IDC_COUNT); - if (db_get_b(0, S_MOD, "MissedOnes_Count", 0) != bchecked) - db_set_b(0, S_MOD, "MissedOnes_Count", bchecked); + if (g_plugin.getByte("MissedOnes_Count", 0) != bchecked) + g_plugin.setByte("MissedOnes_Count", bchecked); includeIdle = IsDlgButtonChecked(hdlg, IDC_IDLESUPPORT); - if (db_get_b(0, S_MOD, "IdleSupport", 1) != includeIdle) - db_set_b(0, S_MOD, "IdleSupport", (BYTE)includeIdle); + if (g_plugin.getByte("IdleSupport", 1) != includeIdle) + g_plugin.setByte("IdleSupport", (BYTE)includeIdle); // save protocol list HWND hwndTreeView = GetDlgItem(hdlg, IDC_PROTOCOLLIST); @@ -439,7 +439,7 @@ INT_PTR CALLBACK OptsSettingsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM } hItem = TreeView_GetNextSibling(hwndTreeView, hItem); } - db_set_s(0, S_MOD, "WatchedAccounts", watchedProtocols); + g_plugin.setString("WatchedAccounts", watchedProtocols); UnloadWatchedProtos(); LoadWatchedProtos(); diff --git a/plugins/SeenPlugin/src/stdafx.h b/plugins/SeenPlugin/src/stdafx.h index a11efb3db3..39bb908b64 100644 --- a/plugins/SeenPlugin/src/stdafx.h +++ b/plugins/SeenPlugin/src/stdafx.h @@ -59,7 +59,7 @@ wchar_t *any_to_Idle(MCONTACT hContact, const char *module_name, const char *set #define NUM100NANOSEC 116444736000000000 -#define S_MOD "SeenModule" +#define MODULENAME "SeenModule" struct CMPlugin : public PLUGIN { diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index b4d5dc07a8..0d117d1f99 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar case WM_REFRESH_UI: { - ptrW szout(db_get_wsa(NULL, S_MOD, "UserStamp")); + ptrW szout(g_plugin.getWStringA("UserStamp")); wchar_t *str = ParseString((szout != NULL) ? szout : DEFAULT_USERSTAMP, wparam); SetDlgItemText(hdlg, IDC_INFOTEXT, str); diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 626b77ba3a..7958603b6a 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -29,15 +29,15 @@ char *courProtoName = nullptr; void LoadWatchedProtos() { // Upgrade from old settings (separated by " ") - ptrA szProtosOld(db_get_sa(NULL, S_MOD, "WatchedProtocols")); + ptrA szProtosOld(g_plugin.getStringA("WatchedProtocols")); if (szProtosOld != NULL) { CMStringA tmp(szProtosOld); tmp.Replace(" ", "\n"); - db_set_s(0, S_MOD, "WatchedAccounts", tmp.c_str()); - db_unset(NULL, S_MOD, "WatchedProtocols"); + g_plugin.setString("WatchedAccounts", tmp.c_str()); + g_plugin.delSetting("WatchedProtocols"); } - ptrA szProtos(db_get_sa(NULL, S_MOD, "WatchedAccounts")); + ptrA szProtos(g_plugin.getStringA("WatchedAccounts")); if (szProtos == NULL) return; @@ -111,7 +111,7 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st) { FILETIME ft; ULONGLONG ll; - DWORD res = db_get_dw(hcontact, S_MOD, "seenTS", 0); + DWORD res = g_plugin.getDword(hcontact, "seenTS", 0); if (res) { if (st) { ll = UInt32x32To64(TimeZone_ToLocal(res), 10000000) + NUM100NANOSEC; @@ -124,13 +124,13 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st) SYSTEMTIME lst; memset(&lst, 0, sizeof(lst)); - if (lst.wYear = db_get_w(hcontact, S_MOD, "Year", 0)) { - if (lst.wMonth = db_get_w(hcontact, S_MOD, "Month", 0)) { - if (lst.wDay = db_get_w(hcontact, S_MOD, "Day", 0)) { - lst.wDayOfWeek = db_get_w(hcontact, S_MOD, "WeekDay", 0); - lst.wHour = db_get_w(hcontact, S_MOD, "Hours", 0); - lst.wMinute = db_get_w(hcontact, S_MOD, "Minutes", 0); - lst.wSecond = db_get_w(hcontact, S_MOD, "Seconds", 0); + if (lst.wYear = g_plugin.getWord(hcontact, "Year", 0)) { + if (lst.wMonth = g_plugin.getWord(hcontact, "Month", 0)) { + if (lst.wDay = g_plugin.getWord(hcontact, "Day", 0)) { + lst.wDayOfWeek = g_plugin.getWord(hcontact, "WeekDay", 0); + lst.wHour = g_plugin.getWord(hcontact, "Hours", 0); + lst.wMinute = g_plugin.getWord(hcontact, "Minutes", 0); + lst.wSecond = g_plugin.getWord(hcontact, "Seconds", 0); if (SystemTimeToFileTime(&lst, &ft)) { ll = ((LONGLONG)ft.dwHighDateTime << 32) | ((LONGLONG)ft.dwLowDateTime); ll -= NUM100NANOSEC; @@ -138,7 +138,7 @@ DWORD isSeen(MCONTACT hcontact, SYSTEMTIME *st) //perform LOCALTOTIMESTAMP res = (DWORD)ll - TimeZone_ToLocal(0); //nevel look for Year/Month/Day/Hour/Minute/Second again - db_set_dw(hcontact, S_MOD, "seenTS", res); + g_plugin.setDword(hcontact, "seenTS", res); } } } @@ -288,7 +288,7 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) goto LBL_noData; case 's': - if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "StatusTriger" : courProtoName, 0)) { + if (isetting = g_plugin.getWord(hcontact, hcontact ? "StatusTriger" : courProtoName, 0)) { wcsncpy(szdbsetting, Clist_GetStatusModeDescription(isetting | 0x8000, 0), _countof(szdbsetting)); if (!(isetting & 0x8000)) { mir_wstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_wstrlen(szdbsetting)); @@ -308,9 +308,9 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) break; case 'o': - if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) { + if (isetting = g_plugin.getWord(hcontact, hcontact ? "OldStatus" : courProtoName, 0)) { wcsncpy(szdbsetting, Clist_GetStatusModeDescription(isetting, 0), _countof(szdbsetting)); - if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) { + if (includeIdle && hcontact && g_plugin.getByte(hcontact, "OldIdle")) { mir_wstrncat(szdbsetting, L"/", _countof(szdbsetting) - mir_wstrlen(szdbsetting)); mir_wstrncat(szdbsetting, TranslateT("Idle"), _countof(szdbsetting) - mir_wstrlen(szdbsetting)); } @@ -382,14 +382,13 @@ wchar_t* ParseString(wchar_t *szstring, MCONTACT hcontact) void _DBWriteTime(SYSTEMTIME *st, MCONTACT hcontact) { - db_set_w(hcontact, S_MOD, "Day", st->wDay); - db_set_w(hcontact, S_MOD, "Month", st->wMonth); - db_set_w(hcontact, S_MOD, "Year", st->wYear); - db_set_w(hcontact, S_MOD, "Hours", st->wHour); - db_set_w(hcontact, S_MOD, "Minutes", st->wMinute); - db_set_w(hcontact, S_MOD, "Seconds", st->wSecond); - db_set_w(hcontact, S_MOD, "WeekDay", st->wDayOfWeek); - + g_plugin.setWord(hcontact, "Day", st->wDay); + g_plugin.setWord(hcontact, "Month", st->wMonth); + g_plugin.setWord(hcontact, "Year", st->wYear); + g_plugin.setWord(hcontact, "Hours", st->wHour); + g_plugin.setWord(hcontact, "Minutes", st->wMinute); + g_plugin.setWord(hcontact, "Seconds", st->wSecond); + g_plugin.setWord(hcontact, "WeekDay", st->wDayOfWeek); } void DBWriteTimeTS(DWORD t, MCONTACT hcontact) @@ -400,7 +399,7 @@ void DBWriteTimeTS(DWORD t, MCONTACT hcontact) ft.dwLowDateTime = (DWORD)ll; ft.dwHighDateTime = (DWORD)(ll >> 32); FileTimeToSystemTime(&ft, &st); - db_set_dw(hcontact, S_MOD, "seenTS", t); + g_plugin.setDword(hcontact, "seenTS", t); _DBWriteTime(&st, hcontact); } void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword) @@ -471,13 +470,13 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus) if (!ServiceExists(MS_POPUP_QUERY)) return; - if (!db_get_b(0, S_MOD, "UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0)) + if (!g_plugin.getByte("UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0)) return; DBVARIANT dbv; char szSetting[10]; mir_snprintf(szSetting, "Col_%d", newStatus - ID_STATUS_OFFLINE); - DWORD sett = db_get_dw(0, S_MOD, szSetting, StatusColors15bits[newStatus - ID_STATUS_OFFLINE]); + DWORD sett = g_plugin.getDword(szSetting, StatusColors15bits[newStatus - ID_STATUS_OFFLINE]); POPUPDATAT ppd = { 0 }; GetColorsFromDWord(&ppd.colorBack, &ppd.colorText, sett); @@ -485,13 +484,13 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus) ppd.lchContact = hcontact; ppd.lchIcon = Skin_LoadProtoIcon(lpzProto, newStatus); - if (!db_get_ws(NULL, S_MOD, "PopupStamp", &dbv)) { + if (!g_plugin.getWString("PopupStamp", &dbv)) { wcsncpy(ppd.lptzContactName, ParseString(dbv.pwszVal, hcontact), MAX_CONTACTNAME); db_free(&dbv); } else wcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact), MAX_CONTACTNAME); - if (!db_get_ws(NULL, S_MOD, "PopupStampText", &dbv)) { + if (!g_plugin.getWString("PopupStampText", &dbv)) { wcsncpy(ppd.lptzText, ParseString(dbv.pwszVal, hcontact), MAX_SECONDLINE); db_free(&dbv); } @@ -518,7 +517,7 @@ static void waitThread(logthread_info* infoParam) { Thread_SetName("SeenPlugin: waitThread"); - WORD prevStatus = db_get_w(infoParam->hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE); + WORD prevStatus = g_plugin.getWord(infoParam->hContact, "StatusTriger", ID_STATUS_OFFLINE); // I hope in 1.5 second all the needed info will be set if (WaitForSingleObject(g_hShutdownEvent, 1500) == WAIT_TIMEOUT) { @@ -527,11 +526,11 @@ static void waitThread(logthread_info* infoParam) infoParam->currStatus &= 0x7FFF; if (infoParam->currStatus != prevStatus) { - db_set_w(infoParam->hContact, S_MOD, "OldStatus", (WORD)(prevStatus | 0x8000)); + g_plugin.setWord(infoParam->hContact, "OldStatus", (WORD)(prevStatus | 0x8000)); if (includeIdle) - db_set_b(infoParam->hContact, S_MOD, "OldIdle", (BYTE)((prevStatus & 0x8000) == 0)); + g_plugin.setByte(infoParam->hContact, "OldIdle", (BYTE)((prevStatus & 0x8000) == 0)); - db_set_w(infoParam->hContact, S_MOD, "StatusTriger", infoParam->currStatus); + g_plugin.setWord(infoParam->hContact, "StatusTriger", infoParam->currStatus); } } { @@ -563,11 +562,11 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if (strcmp(cws->szSetting, "Status") && strcmp(cws->szSetting, "StatusTriger") && (isIdleEvent == 0)) return 0; - if (!strcmp(cws->szModule, S_MOD)) { + if (!strcmp(cws->szModule, MODULENAME)) { // here we will come when Settings/SeenModule/StatusTriger is changed - WORD prevStatus = db_get_w(hContact, S_MOD, "OldStatus", ID_STATUS_OFFLINE); + WORD prevStatus = g_plugin.getWord(hContact, "OldStatus", ID_STATUS_OFFLINE); if (includeIdle) { - if (db_get_b(hContact, S_MOD, "OldIdle", 0)) + if (g_plugin.getByte(hContact, "OldIdle", 0)) prevStatus &= 0x7FFF; else prevStatus |= 0x8000; @@ -577,51 +576,53 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if ((prevStatus | 0x8000) <= ID_STATUS_OFFLINE) return 0; - db_set_b(hContact, S_MOD, "Offline", 1); + g_plugin.setByte(hContact, "Offline", 1); { char str[MAXMODULELABELLENGTH + 9]; mir_snprintf(str, "OffTime-%s", szProto); - DWORD t = db_get_dw(0, S_MOD, str, 0); + DWORD t = g_plugin.getDword(str, 0); if (!t) t = time(0); DBWriteTimeTS(t, hContact); } - if (!db_get_b(0, S_MOD, "IgnoreOffline", 1)) { + if (!g_plugin.getByte("IgnoreOffline", 1)) { if (g_bFileActive) FileWrite(hContact); char *sProto = GetContactProto(hContact); if (Proto_GetStatus(sProto) > ID_STATUS_OFFLINE) { myPlaySound(hContact, ID_STATUS_OFFLINE, prevStatus); - if (db_get_b(0, S_MOD, "UsePopups", 0)) + if (g_plugin.getByte("UsePopups", 0)) ShowPopup(hContact, sProto, ID_STATUS_OFFLINE); } - if (db_get_b(0, S_MOD, "KeepHistory", 0)) + if (g_plugin.getByte("KeepHistory", 0)) HistoryWrite(hContact); - if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) + if (g_plugin.getByte(hContact, "OnlineAlert", 0)) ShowHistory(hContact, 1); } } else { - if (cws->value.wVal == prevStatus && !db_get_b(hContact, S_MOD, "Offline", 0)) + if (cws->value.wVal == prevStatus && !g_plugin.getByte(hContact, "Offline", 0)) return 0; DBWriteTimeTS(time(0), hContact); if (g_bFileActive) FileWrite(hContact); if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus); - if (db_get_b(0, S_MOD, "UsePopups", 0)) + if (g_plugin.getByte("UsePopups", 0)) if (prevStatus != cws->value.wVal) ShowPopup(hContact, GetContactProto(hContact), cws->value.wVal | 0x8000); - if (db_get_b(0, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact); - if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) ShowHistory(hContact, 1); - db_set_b(hContact, S_MOD, "Offline", 0); + if (g_plugin.getByte("KeepHistory", 0)) + HistoryWrite(hContact); + if (g_plugin.getByte(hContact, "OnlineAlert", 0)) + ShowHistory(hContact, 1); + g_plugin.setByte(hContact, "Offline", 0); } } else if (hContact && IsWatchedProtocol(cws->szModule) && !db_get_b(hContact, cws->szModule, "ChatRoom", false)) { @@ -652,19 +653,20 @@ static void cleanThread(logthread_info* infoParam) // I hope in 10 secons all logged-in contacts will be listed if (WaitForSingleObject(g_hShutdownEvent, 10000) == WAIT_TIMEOUT) { for (auto &hContact : Contacts(szProto)) { - WORD oldStatus = db_get_w(hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE) | 0x8000; + WORD oldStatus = g_plugin.getWord(hContact, "StatusTriger", ID_STATUS_OFFLINE) | 0x8000; if (oldStatus > ID_STATUS_OFFLINE) { if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) { - db_set_w(hContact, S_MOD, "OldStatus", (WORD)(oldStatus | 0x8000)); - if (includeIdle)db_set_b(hContact, S_MOD, "OldIdle", (BYTE)((oldStatus & 0x8000) ? 0 : 1)); - db_set_w(hContact, S_MOD, "StatusTriger", ID_STATUS_OFFLINE); + g_plugin.setWord(hContact, "OldStatus", (WORD)(oldStatus | 0x8000)); + if (includeIdle) + g_plugin.setByte(hContact, "OldIdle", (BYTE)((oldStatus & 0x8000) ? 0 : 1)); + g_plugin.setWord(hContact, "StatusTriger", ID_STATUS_OFFLINE); } } } char str[MAXMODULELABELLENGTH + 9]; mir_snprintf(str, "OffTime-%s", infoParam->sProtoName); - db_unset(NULL, S_MOD, str); + g_plugin.delSetting(str); } mir_free(infoParam); } @@ -703,14 +705,14 @@ int ModeChange(WPARAM, LPARAM lparam) time(&t); mir_snprintf(str, "OffTime-%s", ack->szModule); - db_set_dw(0, S_MOD, str, t); + g_plugin.setDword(str, t); } } - if (isetting == db_get_w(0, S_MOD, courProtoName, ID_STATUS_OFFLINE)) + if (isetting == g_plugin.getWord(courProtoName, ID_STATUS_OFFLINE)) return 0; - db_set_w(0, S_MOD, courProtoName, isetting); + g_plugin.setWord(courProtoName, isetting); if (g_bFileActive) FileWrite(NULL); -- cgit v1.2.3