From 797b7efe9a86a2ff4e7e4ecfc2219b633f10faa4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 19 Jul 2014 14:23:08 +0000 Subject: - scriver to open metacontact window upon receiving an event - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@9861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/Version.h | 2 +- plugins/Scriver/src/chat/log.cpp | 4 ++-- plugins/Scriver/src/chat/window.cpp | 14 +++++++------- plugins/Scriver/src/infobar.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 8 ++++---- plugins/Scriver/src/msglog.cpp | 14 +++++++------- plugins/Scriver/src/msgs.cpp | 19 +++++++++---------- plugins/Scriver/src/msgwindow.cpp | 4 ++-- plugins/Scriver/src/utils.cpp | 4 ++-- 9 files changed, 35 insertions(+), 36 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/Version.h b/plugins/Scriver/src/Version.h index d5861dfb39..7c1393992f 100644 --- a/plugins/Scriver/src/Version.h +++ b/plugins/Scriver/src/Version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2 #define __MINOR_VERSION 11 #define __RELEASE_NUM 0 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index 8346294b40..bb8274587b 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -139,7 +139,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra // do we need to restore the selection if (oldsel.cpMax != oldsel.cpMin) { - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& oldsel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndRich, NULL, TRUE); } @@ -147,7 +147,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra // need to invalidate the window if (bFlag) { sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE); - SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndRich, NULL, TRUE); } diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 9f4b27a16b..a383b869f3 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -664,7 +664,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (sel.cpMin != sel.cpMax) { SendMessage(hwnd, WM_COPY, 0, 0); sel.cpMin = sel.cpMax; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); } SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE)); } @@ -676,7 +676,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { sel.cpMin = sel.cpMax; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); } } break; @@ -710,10 +710,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case ID_COPYALL: - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all); SendMessage(hwnd, WM_COPY, 0, 0); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0); break; @@ -1095,7 +1095,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)* 0x7FFFFFFF, 0); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); + SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; @@ -1609,7 +1609,7 @@ LABEL_SHOWWINDOW: si.nPos = si.nMax - si.nPage + 1; SetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &si, TRUE); sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE); - SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)&sel); PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); } } diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 22e006550b..8917bb1d78 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -189,7 +189,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA if (sel.cpMin != sel.cpMax) { SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0); sel.cpMin = sel.cpMax ; - SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)& sel); + SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)&sel); bWasCopy = TRUE; } SetFocus(GetParent(hwnd)); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 6716e7e137..3f7d830faa 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -364,12 +364,12 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_COPY, 0, 0); break; case IDM_COPYALL: - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all); SendMessage(hwnd, WM_COPY, 0, 0); - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); break; case IDM_SELECTALL: - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all); + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&all); break; case IDM_CLEAR: SendMessage(GetParent(hwnd), DM_CLEARLOG, 0, 0); @@ -1817,7 +1817,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP acs.hContact = dat->windowData.hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; - CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM)& acs); + CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM)&acs); } if (!db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 5e4485a9aa..585cd5f7ab 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -95,13 +95,13 @@ TCHAR *GetNickname(MCONTACT hContact, const char* szProto) ci.dwFlag |= CNF_UNICODE; TCHAR *szName = NULL; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { if (ci.type == CNFT_ASCIIZ) { if (ci.pszVal) { if (IsUnicodeMIM()) { if (!_tcscmp((TCHAR *)ci.pszVal, TranslateW(_T("'(Unknown Contact)'")))) { ci.dwFlag &= ~CNF_UNICODE; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) szName = mir_a2t((char*)ci.pszVal); } else szName = mir_tstrdup((TCHAR *)ci.pszVal); @@ -879,7 +879,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) // IEVIew MOD End SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)& oldSel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&oldSel); streamData.hContact = dat->windowData.hContact; streamData.hDbEvent = hDbEventFirst; streamData.hDbEventLast = dat->hDbEventLast; @@ -897,20 +897,20 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) gtxl.codepage = 1200; fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& sel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel); } else { SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, FALSE, 0); SetDlgItemText(hwndDlg, IDC_LOG, _T("")); sel.cpMin = 0; sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& sel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel); fi.chrg.cpMin = 0; dat->isMixed = 0; } - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)& stream); - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& oldSel); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&oldSel); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, FALSE, 0); if (g_dat.smileyAddInstalled) { SMADD_RICHEDIT3 smre; diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 5ae4dc4a2c..ec47078267 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -75,15 +75,14 @@ int IsAutoPopup(MCONTACT hContact) { static INT_PTR ReadMessageCommand(WPARAM wParam, LPARAM lParam) { - NewMessageWindowLParam newData = { 0 }; - HWND hwndExisting; - HWND hParent; + CLISTEVENT *pcle = (CLISTEVENT*)lParam; + MCONTACT hContact = db_mc_tryMeta(pcle->hContact); - hwndExisting = WindowList_Find(g_dat.hMessageWindowList, ((CLISTEVENT *) lParam)->hContact); + HWND hwndExisting = WindowList_Find(g_dat.hMessageWindowList, hContact); if (hwndExisting == NULL) { - newData.hContact = ((CLISTEVENT *) lParam)->hContact; - hParent = GetParentWindow(newData.hContact, FALSE); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); + NewMessageWindowLParam newData = { 0 }; + newData.hContact = hContact; + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), GetParentWindow(hContact, FALSE), DlgProcMessage, (LPARAM)&newData); } else SendMessage(GetParent(hwndExisting), CM_POPUPWINDOW, 0, (LPARAM)hwndExisting); return 0; @@ -218,7 +217,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) tn.tszInfo = szTip; tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE; tn.uTimeout = 1000 * 4; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& tn); + CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&tn); } else { CLISTEVENT cle = { sizeof(cle) }; @@ -279,13 +278,13 @@ static void RestoreUnreadMessageAlerts(void) newData.hContact = hContact; newData.flags = NMWLP_INCOMING; HWND hParent = GetParentWindow(newData.hContact, FALSE); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)&newData); } else { cle.hContact = hContact; cle.hDbEvent = hDbEvent; mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)); - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)& cle); + CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); } } hDbEvent = db_event_next(hContact, hDbEvent); diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 2cb4052ad9..e62b387d76 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -560,7 +560,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (hParent == NULL) { RECT rc, rcDesktop; newData.hContact = hContact; - hParent = (HWND)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)& newData); + hParent = (HWND)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)&newData); GetWindowRect(hParent, &rc); rc.right = (rc.right - rc.left); rc.bottom = (rc.bottom - rc.top); @@ -1569,5 +1569,5 @@ HWND GetParentWindow(MCONTACT hContact, BOOL bChat) if (!(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) newData.isChat = FALSE; - return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)& newData); + return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)&newData); } diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 26e516f921..f7b158df80 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -268,7 +268,7 @@ TCHAR *GetRichEditSelection(HWND hwnd) dwFlags = SF_TEXT|SF_UNICODE|SFF_SELECTION; msi.sendBuffer = NULL; msi.sendBufferSize = 0; - SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM)& stream); + SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM)&stream); return (TCHAR*)msi.sendBuffer; } return NULL; @@ -438,7 +438,7 @@ void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen) ci.szProto = dat->szProto; ci.dwFlag = CNF_UNIQUEID; buf[0] = 0; - if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) { + if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) { switch (ci.type) { case CNFT_ASCIIZ: mir_snprintf(buf, maxlen, "%s", ci.pszVal); -- cgit v1.2.3