summaryrefslogtreecommitdiff
path: root/plugins/HistorySweeperLight
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/HistorySweeperLight')
-rw-r--r--plugins/HistorySweeperLight/src/historysweeperlight.cpp18
-rw-r--r--plugins/HistorySweeperLight/src/main.cpp16
-rw-r--r--plugins/HistorySweeperLight/src/options.cpp44
3 files changed, 39 insertions, 39 deletions
diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
index 8783aafa34..70be70347b 100644
--- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp
+++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp
@@ -132,7 +132,7 @@ static void GetBookmarks(HANDLE hContact, BEventData** books, size_t* bookcnt )
mir_free(tbooks);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -141,15 +141,15 @@ void SweepHistoryFromContact(HANDLE hContact, CriteriaStruct Criteria, BOOL keep
{
int lPolicy;
if (hContact == NULL) // for system history
- lPolicy = DBGetContactSettingByte(NULL, ModuleName, "SweepSHistory", 0);
+ lPolicy = db_get_b(NULL, ModuleName, "SweepSHistory", 0);
else // for contact history (or "SweepHistory" - default action)
- lPolicy = DBGetContactSettingByte(hContact, ModuleName, "SweepHistory", DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0));
+ lPolicy = db_get_b(hContact, ModuleName, "SweepHistory", db_get_b(NULL, ModuleName, "SweepHistory", 0));
if (lPolicy == 0) return; // nothing to do
int eventsCnt = db_event_count(hContact);
if (eventsCnt != 0) {
- BOOL doDelete, unsafe = DBGetContactSettingByte(NULL, ModuleName, "UnsafeMode", 0);
+ BOOL doDelete, unsafe = db_get_b(NULL, ModuleName, "UnsafeMode", 0);
BEventData *books, *item, ev = { 0 };
size_t bookcnt, btshift;
@@ -211,8 +211,8 @@ void ShutdownAction(void)
CriteriaStruct Criteria;
HANDLE hContact = db_find_first();
- Criteria.keep = KeepCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(NULL, Criteria, FALSE); // sweep system history, keepunread==0
@@ -228,12 +228,12 @@ int OnWindowEvent(WPARAM wParam, LPARAM lParam)
{
MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam;
- if (msgEvData->uType == MSG_WINDOW_EVT_CLOSE && DBGetContactSettingByte(NULL, ModuleName, "SweepOnClose", 0))
+ if (msgEvData->uType == MSG_WINDOW_EVT_CLOSE && db_get_b(NULL, ModuleName, "SweepOnClose", 0))
{
CriteriaStruct Criteria;
- Criteria.keep = KeepCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0));
- Criteria.time = BuildCriteria(DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0));
+ Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0));
+ Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0));
SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE);
}
diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp
index 6f1133dbea..3508a6b8dc 100644
--- a/plugins/HistorySweeperLight/src/main.cpp
+++ b/plugins/HistorySweeperLight/src/main.cpp
@@ -52,7 +52,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam)
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
if ( !(sicd->flags & MBCF_RIGHTBUTTON) && !lstrcmpA(sicd->szModule, ModuleName)
- && DBGetContactSettingByte(NULL, ModuleName, "ChangeInMW", 0))
+ && db_get_b(NULL, ModuleName, "ChangeInMW", 0))
{
int nh = sicd->dwId; HANDLE hContact = (HANDLE)wParam; StatusIconData sid = {0};
@@ -63,7 +63,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam)
CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
nh = (nh + 1) % 4;
- DBWriteContactSettingByte((HANDLE)wParam, ModuleName, "SweepHistory", (BYTE)nh);
+ db_set_b((HANDLE)wParam, ModuleName, "SweepHistory", (BYTE)nh);
sid.dwId = nh;
sid.flags = 0;
@@ -76,7 +76,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam)
int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
StatusIconData sid = {0};
- int i, sweep = DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0);
+ int i, sweep = db_get_b(NULL, ModuleName, "SweepHistory", 0);
HANDLE hContact = db_find_first();
sid.cbSize = sizeof(sid);
@@ -87,11 +87,11 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
sid.szTooltip = Translate("Keep all events");
else if (sweep == 1)
{
- sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
}
else if (sweep == 2)
{
- sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
}
else if (sweep == 3)
{
@@ -102,13 +102,13 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
sid.dwId = 1;
sid.hIcon = LoadIconEx("act1");
- sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
sid.flags = MBF_HIDDEN;
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
sid.dwId = 2;
sid.hIcon = LoadIconEx("act2");
- sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
sid.flags = MBF_HIDDEN;
CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
@@ -123,7 +123,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
ZeroMemory(&sid,sizeof(sid));
- sweep = DBGetContactSettingByte(hContact, ModuleName, "SweepHistory", 0);
+ sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0);
sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp
index 2d13aefd7f..d77d4946f9 100644
--- a/plugins/HistorySweeperLight/src/options.cpp
+++ b/plugins/HistorySweeperLight/src/options.cpp
@@ -105,16 +105,16 @@ static void ShowAllContactIcons(HWND hwndList)
HANDLE hContact, hItem;
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hAllContacts,
- MAKELPARAM(0, DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0)));
+ MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepHistory", 0)));
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory,
- MAKELPARAM(0, DBGetContactSettingByte(NULL, ModuleName, "SweepSHistory", 0)));
+ MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepSHistory", 0)));
for (hContact=db_find_first(); hContact;
hContact=db_find_next(hContact))
{
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem,
- MAKELPARAM(0, DBGetContactSettingByte(hContact, ModuleName, "SweepHistory", 0)));
+ MAKELPARAM(0, db_get_b(hContact, ModuleName, "SweepHistory", 0)));
}
}//ShowAllContactIcons
@@ -150,12 +150,12 @@ void LoadSettings(HWND hwndDlg)
mir_free(ptszTimeStr);
}
- SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_SETCURSEL, DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0), 0);
- SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_SETCURSEL, DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0), 0);
+ 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);
- CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, DBGetContactSettingByte(NULL, ModuleName, "UnsafeMode", 0));
- CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, DBGetContactSettingByte(NULL, ModuleName, "SweepOnClose", 0));
- CheckDlgButton(hwndDlg, IDC_HISTMW, DBGetContactSettingByte(NULL, ModuleName, "ChangeInMW", 0));
+ CheckDlgButton(hwndDlg, IDC_UNSAFEMODE, db_get_b(NULL, ModuleName, "UnsafeMode", 0));
+ CheckDlgButton(hwndDlg, IDC_SWEEPONCLOSE, db_get_b(NULL, ModuleName, "SweepOnClose", 0));
+ CheckDlgButton(hwndDlg, IDC_HISTMW, db_get_b(NULL, ModuleName, "ChangeInMW", 0));
}//LoadSettings
@@ -163,18 +163,18 @@ void SaveSettings(HWND hwndDlg)
{
int st, i; StatusIconData sid = {0}; HANDLE hContact, hItem; HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- DBWriteContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSOLDER, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SSKEEP, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, ModuleName, "UnsafeMode", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_UNSAFEMODE));
- DBWriteContactSettingByte(NULL, ModuleName, "SweepOnClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWEEPONCLOSE));
- DBWriteContactSettingByte(NULL, ModuleName, "ChangeInMW", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HISTMW));
+ 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));
sid.cbSize = sizeof(sid);
sid.szModule = ModuleName;
- DBWriteContactSettingByte(NULL, ModuleName, "SweepHistory",
+ db_set_b(NULL, ModuleName, "SweepHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hAllContacts, 0));
- DBWriteContactSettingByte(NULL, ModuleName, "SweepSHistory",
+ db_set_b(NULL, ModuleName, "SweepSHistory",
(BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0));
for (hContact=db_find_first(); hContact;
@@ -183,8 +183,8 @@ void SaveSettings(HWND hwndDlg)
hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
st = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, 0);
- if ( st != 0 ) DBWriteContactSettingByte(hContact, ModuleName, "SweepHistory", (BYTE)st);
- else DBDeleteContactSetting(hContact, ModuleName, "SweepHistory");
+ if ( st != 0 ) db_set_b(hContact, ModuleName, "SweepHistory", (BYTE)st);
+ else db_unset(hContact, ModuleName, "SweepHistory");
// set per-contact icons in status bar
for(i = 0; i < 4; i++)
@@ -196,21 +196,21 @@ void SaveSettings(HWND hwndDlg)
}
// set tooltips
- st = DBGetContactSettingByte(NULL, ModuleName, "SweepHistory", 0);
+ st = db_get_b(NULL, ModuleName, "SweepHistory", 0);
sid.dwId = 0;
if (st == 0) sid.szTooltip = Translate("Keep all events");
- else if (st == 1) sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
- else if (st == 2) sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ else if (st == 1) sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ else if (st == 2) sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
else if (st == 3) sid.szTooltip = Translate("Delete all events");
CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid);
sid.dwId = 1;
- sid.szTooltip = Translate(time_stamp_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownOlder", 0)]);
+ sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]);
CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid);
sid.dwId = 2;
- sid.szTooltip = Translate(keep_strings[DBGetContactSettingByte(NULL, ModuleName, "StartupShutdownKeep", 0)]);
+ sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]);
CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid);
}//SaveSettings