diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-06 10:19:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-06 10:19:01 +0000 |
commit | f6625332602cf4e9ea0297744a70c8eb4bb5d4b9 (patch) | |
tree | 4337cfaea6d4cf8c2911bfcdbefeab23e1800ac0 /plugins/BuddyPounce/src/dialog.cpp | |
parent | cc765649fcd13feb9389d77853c20d76f40823ac (diff) |
- possible fix for the timer looping;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4328 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BuddyPounce/src/dialog.cpp')
-rw-r--r-- | plugins/BuddyPounce/src/dialog.cpp | 767 |
1 files changed, 383 insertions, 384 deletions
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 0dbbf22d1b..2d5f1ef7b2 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -28,36 +28,30 @@ void populateContacts(HANDLE BPhContact,HWND hwnd2CB) void saveLastSetting(HANDLE hContact, HWND hwnd)
{
TCHAR number[8];//, string[1024];//for sending file name
- switch (db_get_b(hContact, modname, "LastSetting", 2)) // nothing to do
- {
- case 0: // Send If My Status Is...
+ switch (db_get_b(hContact, modname, "LastSetting", 2)) { // nothing to do
+ case 0: // Send If My Status Is...
break;
- case 1: // Send If They Change status to
+ case 1: // Send If They Change status to
break;
- case 2: // ------, fall through
- case 6: // nothing to do...
+ case 2: // ------, fall through
+ case 6: // nothing to do...
break;
- case 3: // Reuse Pounce
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number));
+ case 3: // Reuse Pounce
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
+ db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number));
break;
- case 4: // Give Up delay
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
- {
- time_t today = time(NULL);
- db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
- }
+ case 4: // Give Up delay
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
+ db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
+ {
+ time_t today = time(NULL);
+ db_set_dw(hContact, modname, "GiveUpDate", (DWORD)(_ttoi(number)*SECONDSINADAY));
+ }
break;
- case 5: // confirm window
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
- db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_ttoi(number));
+ case 5: // confirm window
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
+ db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_ttoi(number));
break;
-
-// case 7: // send a file
-// GetDlgItemText(hwnd, IDC_SETTINGTEXT, string, 1024);
-// db_set_ws(hContact, modname, "FileToSend", string);
-// break;
}
}
@@ -65,10 +59,8 @@ void hideAll(HWND hwnd) {
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG2), SW_HIDE);
-// ShowWindow(GetDlgItem(hwnd, IDC_BUTTON), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_HIDE);
-// ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_HIDE);
}
void getDefaultMessage(HWND hwnd, UINT control, HANDLE hContact)
@@ -79,56 +71,55 @@ void getDefaultMessage(HWND hwnd, UINT control, HANDLE hContact) db_free(&dbv);
}
else if (!db_get_ts(NULL, modname, "PounceMsg", &dbv)) {
- SetDlgItemText(hwnd, control, dbv.ptszVal);
- db_free(&dbv);
- }
+ SetDlgItemText(hwnd, control, dbv.ptszVal);
+ db_free(&dbv);
+ }
}
+
INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG: {
- struct windowInfo *wi = (struct windowInfo *)lParam;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi);
- TranslateDialogDefault(hwnd);
- }
+ case WM_INITDIALOG:
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); // windowInfo*
+ TranslateDialogDefault(hwnd);
+
return FALSE;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDOK:
- case IDCANCEL: {
- struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- TCHAR type[32];
- int flag = 0;
- GetDlgItemText(hwnd, IDC_CHECK1, type, 32);
- flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
- |(IsDlgButtonChecked(hwnd, IDC_CHECK2)<<1)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK3)<<2)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK4)<<3)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK5)<<4)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK6)<<5)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK7)<<6)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK8)<<7)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK9)<<8)
- |(IsDlgButtonChecked(hwnd, IDC_CHECK10)<<9);
- if (!_tcscmp(type, _T("Any"))) {
- if (LOWORD(wParam) == IDOK)
- db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)flag);
- wi->SendIfMy = 0;
- }
- else {
- if (LOWORD(wParam) == IDOK)
- db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)flag);
- wi->SendWhenThey = 0;
- }
- DestroyWindow(hwnd);
- }
- break;
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ TCHAR type[32];
+ GetDlgItemText(hwnd, IDC_CHECK1, type, 32);
+
+ WORD flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK2)<<1)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK3)<<2)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK4)<<3)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK5)<<4)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK6)<<5)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK7)<<6)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK8)<<7)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK9)<<8)
+ |(IsDlgButtonChecked(hwnd, IDC_CHECK10)<<9);
+
+ if (!_tcscmp(type, _T("Any"))) {
+ if (LOWORD(wParam) == IDOK)
+ db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", flag);
+ wi->SendIfMy = 0;
}
+ else {
+ if (LOWORD(wParam) == IDOK)
+ db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", flag);
+ wi->SendWhenThey = 0;
+ }
+ DestroyWindow(hwnd);
+ }
break;
}
return FALSE;
}
-void statusModes(struct windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMyStatusFlag
+void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMyStatusFlag
{
int statusFlag;
HWND hwnd;
@@ -201,54 +192,56 @@ void deletePounce(HANDLE hContact) INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
switch(msg) {
- case WM_INITDIALOG: {
- HANDLE hContact = (HANDLE)lParam;
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
+ hContact = (HANDLE)lParam;
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)lParam);
+
+ getDefaultMessage(hwnd, IDC_MESSAGE, hContact);
+ {
TCHAR msg[1024];
- TranslateDialogDefault(hwnd);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)lParam);
-
- 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);
-
}
return FALSE;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_MESSAGE: {
- if (HIWORD(wParam) == EN_CHANGE) {
- int length;
- TCHAR msg[1024];
- length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
- SetDlgItemText(hwnd, GRP_MSG, msg);
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ int length;
+ TCHAR msg[1024];
+ length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ SetDlgItemText(hwnd, GRP_MSG, msg);
+ }
+ break;
+
+ case IDC_ADVANCED:
+ // fall through
+
+ case IDOK:
+ {
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
+ if (length>1) {
+ TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
+ if (!text) {
+ msg(TranslateT("Couldnt Allocate enough memory"), _T(""));
+ break;
}
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
}
- break;
- case IDC_ADVANCED:
- // fall through
- case IDOK: {
- TCHAR *text;
- HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1;
- if (length>1) {
- text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
- if (!text) {
- msg(TranslateT("Couldnt Allocate enough memory"), _T(""));
- break;
- }
- GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- }
- else db_unset(hContact, modname, "PounceMsg");
- } // fall through
- case IDCANCEL:
- if (LOWORD(wParam) == IDC_ADVANCED)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), 0, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
- DestroyWindow(hwnd);
- break;
- return FALSE;
+ else db_unset(hContact, modname, "PounceMsg");
}
+ // fall through
+ case IDCANCEL:
+ if (LOWORD(wParam) == IDC_ADVANCED)
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE), 0, BuddyPounceDlgProc, GetWindowLongPtr(hwnd, GWLP_USERDATA));
+ DestroyWindow(hwnd);
+ }
break;
}
return FALSE;
@@ -256,140 +249,138 @@ INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LP INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
switch(msg) {
- case WM_INITDIALOG: {
- struct windowInfo *wi = (struct windowInfo *)mir_alloc(sizeof(struct windowInfo));
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
+ wi = (windowInfo *)mir_alloc(sizeof(windowInfo));
+ if (!wi) {
+ msg(TranslateT("error......"), TranslateT("Buddy Pounce"));
+ DestroyWindow(hwnd);
+ }
+ wi->hContact = (HANDLE)lParam;
+ wi->SendIfMy = 0;
+ wi->SendWhenThey = 0;
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi);
+ getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
+ {
TCHAR msg[1024];
- if (!wi) { msg(TranslateT("error......"), TranslateT("Buddy Pounce")); DestroyWindow(hwnd); }
- TranslateDialogDefault(hwnd);
- wi->hContact = (HANDLE)lParam;
- wi->SendIfMy = 0;
- wi->SendWhenThey = 0;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi);
- getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
- 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));
- db_set_b(wi->hContact, modname, "LastSetting", 0);
}
+ 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));
+ db_set_b(wi->hContact, modname, "LastSetting", 0);
return FALSE;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_MESSAGE: {
- if (HIWORD(wParam) == EN_CHANGE) {
- int length;
- TCHAR msg[1024];
- length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
- SetDlgItemText(hwnd, GRP_MSG, msg);
- }
- }
- break;
- case IDC_SIMPLE:
- case IDOK: {
- TCHAR *text;
- HANDLE hContact = (HANDLE)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL,0,0),0);
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
- if (length>1) {
- text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
- if (!text) {
- msg(TranslateT("Couldnt Allocate enough memory"), _T(""));
- break;
- }
- GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, modname, "PounceMsg", text);
- mir_free(text);
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ int length;
+ TCHAR msg[1024];
+ length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ SetDlgItemText(hwnd, GRP_MSG, msg);
+ }
+ break;
+
+ case IDC_SIMPLE:
+ case IDOK:
+ {
+ HANDLE hContact = (HANDLE)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL,0,0),0);
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
+ if (length>1) {
+ TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
+ if (!text) {
+ msg(TranslateT("Couldnt Allocate enough memory"), _T(""));
+ break;
}
- else db_unset(hContact, modname, "PounceMsg");
- saveLastSetting(hContact, hwnd);
- } // fall through
- if (LOWORD(wParam) == IDC_SIMPLE)
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), 0, BuddyPounceSimpleDlgProc, (LPARAM)((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
- // fall through
- case IDCANCEL: {
- struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (wi->SendIfMy) DestroyWindow(wi->SendIfMy);
- if (wi->SendWhenThey) DestroyWindow(wi->SendWhenThey);
- mir_free(wi);
- DestroyWindow(hwnd);
- }
- break;
- case IDC_DELETE: {
- HANDLE hContact = ((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
- deletePounce(hContact);
- SetDlgItemText(hwnd, IDC_MESSAGE, _T(""));
- SetDlgItemText(hwnd, GRP_MSG, TranslateT("The Message (0 Characters)"));
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
+ db_set_ws(hContact, modname, "PounceMsg", text);
+ mir_free(text);
}
- break;
- case IDC_DEFAULT: {
- HANDLE hContact = ((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
- TCHAR msg[1024];
- 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);
- 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)db_get_dw(NULL, modname, "GiveUpDate",0));
- db_set_w(hContact, modname, "ConfirmTimeout", (WORD)db_get_w(NULL, modname, "ConfirmTimeout",0));
+ else db_unset(hContact, modname, "PounceMsg");
+ saveLastSetting(hContact, hwnd);
+ } // fall through
+ if (LOWORD(wParam) == IDC_SIMPLE)
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), 0, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
+ // fall through
+
+ case IDCANCEL:
+ if (wi->SendIfMy) DestroyWindow(wi->SendIfMy);
+ if (wi->SendWhenThey) DestroyWindow(wi->SendWhenThey);
+ mir_free(wi);
+ DestroyWindow(hwnd);
+ break;
+
+ case IDC_DELETE:
+ deletePounce(wi->hContact);
+ SetDlgItemText(hwnd, IDC_MESSAGE, _T(""));
+ SetDlgItemText(hwnd, GRP_MSG, TranslateT("The Message (0 Characters)"));
+ break;
+
+ case IDC_DEFAULT:
+ getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
+ {
+ TCHAR msg[1024];
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
+ SetDlgItemText(hwnd, GRP_MSG, msg);
+ }
+ db_set_w(wi->hContact, modname, "SendIfMyStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfMyStatusIsFLAG",0));
+ db_set_w(wi->hContact, modname, "SendIfTheirStatusIsFLAG", (WORD)db_get_w(NULL, modname, "SendIfTheirStatusIsFLAG",0));
+ db_set_b(wi->hContact, modname, "Reuse",(BYTE)db_get_b(NULL, modname, "Reuse",0));
+ db_set_b(wi->hContact, modname, "GiveUpDays", (BYTE)db_get_b(NULL, modname, "GiveUpDays",0));
+ db_set_dw(wi->hContact, modname, "GiveUpDate", (DWORD)db_get_dw(NULL, modname, "GiveUpDate",0));
+ db_set_w(wi->hContact, modname, "ConfirmTimeout", (WORD)db_get_w(NULL, modname, "ConfirmTimeout",0));
+ break;
+
+ case IDC_SETTINGS:
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
+ int item = SendMessage(GetDlgItem(hwnd, IDC_SETTINGS), LB_GETCURSEL, 0, 0);
+ TCHAR temp[5];
+ saveLastSetting(wi->hContact, hwnd);
+ hideAll(hwnd);
+ switch (item) {
+ case 0: // Send If My Status Is...
+ statusModes(wi, 1);
+ break;
+ case 1: // Send If They Change status to
+ statusModes(wi, 0);
+ break;
+ case 3: // Reuse Pounce
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
+ 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(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;
+ case 4: // Give Up delay
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
+ 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(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;
+ case 5: // confirm window
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
+ 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(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
+ ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
+ break;
}
- break;
- case IDC_SETTINGS:
- if (HIWORD(wParam) == LBN_SELCHANGE) {
- struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- int item = SendMessage(GetDlgItem(hwnd, IDC_SETTINGS), LB_GETCURSEL, 0, 0);
- TCHAR temp[5];
- saveLastSetting(wi->hContact, hwnd);
- hideAll(hwnd);
- switch (item) {
- case 0: // Send If My Status Is...
- statusModes(wi, 1);
- break;
- case 1: // Send If They Change status to
- statusModes(wi, 0);
- break;
- case 3: // Reuse Pounce
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- 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(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;
- case 4: // Give Up delay
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- 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(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;
- case 5: // confirm window
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- 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(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
- ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
- break;
-
-// case 7: // send a file
-// ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
-// SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Send a file"));
-// ShowWindow(GetDlgItem(hwnd, IDC_BUTTON), SW_SHOW);
-// ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_SHOW);
-// break;
- }
- db_set_b(wi->hContact, modname, "LastSetting", (BYTE)item);
- }
- break;
+ db_set_b(wi->hContact, modname, "LastSetting", (BYTE)item);
}
+ }
break;
}
return FALSE;
@@ -398,15 +389,16 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG: {
- struct windowInfo *wi = (struct windowInfo *)mir_alloc(sizeof(struct windowInfo));
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
+ {
+ windowInfo *wi = (windowInfo *)mir_alloc(sizeof(windowInfo));
TCHAR msg[1024];
- TranslateDialogDefault(hwnd);
wi->hContact = 0;
wi->SendIfMy = 0;
wi->SendWhenThey = 0;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi);
-
+
getDefaultMessage(hwnd, IDC_MESSAGE, wi->hContact);
mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)));
SetDlgItemText(hwnd, GRP_MSG, msg);
@@ -417,108 +409,99 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L db_set_b(wi->hContact, modname, "LastSetting", 0);
}
return FALSE;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY: {
- TCHAR *text;
- struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- HANDLE hContact = ((struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
- int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
- if (length > 1) {
- text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
- if (!text) {
- msg(TranslateT("Couldnt Allocate enough memory"), _T(""));
- break;
- }
- GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
- db_set_ws(hContact, modname, "PounceMsg", text);
- mir_free(text);
- }
- 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);
- }
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ HANDLE hContact = ((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact;
+ int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1;
+ if (length > 1) {
+ TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR));
+ if (!text) {
+ msg(TranslateT("Couldnt Allocate enough memory"), _T(""));
break;
}
- break;
+ GetDlgItemText(hwnd, IDC_MESSAGE, text, length);
+ db_set_ws(hContact, modname, "PounceMsg", text);
+ mir_free(text);
+ }
+ 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);
}
+ }
break;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_MESSAGE: {
- if (HIWORD(wParam) == EN_CHANGE) {
- int length;
- TCHAR msg[1024];
- length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
- SetDlgItemText(hwnd, GRP_MSG, msg);
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_MESSAGE:
+ if (HIWORD(wParam) == EN_CHANGE) {
+ int length;
+ TCHAR msg[1024];
+ length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE));
+ mir_sntprintf(msg, SIZEOF(msg), TranslateT("The Message (%d Characters)"), length);
+ SetDlgItemText(hwnd, GRP_MSG, msg);
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_SHOWDELIVERYMSGS:
+ case IDC_USEADVANCED:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_SETTINGS:
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
+ windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ int item = SendMessage(GetDlgItem(hwnd, IDC_SETTINGS), LB_GETCURSEL, 0, 0);
+ TCHAR temp[5];
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ saveLastSetting(wi->hContact, hwnd);
+ hideAll(hwnd);
+ switch (item) {
+ case 0: // Send If My Status Is...
+ statusModes(wi, 1);
+ break;
+ case 1: // Send If They Change status to
+ statusModes(wi, 0);
+ break;
+ case 3: // Reuse Pounce
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
+ 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(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;
+ case 4: // Give Up delay
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
+ 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(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;
+ case 5: // confirm window
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
+ 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(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
+ ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
+ ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
+ break;
}
- break;
- case IDC_SHOWDELIVERYMSGS:
- case IDC_USEADVANCED:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
- case IDC_SETTINGS:
- if (HIWORD(wParam) == LBN_SELCHANGE) {
- struct windowInfo *wi = (struct windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- int item = SendMessage(GetDlgItem(hwnd, IDC_SETTINGS), LB_GETCURSEL, 0, 0);
- TCHAR temp[5];
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- saveLastSetting(wi->hContact, hwnd);
- hideAll(hwnd);
- switch (item) {
- case 0: // Send If My Status Is...
- statusModes(wi, 1);
- break;
- case 1: // Send If They Change status to
- statusModes(wi, 0);
- break;
- case 3: // Reuse Pounce
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- 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(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;
- case 4: // Give Up delay
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- 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(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;
- case 5: // confirm window
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
- 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(db_get_w(wi->hContact, modname, "ConfirmTimeout", 0), temp, 10));
- ShowWindow(GetDlgItem(hwnd, IDC_SETTINGNUMBER), SW_SHOW);
- ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_SHOW);
- break;
-
-// case 7: // send a file
-// ShowWindow(GetDlgItem(hwnd, IDC_SETTINGMSG), SW_SHOW);
-// SetDlgItemText(hwnd, IDC_SETTINGMSG, TranslateT("Send a file"));
-// ShowWindow(GetDlgItem(hwnd, IDC_BUTTON), SW_SHOW);
-// ShowWindow(GetDlgItem(hwnd, IDC_SETTINGTEXT), SW_SHOW);
-// break;
- }
- db_set_b(wi->hContact, modname, "LastSetting", (BYTE)item);
- }
- break;
+ db_set_b(wi->hContact, modname, "LastSetting", (BYTE)item);
}
+ }
break;
}
return FALSE;
@@ -526,50 +509,60 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ SendPounceDlgProcStruct *spdps = (SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
switch(msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
+ spdps = (SendPounceDlgProcStruct*)lParam;
+ if (!spdps)
+ DestroyWindow(hwnd);
+
+ spdps->timer = db_get_w(spdps->hContact, modname, "ConfirmTimeout", 0);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)spdps);
+ {
DBVARIANT dbv;
- struct SendPounceDlgProcStruct *spdps = (struct SendPounceDlgProcStruct *)lParam;
- if (!spdps) DestroyWindow(hwnd);
- TranslateDialogDefault(hwnd);
- spdps->timer = db_get_w(spdps->hContact, modname, "ConfirmTimeout", 0);
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)spdps);
- if (db_get_ts(spdps->hContact, modname, "PounceMsg", &dbv)) DestroyWindow(hwnd);
- SetDlgItemText(hwnd,IDC_MESSAGE, dbv.ptszVal);
- db_free(&dbv);
- SetTimer(hwnd,1,1000,NULL);
- SendMessage(hwnd,WM_TIMER,0,0);
+ if (db_get_ts(spdps->hContact, modname, "PounceMsg", &dbv))
+ DestroyWindow(hwnd);
+ else {
+ SetDlgItemText(hwnd,IDC_MESSAGE, dbv.ptszVal);
+ db_free(&dbv);
+ }
}
+ SetTimer(hwnd,1,1000,NULL);
+ SendMessage(hwnd,WM_TIMER,0,0);
break;
- case WM_TIMER: {
- struct SendPounceDlgProcStruct *spdps = (struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
+ case WM_TIMER:
+ {
TCHAR message[1024];
mir_sntprintf(message, SIZEOF(message), TranslateT("Pounce being sent to %s in %d seconds"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)spdps->hContact, GCDNF_TCHAR), spdps->timer);
SetDlgItemText(hwnd, LBL_CONTACT, message);
- spdps->timer--;
+ }
+ spdps->timer--;
+ if (spdps->timer < 0) {
+ KillTimer(hwnd,1);
+ SendPounce(spdps->message, spdps->hContact);
+ DestroyWindow(hwnd);
+ }
+ break;
- if (spdps->timer == 0) {
- KillTimer(hwnd,1);
- SendPounce(spdps->message, ((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
- mir_free((TCHAR*)((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->message);
- mir_free((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA));
- DestroyWindow(hwnd);
- }
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ KillTimer(hwnd,1);
+ SendPounce(spdps->message, spdps->hContact);
+ // fall through
+ case IDCANCEL:
+ KillTimer(hwnd,1);
+ DestroyWindow(hwnd);
break;
}
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDOK:
- KillTimer(hwnd,1);
- SendPounce(((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->message, ((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact);
- // fall through
- case IDCANCEL:
- KillTimer(hwnd,1);
- mir_free(((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->message);
- mir_free((struct SendPounceDlgProcStruct *)GetWindowLongPtr(hwnd, GWLP_USERDATA));
- DestroyWindow(hwnd);
- break;
- }
+ break;
+
+ case WM_DESTROY:
+ mir_free(spdps->message);
+ mir_free(spdps);
break;
}
return 0;
@@ -578,37 +571,43 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
switch(msg) {
- case WM_INITDIALOG: {
+ case WM_INITDIALOG:
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)lParam);
+ TranslateDialogDefault(hwnd);
+ hContact = (HANDLE)lParam;
+ {
DBVARIANT dbv;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)lParam);
- TranslateDialogDefault(hwnd);
- hContact = (HANDLE)lParam;
if (db_get_ts(hContact, modname, "PounceMsg", &dbv))
DestroyWindow(hwnd);
- SetDlgItemText(hwnd, IDC_MESSAGE, dbv.ptszVal);
- db_free(&dbv);
+ else {
+ SetDlgItemText(hwnd, IDC_MESSAGE, dbv.ptszVal);
+ db_free(&dbv);
+ }
}
break;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDOK: {
- TCHAR text[2048];
- GetWindowText(GetDlgItem(hwnd, IDOK), text, 16);
- if (!_tcscmp(text, TranslateT("Retry"))) {
- GetWindowText(GetDlgItem(hwnd,IDC_MESSAGE), text, 2048);
- SendPounce(text, hContact);
- }
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDOK:
+ {
+ TCHAR text[2048];
+ GetWindowText(GetDlgItem(hwnd, IDOK), text, 16);
+ if (!_tcscmp(text, TranslateT("Retry"))) {
+ GetWindowText(GetDlgItem(hwnd,IDC_MESSAGE), text, 2048);
+ SendPounce(text, hContact);
}
- // fall through
- case IDCANCEL:
- DestroyWindow(hwnd);
- break;
}
+ // fall through
+ case IDCANCEL:
+ DestroyWindow(hwnd);
+ }
break;
}
return 0;
}
+
void CreateMessageAcknowlegedWindow(HANDLE hContact, int SentSuccess)
{
HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, (LPARAM)hContact);
@@ -618,10 +617,10 @@ void CreateMessageAcknowlegedWindow(HANDLE hContact, int SentSuccess) SetWindowText(GetDlgItem(hwnd, IDOK), TranslateT("OK"));
ShowWindow(GetDlgItem(hwnd, IDCANCEL), 0);
}
- else {
+ else {
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Message failed to send to %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR));
SetWindowText(GetDlgItem(hwnd, IDOK), TranslateT("Retry"));
}
SetWindowText(GetDlgItem(hwnd, LBL_CONTACT), msg);
SetWindowText(hwnd, TranslateT(modFullname));
-}
\ No newline at end of file +}
|