diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-03-29 17:10:34 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-03-29 17:10:34 +0000 |
commit | 3a7f5050eeff90d8751aefd99dcdad0eb1f4062a (patch) | |
tree | 295def1e15dc3401579a09c5eedb858b824c9068 /plugins/BuddyPounce | |
parent | 8e37dd3344772e2bfce5eaff06e0e7c5ae2cae95 (diff) |
- NewsAggregator: cosmetics (patch from dartraiden)
- Mra: cosmetics (patch from person)
- BuddyPounce: deprecated and bizarre aliases removed (patch from person)
git-svn-id: http://svn.miranda-ng.org/main/trunk@4240 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BuddyPounce')
-rw-r--r-- | plugins/BuddyPounce/src/dialog.cpp | 96 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/main.cpp | 44 |
2 files changed, 70 insertions, 70 deletions
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 1f1aae170c..a9aa0f77b5 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -34,7 +34,7 @@ void populateContacts(HANDLE BPhContact,HWND hwnd2CB) void saveLastSetting(HANDLE hContact, HWND hwnd)
{
TCHAR number[8];//, string[1024];//for sending file name
- switch (DBGetContactSettingByte(hContact, modname, "LastSetting", 2)) // nothing to do
+ switch (db_get_b(hContact, modname, "LastSetting", 2)) // nothing to do
{
case 0: // Send If My Status Is...
break;
@@ -45,24 +45,24 @@ void saveLastSetting(HANDLE hContact, HWND hwnd) break;
case 3: // Reuse Pounce
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- DBWriteContactSettingByte(hContact, modname, "Reuse", (BYTE)_ttoi(number));
+ db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number));
break;
case 4: // Give Up delay
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- DBWriteContactSettingByte(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
+ db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
{
time_t today = time(NULL);
- DBWriteContactSettingDword(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
+ db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
}
break;
case 5: // confirm window
GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- DBWriteContactSettingByte(hContact, modname, "ConfirmTimeout", (BYTE)_ttoi(number));
+ db_set_b(hContact, modname, "ConfirmTimeout", (BYTE)_ttoi(number));
break;
// case 7: // send a file
// GetDlgItemText(hwnd, IDC_SETTINGTEXT, string, 1024);
-// DBWriteContactSettingTString(hContact, modname, "FileToSend", string);
+// db_set_ws(hContact, modname, "FileToSend", string);
// break;
}
}
@@ -80,12 +80,12 @@ void hideAll(HWND hwnd) void getDefaultMessage(HWND hwnd, UINT control, HANDLE hContact)
{
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv))
+ if (!db_get_s(hContact, modname, "PounceMsg", &dbv))
{
SetDlgItemText(hwnd, control, dbv.ptszVal);
DBFreeVariant(&dbv);
}
- else if (!DBGetContactSettingTString(NULL, modname, "PounceMsg", &dbv))
+ else if (!db_get_s(NULL, modname, "PounceMsg", &dbv))
{
SetDlgItemText(hwnd, control, dbv.ptszVal);
DBFreeVariant(&dbv);
@@ -126,13 +126,13 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (!_tcscmp(type, _T("Any")))
{
if (LOWORD(wParam) == IDOK)
- DBWriteContactSettingWord(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)flag);
+ db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)flag);
wi->SendIfMy = 0;
}
else
{
if (LOWORD(wParam) == IDOK)
- DBWriteContactSettingWord(wi->hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)flag);
+ db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)flag);
wi->SendWhenThey = 0;
}
DestroyWindow(hwnd);
@@ -154,7 +154,7 @@ void statusModes(struct windowInfo *wi, int myStatusMode) // myStatusMode=1 send else
{
hwnd = wi->SendIfMy = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_STATUSMODES), 0, StatusModesDlgProc, (LPARAM)wi);
- statusFlag = DBGetContactSettingWord(wi->hContact, modname, "SendIfMyStatusIsFLAG", 0);
+ statusFlag = db_get_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", 0);
SetWindowText(hwnd, TranslateT("Send If My Status Is"));
SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("Any"));
SetDlgItemText(hwnd, IDC_CHECK2, TranslateT("Online"));
@@ -174,7 +174,7 @@ void statusModes(struct windowInfo *wi, int myStatusMode) // myStatusMode=1 send else
{
hwnd = wi->SendWhenThey = CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_STATUSMODES),0,StatusModesDlgProc, (LPARAM)wi);
- statusFlag = DBGetContactSettingWord(wi->hContact, modname, "SendIfTheirStatusIsFLAG", 0);
+ statusFlag = db_get_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", 0);
SetWindowText(hwnd, TranslateT("Send If Their Status changes"));
SetDlgItemText(hwnd, IDC_CHECK1, TranslateT("From Offline"));
SetDlgItemText(hwnd, IDC_CHECK2, TranslateT("To Online"));
@@ -202,14 +202,14 @@ void statusModes(struct windowInfo *wi, int myStatusMode) // myStatusMode=1 send void deletePounce(HANDLE hContact)
{
- DBDeleteContactSetting(hContact,modname, "PounceMsg");
- DBDeleteContactSetting(hContact,modname, "SendIfMyStatusIsFLAG");
- DBDeleteContactSetting(hContact,modname, "SendIfTheirStatusIsFLAG");
- DBDeleteContactSetting(hContact,modname, "Reuse");
- DBDeleteContactSetting(hContact, modname, "GiveUpDays");
- DBDeleteContactSetting(hContact, modname, "GiveUpDate");
- DBDeleteContactSetting(hContact, modname, "ConfirmTimeout");
- DBDeleteContactSetting(hContact, modname, "FileToSend");
+ db_unset(hContact,modname, "PounceMsg");
+ db_unset(hContact,modname, "SendIfMyStatusIsFLAG");
+ db_unset(hContact,modname, "SendIfTheirStatusIsFLAG");
+ db_unset(hContact,modname, "Reuse");
+ db_unset(hContact, modname, "GiveUpDays");
+ db_unset(hContact, modname, "GiveUpDate");
+ db_unset(hContact, modname, "ConfirmTimeout");
+ db_unset(hContact, modname, "FileToSend");
}
INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -258,7 +258,7 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
}
- else DBDeleteContactSetting(hContact, modname, "PounceMsg");
+ else db_unset(hContact, modname, "PounceMsg");
} // fall through
case IDCANCEL:
if (LOWORD(wParam) == IDC_ADVANCED)
@@ -292,7 +292,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
populateContacts(wi->hContact, GetDlgItem(hwnd, IDC_CONTACTS));
SendMessage(GetDlgItem(hwnd,IDC_SPIN), UDM_SETRANGE, 0, (LPARAM) MAKELONG ((short) 1024, (short) 0));
- DBWriteContactSettingByte(wi->hContact, modname, "LastSetting", 0);
+ db_set_b(wi->hContact, modname, "LastSetting", 0);
}
return FALSE;
case WM_COMMAND:
@@ -321,10 +321,10 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
if (!text) { msg(TranslateT("Couldnt Allocate enough memory"), _T("")); break; }
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- DBWriteContactSettingTString(hContact, modname, "PounceMsg", text);
+ db_set_ws(hContact, modname, "PounceMsg", text);
mir_free(text);
}
- else DBDeleteContactSetting(hContact, modname, "PounceMsg");
+ else db_unset(hContact, modname, "PounceMsg");
saveLastSetting(hContact, hwnd);
} // fall through
if (LOWORD(wParam) == IDC_SIMPLE)
@@ -354,12 +354,12 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
- DBWriteContactSettingWord(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfMyStatusIsFLAG",0));
- DBWriteContactSettingWord(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfTheirStatusIsFLAG",0));
- DBWriteContactSettingByte(hContact, modname, "Reuse",(BYTE)DBGetContactSettingByte(NULL, modname, "Reuse",0));
- DBWriteContactSettingByte(hContact, modname, "GiveUpDays", (BYTE)DBGetContactSettingByte(NULL, modname, "GiveUpDays",0));
- DBWriteContactSettingDword(hContact, modname, "GiveUpDate", (DWORD)DBGetContactSettingDword(NULL, modname, "GiveUpDate",0));
- DBWriteContactSettingByte(hContact, modname, "ConfirmTimeout", (BYTE)DBGetContactSettingByte(NULL, modname, "ConfirmTimeout",0));
+ db_set_w(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",0));
+ db_set_w(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",0));
+ db_set_b(hContact, modname, "Reuse",(BYTE)db_get_b(NULL, modname, "Reuse",0));
+ db_set_b(hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays",0));
+ db_set_dw(hContact, modname, "GiveUpDate", (DWORD)DBGetContactSettingDword(NULL, modname, "GiveUpDate",0));
+ db_set_b(hContact, modname, "ConfirmTimeout", (BYTE)db_get_b(NULL, modname, "ConfirmTimeout",0));
}
break;
case IDC_SETTINGS:
@@ -383,7 +383,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Reuse this message? (0 to use it once)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Times"));
- SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "Reuse", 0), temp, 10));
+ SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "Reuse", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
@@ -392,7 +392,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Giveup after.. (0 to not giveup)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Days"));
- SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "GiveUpDays", 0), temp, 10));
+ SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "GiveUpDays", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
@@ -401,7 +401,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Show confirmation window? (0 to not Show)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Seconds to wait before sending"));
- SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
+ SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
@@ -413,7 +413,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l // ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_SHOW);
// break;
}
- DBWriteContactSettingByte(wi->hContact, modname, "LastSetting", (BYTE)item);
+ db_set_b(wi->hContact, modname, "LastSetting", (BYTE)item);
}
break;
}
@@ -441,9 +441,9 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L SetDlgItemText(hwnd, GRP_MSG, msg);
populateSettingsList(GetDlgItem(hwnd, IDC_SETTINGS));
SendMessage(GetDlgItem(hwnd,IDC_SPIN), UDM_SETRANGE, 0, (LPARAM) MAKELONG ((short) 1024, (short) 0));
- CheckDlgButton(hwnd, IDC_USEADVANCED, DBGetContactSettingByte(NULL, modname, "UseAdvanced", 0));
- CheckDlgButton(hwnd, IDC_SHOWDELIVERYMSGS, DBGetContactSettingByte(NULL, modname, "ShowDeliveryMessages", 1));
- DBWriteContactSettingByte(wi->hContact, modname, "LastSetting", 0);
+ CheckDlgButton(hwnd, IDC_USEADVANCED, db_get_b(NULL, modname, "UseAdvanced", 0));
+ CheckDlgButton(hwnd, IDC_SHOWDELIVERYMSGS, db_get_b(NULL, modname, "ShowDeliveryMessages", 1));
+ db_set_b(wi->hContact, modname, "LastSetting", 0);
}
return FALSE;
case WM_NOTIFY:
@@ -462,12 +462,12 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
if (!text) { msg(TranslateT("Couldnt Allocate enough memory"), _T("")); break; }
GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- DBWriteContactSettingTString(hContact, modname, "PounceMsg", text);
+ db_set_ws(hContact, modname, "PounceMsg", text);
mir_free(text);
}
- else DBDeleteContactSetting(hContact, modname, "PounceMsg");
- DBWriteContactSettingByte(NULL, modname, "UseAdvanced", (BYTE)IsDlgButtonChecked(hwnd, IDC_USEADVANCED));
- DBWriteContactSettingByte(NULL, modname, "ShowDeliveryMessages", (BYTE)IsDlgButtonChecked(hwnd, IDC_SHOWDELIVERYMSGS));
+ else db_unset(hContact, modname, "PounceMsg");
+ db_set_b(NULL, modname, "UseAdvanced", (BYTE)IsDlgButtonChecked(hwnd, IDC_USEADVANCED));
+ db_set_b(NULL, modname, "ShowDeliveryMessages", (BYTE)IsDlgButtonChecked(hwnd, IDC_SHOWDELIVERYMSGS));
if (wi->SendIfMy) DestroyWindow(wi->SendIfMy);
if (wi->SendWhenThey) DestroyWindow(wi->SendWhenThey);
@@ -519,7 +519,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Reuse this message? (0 to use it once)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Times"));
- SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "Reuse", 0), temp, 10));
+ SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "Reuse", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
@@ -528,7 +528,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Giveup after.. (0 to not giveup)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Days"));
- SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "GiveUpDays", 0), temp, 10));
+ SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "GiveUpDays", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
@@ -537,7 +537,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Show confirmation window? (0 to not Show)"));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_SHOW);
SetDlgItemText(hwnd, IDC_SETTINGMSG2, TranslateT("Seconds to wait before sending"));
- SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(DBGetContactSettingByte(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
+ SetDlgItemText(hwnd, IDC_SETTINGNUMBER, _itot(db_get_b(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
break;
@@ -549,7 +549,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L // ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_SHOW);
// break;
}
- DBWriteContactSettingByte(wi->hContact, modname, "LastSetting", (BYTE)item);
+ db_set_b(wi->hContact, modname, "LastSetting", (BYTE)item);
}
break;
}
@@ -567,9 +567,9 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP struct SendPounceDlgProcStruct *spdps = (struct SendPounceDlgProcStruct *)lParam;
if (!spdps) DestroyWindow(hwnd);
TranslateDialogDefault(hwnd);
- spdps->timer = DBGetContactSettingByte(spdps->hContact, modname, "ConfirmTimeout", 0);
+ spdps->timer = db_get_b(spdps->hContact, modname, "ConfirmTimeout", 0);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)spdps);
- if (DBGetContactSettingTString(spdps->hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
+ if (db_get_s(spdps->hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
SetDlgItemText(hwnd,IDC_MESSAGE, dbv.ptszVal);
DBFreeVariant(&dbv);
SetTimer(hwnd,1,1000,NULL);
@@ -622,7 +622,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)lParam);
TranslateDialogDefault(hwnd);
hContact = (HANDLE)lParam;
- if (DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
+ if (db_get_s(hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
SetDlgItemText(hwnd, IDC_MESSAGE, dbv.ptszVal);
DBFreeVariant(&dbv);
}
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 9e60608d2d..46cac2a0d8 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -64,15 +64,15 @@ int MsgAck(WPARAM wParam, LPARAM lParam) && ack->type==ACKTYPE_MESSAGE
&& ack->hProcess==(HANDLE)WindowList_Find(hWindowList,ack->hContact))
{
- if (DBGetContactSettingByte(NULL, modname, "ShowDeliveryMessages", 1))
+ if (db_get_b(NULL, modname, "ShowDeliveryMessages", 1))
CreateMessageAcknowlegedWindow(ack->hContact,ack->result == ACKRESULT_SUCCESS);
if (ack->result == ACKRESULT_SUCCESS)
{
// wrtie it to the DB
DBEVENTINFO dbei = { 0 };
DBVARIANT dbv;
- int reuse = DBGetContactSettingByte(ack->hContact,modname, "Reuse", 0);
- if (!DBGetContactSettingTString(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
+ int reuse = db_get_b(ack->hContact,modname, "Reuse", 0);
+ if (!db_get_s(ack->hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
{
char* pszUtf = mir_utf8encodeT(dbv.ptszVal);
dbei.cbSize = sizeof(dbei);
@@ -87,11 +87,11 @@ int MsgAck(WPARAM wParam, LPARAM lParam) }
// check to reuse
if (reuse > 1)
- DBWriteContactSettingByte(ack->hContact, modname, "Reuse", (BYTE)(reuse-1));
+ db_set_b(ack->hContact, modname, "Reuse", (BYTE)(reuse-1));
else
{
- DBWriteContactSettingByte(ack->hContact,modname, "Reuse", 0);
- DBWriteContactSettingTString(ack->hContact, modname, "PounceMsg", _T(""));
+ db_set_b(ack->hContact,modname, "Reuse", 0);
+ db_set_ws(ack->hContact, modname, "PounceMsg", _T(""));
}
}
WindowList_Remove(hWindowList,(HWND)ack->hProcess);
@@ -145,9 +145,9 @@ int statusCheck(int statusFlag, int status) int CheckDate(HANDLE hContact)
{
time_t curtime = time (NULL);
- if(!DBGetContactSettingByte(hContact,modname,"GiveUpDays",0))
+ if(!db_get_b(hContact,modname,"GiveUpDays",0))
return 1;
- if(DBGetContactSettingByte(hContact,modname,"GiveUpDays",0) && ( abs((time_t)DBGetContactSettingDword(hContact,modname,"GiveUpDate",0)) > curtime))
+ if(db_get_b(hContact,modname,"GiveUpDays",0) && ( abs((time_t)db_get_dw(hContact,modname,"GiveUpDate",0)) > curtime))
return 1;
return 0;
}
@@ -168,24 +168,24 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM))
{
int newStatus = cws->value.wVal;
- int oldStatus = DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
+ int oldStatus = db_get_w((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE);
if ( ( newStatus != oldStatus ) && ( (HANDLE)wParam != NULL) && ( newStatus != ID_STATUS_OFFLINE) )
{
HANDLE hContact = (HANDLE)wParam;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
+ if (!db_get_s(hContact, modname, "PounceMsg", &dbv) && (dbv.ptszVal[0] != '\0'))
{
// check my status
- if (statusCheck(DBGetContactSettingWord(hContact, modname, "SendIfMyStatusIsFLAG", 0), CallProtoService(szProto, PS_GETSTATUS,0,0))
+ if (statusCheck(db_get_w(hContact, modname, "SendIfMyStatusIsFLAG", 0), CallProtoService(szProto, PS_GETSTATUS,0,0))
// check the contacts status
- && statusCheck(DBGetContactSettingWord(hContact, modname, "SendIfTheirStatusIsFLAG", 0), newStatus) )
+ && statusCheck(db_get_w(hContact, modname, "SendIfTheirStatusIsFLAG", 0), newStatus) )
{
// check if we r giving up after x days
if (CheckDate(hContact))
{
- if (DBGetContactSettingByte(hContact, modname, "ConfirmTimeout", 0))
+ if (db_get_b(hContact, modname, "ConfirmTimeout", 0))
{
struct SendPounceDlgProcStruct *spdps = (struct SendPounceDlgProcStruct *)mir_alloc(sizeof(struct SendPounceDlgProcStruct));
TCHAR *message = mir_tstrdup(dbv.ptszVal); // will get free()ed in the send confirm window proc
@@ -208,7 +208,7 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM wParam, LPARAM lParam)
{
- if (DBGetContactSettingByte(NULL, modname, "UseAdvanced", 0) || DBGetContactSettingByte((HANDLE)wParam, modname, "UseAdvanced", 0))
+ if (db_get_b(NULL, modname, "UseAdvanced", 0) || db_get_b((HANDLE)wParam, modname, "UseAdvanced", 0))
CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),0,BuddyPounceDlgProc, wParam);
else CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),0,BuddyPounceSimpleDlgProc, wParam);
return 0;
@@ -219,12 +219,12 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE)wParam;
TCHAR* message = (TCHAR*)lParam;
time_t today = time(NULL);
- DBWriteContactSettingTString(hContact, modname, "PounceMsg", message);
- DBWriteContactSettingWord(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfMyStatusIsFLAG",1));
- DBWriteContactSettingWord(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)DBGetContactSettingWord(NULL, modname, "SendIfTheirStatusIsFLAG",1));
- DBWriteContactSettingByte(hContact, modname, "Reuse", (BYTE)DBGetContactSettingByte(NULL, modname, "Reuse",0));
- DBWriteContactSettingByte(hContact, modname, "GiveUpDays", (BYTE)DBGetContactSettingByte(NULL, modname, "GiveUpDays",0));
- DBWriteContactSettingDword(hContact, modname, "GiveUpDate", (DWORD)(DBGetContactSettingByte(hContact, modname, "GiveUpDays",0)*SECONDSINADAY));
+ db_set_ws(hContact, modname, "PounceMsg", message);
+ db_set_w(hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",1));
+ db_set_w(hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",1));
+ db_set_b(hContact, modname, "Reuse", (BYTE)db_get_b(NULL, modname, "Reuse",0));
+ db_set_b(hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays",0));
+ db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(db_get_b(hContact, modname, "GiveUpDays",0)*SECONDSINADAY));
return 0;
}
@@ -233,13 +233,13 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE)wParam;
TCHAR* message = (TCHAR*)lParam;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, modname, "PounceMsg",&dbv))
+ if (!db_get_s(hContact, modname, "PounceMsg",&dbv))
{
TCHAR* newPounce = (TCHAR*)mir_alloc(lstrlen(dbv.ptszVal) + lstrlen(message) + 1);
if (!newPounce) return 1;
_tcscpy(newPounce, dbv.ptszVal);
_tcscat(newPounce, message);
- DBWriteContactSettingTString(hContact, modname, "PounceMsg", newPounce);
+ db_set_ws(hContact, modname, "PounceMsg", newPounce);
mir_free(newPounce);
DBFreeVariant(&dbv);
}
|