diff options
Diffstat (limited to 'plugins/BuddyPounce/src')
-rw-r--r-- | plugins/BuddyPounce/src/dialog.cpp | 42 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/main.cpp | 30 |
2 files changed, 36 insertions, 36 deletions
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 3761a141b0..2293f3cffa 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -28,7 +28,7 @@ void populateContacts(MCONTACT BPhContact, HWND hwnd2CB) void saveLastSetting(MCONTACT hContact, HWND hwnd)
{
wchar_t number[8];//, string[1024];//for sending file name
- switch (db_get_b(hContact, MODULENAME, "LastSetting", 2)) { // nothing to do
+ switch (g_plugin.getByte(hContact, "LastSetting", 2)) { // nothing to do
case 0: // Send If My Status Is...
break;
case 1: // Send If They Change status to
@@ -38,18 +38,18 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd) break;
case 3: // Reuse Pounce
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
- db_set_b(hContact, MODULENAME, "Reuse", (BYTE)_wtoi(number));
+ g_plugin.setByte(hContact, "Reuse", (BYTE)_wtoi(number));
break;
case 4: // Give Up delay
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
- db_set_b(hContact, MODULENAME, "GiveUpDays", (BYTE)_wtoi(number));
+ g_plugin.setByte(hContact, "GiveUpDays", (BYTE)_wtoi(number));
{
- db_set_dw(hContact, MODULENAME, "GiveUpDate", (DWORD)(_wtoi(number)*SECONDSINADAY));
+ g_plugin.setDword(hContact, "GiveUpDate", (DWORD)(_wtoi(number)*SECONDSINADAY));
}
break;
case 5: // confirm window
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, _countof(number));
- db_set_w(hContact, MODULENAME, "ConfirmTimeout", (WORD)_wtoi(number));
+ g_plugin.setWord(hContact, "ConfirmTimeout", (WORD)_wtoi(number));
break;
}
}
@@ -65,7 +65,7 @@ void hideAll(HWND hwnd) void getDefaultMessage(HWND hwnd, UINT control, MCONTACT hContact)
{
DBVARIANT dbv;
- if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv)) {
+ if (!g_plugin.getWString(hContact, "PounceMsg", &dbv)) {
SetDlgItemText(hwnd, control, dbv.pwszVal);
db_free(&dbv);
}
@@ -179,14 +179,14 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta void deletePounce(MCONTACT hContact)
{
- db_unset(hContact, MODULENAME, "PounceMsg");
- db_unset(hContact, MODULENAME, "SendIfMyStatusIsFLAG");
- db_unset(hContact, MODULENAME, "SendIfTheirStatusIsFLAG");
- db_unset(hContact, MODULENAME, "Reuse");
- db_unset(hContact, MODULENAME, "GiveUpDays");
- db_unset(hContact, MODULENAME, "GiveUpDate");
- db_unset(hContact, MODULENAME, "ConfirmTimeout");
- db_unset(hContact, MODULENAME, "FileToSend");
+ g_plugin.delSetting(hContact, "PounceMsg");
+ g_plugin.delSetting(hContact, "SendIfMyStatusIsFLAG");
+ g_plugin.delSetting(hContact, "SendIfTheirStatusIsFLAG");
+ g_plugin.delSetting(hContact, "Reuse");
+ g_plugin.delSetting(hContact, "GiveUpDays");
+ g_plugin.delSetting(hContact, "GiveUpDate");
+ g_plugin.delSetting(hContact, "ConfirmTimeout");
+ g_plugin.delSetting(hContact, "FileToSend");
}
INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -224,9 +224,9 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, L if (length > 1) {
wchar_t *text = (wchar_t*)_alloca(length * sizeof(wchar_t));
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, MODULENAME, "PounceMsg", text);
+ g_plugin.setWString(hContact, "PounceMsg", text);
}
- else db_unset(hContact, MODULENAME, "PounceMsg");
+ else g_plugin.delSetting(hContact, "PounceMsg");
}
// fall through
case IDCANCEL:
@@ -289,10 +289,10 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM break;
}
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, MODULENAME, "PounceMsg", text);
+ g_plugin.setWString(hContact, "PounceMsg", text);
mir_free(text);
}
- else db_unset(hContact, MODULENAME, "PounceMsg");
+ else g_plugin.delSetting(hContact, "PounceMsg");
saveLastSetting(hContact, hwnd);
} // fall through
if (LOWORD(wParam) == IDC_SIMPLE)
@@ -415,10 +415,10 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, break;
}
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, MODULENAME, "PounceMsg", text);
+ g_plugin.setWString(hContact, "PounceMsg", text);
mir_free(text);
}
- else db_unset(hContact, MODULENAME, "PounceMsg");
+ else g_plugin.delSetting(hContact, "PounceMsg");
g_plugin.setByte("UseAdvanced", (BYTE)IsDlgButtonChecked(hwnd, IDC_USEADVANCED));
g_plugin.setByte("ShowDeliveryMessages", (BYTE)IsDlgButtonChecked(hwnd, IDC_SHOWDELIVERYMSGS));
@@ -567,7 +567,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP hContact = lParam;
{
DBVARIANT dbv;
- if (db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv))
+ if (g_plugin.getWString(hContact, "PounceMsg", &dbv))
DestroyWindow(hwnd);
else {
SetDlgItemText(hwnd, IDC_MESSAGE, dbv.pwszVal);
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 03c5bb3fe0..30a0d2278c 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -111,9 +111,9 @@ int statusCheck(int statusFlag, int status) int CheckDate(MCONTACT hContact)
{
time_t curtime = time(nullptr);
- if (!db_get_b(hContact, MODULENAME, "GiveUpDays", 0))
+ if (!g_plugin.getByte(hContact, "GiveUpDays", 0))
return 1;
- if (db_get_b(hContact, MODULENAME, "GiveUpDays", 0) && (abs((time_t)db_get_dw(hContact, MODULENAME, "GiveUpDate", 0)) > curtime))
+ if (g_plugin.getByte(hContact, "GiveUpDays", 0) && (abs((time_t)g_plugin.getDword(hContact, "GiveUpDate", 0)) > curtime))
return 1;
return 0;
}
@@ -136,14 +136,14 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) if (newStatus != oldStatus && hContact != NULL && newStatus != ID_STATUS_OFFLINE) {
DBVARIANT dbv;
- if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv) && (dbv.pwszVal[0] != '\0')) {
+ if (!g_plugin.getWString(hContact, "PounceMsg", &dbv) && (dbv.pwszVal[0] != '\0')) {
// check my status
- if (statusCheck(db_get_w(hContact, MODULENAME, "SendIfMyStatusIsFLAG", 0), Proto_GetStatus(szProto))
+ if (statusCheck(g_plugin.getWord(hContact, "SendIfMyStatusIsFLAG", 0), Proto_GetStatus(szProto))
// check the contacts status
- && statusCheck(db_get_w(hContact, MODULENAME, "SendIfTheirStatusIsFLAG", 0), newStatus)) {
+ && statusCheck(g_plugin.getWord(hContact, "SendIfTheirStatusIsFLAG", 0), newStatus)) {
// check if we r giving up after x days
if (CheckDate(hContact)) {
- if (db_get_w(hContact, MODULENAME, "ConfirmTimeout", 0)) {
+ if (g_plugin.getWord(hContact, "ConfirmTimeout", 0)) {
SendPounceDlgProcStruct *spdps = (SendPounceDlgProcStruct *)mir_alloc(sizeof(SendPounceDlgProcStruct));
wchar_t *message = mir_wstrdup(dbv.pwszVal); // will get free()ed in the send confirm window proc
spdps->hContact = hContact;
@@ -164,7 +164,7 @@ int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM hContact, LPARAM)
{
- if (g_plugin.getByte("UseAdvanced", 0) || db_get_b(hContact, MODULENAME, "UseAdvanced", 0))
+ if (g_plugin.getByte("UseAdvanced", 0) || g_plugin.getByte(hContact, "UseAdvanced", 0))
CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE), nullptr, BuddyPounceDlgProc, hContact);
else
CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, hContact);
@@ -175,12 +175,12 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) {
MCONTACT hContact = wParam;
wchar_t* message = (wchar_t*)lParam;
- db_set_ws(hContact, MODULENAME, "PounceMsg", message);
- db_set_w(hContact, MODULENAME, "SendIfMyStatusIsFLAG", (WORD)g_plugin.getWord("SendIfMyStatusIsFLAG", 1));
- db_set_w(hContact, MODULENAME, "SendIfTheirStatusIsFLAG", (WORD)g_plugin.getWord("SendIfTheirStatusIsFLAG", 1));
- db_set_b(hContact, MODULENAME, "Reuse", (BYTE)g_plugin.getByte("Reuse", 0));
- db_set_b(hContact, MODULENAME, "GiveUpDays", (BYTE)g_plugin.getByte("GiveUpDays", 0));
- db_set_dw(hContact, MODULENAME, "GiveUpDate", (DWORD)(db_get_b(hContact, MODULENAME, "GiveUpDays", 0)*SECONDSINADAY));
+ g_plugin.setWString(hContact, "PounceMsg", message);
+ g_plugin.setWord(hContact, "SendIfMyStatusIsFLAG", (WORD)g_plugin.getWord("SendIfMyStatusIsFLAG", 1));
+ g_plugin.setWord(hContact, "SendIfTheirStatusIsFLAG", (WORD)g_plugin.getWord("SendIfTheirStatusIsFLAG", 1));
+ g_plugin.setByte(hContact, "Reuse", (BYTE)g_plugin.getByte("Reuse", 0));
+ g_plugin.setByte(hContact, "GiveUpDays", (BYTE)g_plugin.getByte("GiveUpDays", 0));
+ g_plugin.setDword(hContact, "GiveUpDate", (DWORD)(g_plugin.getByte(hContact, "GiveUpDays", 0)*SECONDSINADAY));
return 0;
}
@@ -189,12 +189,12 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) MCONTACT hContact = wParam;
wchar_t* message = (wchar_t*)lParam;
DBVARIANT dbv;
- if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv)) {
+ if (!g_plugin.getWString(hContact, "PounceMsg", &dbv)) {
wchar_t* newPounce = (wchar_t*)mir_alloc(mir_wstrlen(dbv.pwszVal) + mir_wstrlen(message) + 1);
if (!newPounce) return 1;
mir_wstrcpy(newPounce, dbv.pwszVal);
mir_wstrcat(newPounce, message);
- db_set_ws(hContact, MODULENAME, "PounceMsg", newPounce);
+ g_plugin.setWString(hContact, "PounceMsg", newPounce);
mir_free(newPounce);
db_free(&dbv);
}
|