diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2016-06-03 09:56:09 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2016-06-03 09:56:09 +0000 |
commit | b78785e029456e22128a2afaeb656c15080b0382 (patch) | |
tree | c00e3db09874dda770f8f3305a7907ebe9fb8f76 | |
parent | 1ba51e81c8c2cf9a802eca5da6054538eeb32865 (diff) |
StdMsg: Fixed message timeout window for metacontact (fixes #763)
git-svn-id: http://svn.miranda-ng.org/main/trunk@16909 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | src/core/stdmsg/src/msgtimedout.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index cbf806bf14..187bc43f41 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -30,7 +30,7 @@ struct ErrorDlgParam INT_PTR SendMessageCmd(MCONTACT hContact, char* msg, int isWchar);
-INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TMsgQueue *item = (TMsgQueue*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -38,7 +38,6 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- RECT rc, rcParent;
ErrorDlgParam *param = (ErrorDlgParam *)lParam;
item = param->item;
@@ -53,11 +52,21 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrT(mir_utf8decodeT(item->szMsg)));
- GetWindowRect(hwndDlg, &rc);
- GetWindowRect(GetParent(hwndDlg), &rcParent);
- SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2,
- (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2,
- 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ HWND hwndParent = GetParent(hwndDlg);
+ if (hwndParent != NULL)
+ {
+ RECT rc;
+ if (GetWindowRect(hwndDlg, &rc))
+ {
+ RECT rcParent;
+ if (GetWindowRect(hwndParent, &rcParent))
+ {
+ SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2,
+ (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2,
+ 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+ }
+ }
}
return TRUE;
@@ -84,10 +93,13 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar void MessageFailureProcess(TMsgQueue *item, const char* err)
{
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, item->hContact);
+ MCONTACT hContact = db_mc_tryMeta(item->hContact);
+
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
if (hwnd == NULL) {
+ // If message window doesn't already exist, open a new one
SendMessageCmd(item->hContact, NULL, 0);
- hwnd = WindowList_Find(g_dat.hMessageWindowList, item->hContact);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
}
else SendMessage(hwnd, DM_REMAKELOG, 0, 0);
|