diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/HistorySweeperLight/src | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/HistorySweeperLight/src')
-rw-r--r-- | plugins/HistorySweeperLight/src/historysweeperlight.cpp | 16 | ||||
-rw-r--r-- | plugins/HistorySweeperLight/src/main.cpp | 12 | ||||
-rw-r--r-- | plugins/HistorySweeperLight/src/options.cpp | 38 |
3 files changed, 33 insertions, 33 deletions
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 176a87087e..230f8e4595 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -129,9 +129,9 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke {
int lPolicy;
if (hContact == NULL) // for system history
- lPolicy = db_get_b(NULL, ModuleName, "SweepSHistory", 0);
+ lPolicy = db_get_b(0, ModuleName, "SweepSHistory", 0);
else // for contact history (or "SweepHistory" - default action)
- lPolicy = db_get_b(hContact, ModuleName, "SweepHistory", db_get_b(NULL, ModuleName, "SweepHistory", 0));
+ lPolicy = db_get_b(hContact, ModuleName, "SweepHistory", db_get_b(0, ModuleName, "SweepHistory", 0));
if (lPolicy == 0) return; // nothing to do
@@ -139,7 +139,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (eventsCnt == 0)
return;
- BOOL doDelete, unsafe = db_get_b(NULL, ModuleName, "UnsafeMode", 0);
+ BOOL doDelete, unsafe = db_get_b(0, ModuleName, "UnsafeMode", 0);
BEventData *books, *item, ev = { 0 };
size_t bookcnt, btshift;
@@ -196,8 +196,8 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke void ShutdownAction(void)
{
CriteriaStruct Criteria;
- Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(0, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(0, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(NULL, Criteria, FALSE); // sweep system history, keepunread==0
@@ -215,11 +215,11 @@ int OnWindowEvent(WPARAM, LPARAM lParam) break;
case MSG_WINDOW_EVT_CLOSE:
- if (db_get_b(NULL, ModuleName, "SweepOnClose", 0)) {
+ if (db_get_b(0, ModuleName, "SweepOnClose", 0)) {
CriteriaStruct Criteria;
- Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(0, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(0, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE);
}
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 3cc113a692..2f48385696 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -51,7 +51,7 @@ static int OnIconPressed(WPARAM hContact, LPARAM lParam) {
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if (!(sicd->flags & MBCF_RIGHTBUTTON) && !mir_strcmp(sicd->szModule, ModuleName) && db_get_b(NULL, ModuleName, "ChangeInMW", 0)) {
+ if (!(sicd->flags & MBCF_RIGHTBUTTON) && !mir_strcmp(sicd->szModule, ModuleName) && db_get_b(0, ModuleName, "ChangeInMW", 0)) {
int nh = sicd->dwId;
StatusIconData sid = {};
@@ -72,7 +72,7 @@ static int OnIconPressed(WPARAM hContact, LPARAM lParam) static int OnModulesLoaded(WPARAM, LPARAM)
{
- int sweep = db_get_b(NULL, ModuleName, "SweepHistory", 0);
+ int sweep = db_get_b(0, ModuleName, "SweepHistory", 0);
StatusIconData sid = {};
sid.szModule = ModuleName;
@@ -81,9 +81,9 @@ static int OnModulesLoaded(WPARAM, LPARAM) if (sweep == 0)
sid.szTooltip = LPGEN("Keep all events");
else if (sweep == 1)
- sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)];
+ sid.szTooltip = time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)];
else if (sweep == 2)
- sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)];
+ sid.szTooltip = keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)];
else if (sweep == 3)
sid.szTooltip = LPGEN("Delete all events");
@@ -92,13 +92,13 @@ static int OnModulesLoaded(WPARAM, LPARAM) sid.dwId = 1;
sid.hIcon = LoadIconEx("act1");
- sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)];
+ sid.szTooltip = time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)];
sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid, &g_plugin);
sid.dwId = 2;
sid.hIcon = LoadIconEx("act2");
- sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)];
+ sid.szTooltip = keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)];
sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid, &g_plugin);
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index b3f902dfd0..1c54372f43 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -87,9 +87,9 @@ HANDLE hAllContacts, hSystemHistory; static void ShowAllContactIcons(HWND hwndList)
{
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hAllContacts,
- MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepHistory", 0)));
+ MAKELPARAM(0, db_get_b(0, ModuleName, "SweepHistory", 0)));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory,
- MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepSHistory", 0)));
+ MAKELPARAM(0, db_get_b(0, ModuleName, "SweepSHistory", 0)));
for (auto &hContact : Contacts()) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
@@ -127,27 +127,27 @@ void LoadSettings(HWND hwndDlg) SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_ADDSTRING, 0, (LPARAM)ptszTimeStr);
}
- SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0), 0);
- SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, db_get_b(0, ModuleName, "StartupShutdownOlder", 0), 0);
+ SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, db_get_b(0, ModuleName, "StartupShutdownKeep", 0), 0);
- CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(NULL, ModuleName, "UnsafeMode", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(NULL, ModuleName, "SweepOnClose", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(NULL, ModuleName, "ChangeInMW", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(0, ModuleName, "UnsafeMode", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(0, ModuleName, "SweepOnClose", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(0, ModuleName, "ChangeInMW", 0) ? BST_CHECKED : BST_UNCHECKED);
}
void SaveSettings(HWND hwndDlg)
{
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- db_set_b(NULL, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
- db_set_b(NULL, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
- db_set_b(NULL, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
- db_set_b(NULL, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
- db_set_b(NULL, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
+ db_set_b(0, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
+ db_set_b(0, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
+ db_set_b(0, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
+ db_set_b(0, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
+ db_set_b(0, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
- db_set_b(NULL, ModuleName, "SweepHistory",
+ db_set_b(0, ModuleName, "SweepHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hAllContacts, 0));
- db_set_b(NULL, ModuleName, "SweepSHistory",
+ db_set_b(0, ModuleName, "SweepSHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0));
for (auto &hContact : Contacts()) {
@@ -164,26 +164,26 @@ void SaveSettings(HWND hwndDlg) SetSrmmIcon(UINT_PTR(it));
// set tooltips
- int st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
+ int st = db_get_b(0, ModuleName, "SweepHistory", 0);
StatusIconData sid = {};
sid.szModule = ModuleName;
sid.dwId = 0;
sid.hIcon = LoadIconEx("actG");
if (st == 0) sid.szTooltip = LPGEN("Keep all events");
- else if (st == 1) sid.szTooltip = LPGEN(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
- else if (st == 2) sid.szTooltip = LPGEN(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ else if (st == 1) sid.szTooltip = LPGEN(time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)]);
+ else if (st == 2) sid.szTooltip = LPGEN(keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)]);
else if (st == 3) sid.szTooltip = LPGEN("Delete all events");
Srmm_ModifyIcon(NULL, &sid);
sid.dwId = 1;
sid.hIcon = LoadIconEx("act1");
- sid.szTooltip = time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)];
+ sid.szTooltip = time_stamp_strings[db_get_b(0, ModuleName, "StartupShutdownOlder", 0)];
Srmm_ModifyIcon(NULL, &sid);
sid.dwId = 2;
sid.hIcon = LoadIconEx("act2");
- sid.szTooltip = keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)];
+ sid.szTooltip = keep_strings[db_get_b(0, ModuleName, "StartupShutdownKeep", 0)];
Srmm_ModifyIcon(NULL, &sid);
}
|