From 3146b42058bccddb648c2a5d8bfc189ae6ad1dd2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 17 Aug 2017 12:46:06 +0300 Subject: CMraProto::MraPopupShowW: unused parameter dwFlags removed --- protocols/MRA/src/MraPopUp.cpp | 23 ++++++++++------------- protocols/MRA/src/MraPopUp.h | 17 +++++++---------- protocols/MRA/src/MraProto.h | 8 ++++---- protocols/MRA/src/Mra_functions.cpp | 15 ++++++--------- protocols/MRA/src/Mra_proto.cpp | 28 ++++++++++++++-------------- 5 files changed, 41 insertions(+), 50 deletions(-) diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index 5bb872dd86..10d6599e9d 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -68,7 +68,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR case IDC_PREVIEW: for (int i = 0; i < POPUPS_TYPES_COUNT; i++) - ppro->MraPopupShowFromAgentW(i, 0, TranslateW(lpcwszPopupsTypes[i])); + ppro->MraPopupShowFromAgentW(i, TranslateW(lpcwszPopupsTypes[i])); break; case IDC_CHK_ENABLE: @@ -98,9 +98,9 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR DWORD dwType = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_COMBO_POPUP_TYPE); DWORD dwPopupsEventFilter = ppro->getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER); if (IsDlgButtonChecked(hWndDlg, IDC_CHK_ENABLE)) - dwPopupsEventFilter |= (1<setDword("PopupsEventFilter", dwPopupsEventFilter); @@ -125,7 +125,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM) { - if ( ServiceExists(MS_POPUP_ADDPOPUPT)) { + if (ServiceExists(MS_POPUP_ADDPOPUPT)) { OPTIONSDIALOGPAGE odp = { 0 }; odp.dwInitParam = (LPARAM)this; odp.position = 100000000; @@ -195,7 +195,7 @@ LRESULT CALLBACK MraPopupDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM l return DefWindowProc(hWndDlg, msg, wParam, lParam); } -void CMraProto::MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage) +void CMraProto::MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, LPCWSTR lpszMessage) { WCHAR szTitle[MAX_CONTACTNAME]; CMStringW szNick, szEmail; @@ -206,22 +206,21 @@ void CMraProto::MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, DWORD else mir_snwprintf(szTitle, L"%s: %s <%s>", m_tszUserName, szNick.c_str(), szEmail.c_str()); - MraPopupShowW(hContact, dwType, dwFlags, szTitle, lpszMessage); + MraPopupShowW(hContact, dwType, szTitle, lpszMessage); } -void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPCWSTR lpszMessage) +void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, LPWSTR lpszTitle, LPCWSTR lpszMessage) { if (getByte("PopupsEnabled", MRA_DEFAULT_POPUPS_ENABLED)) if (GetBit(getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType)) - if ( ServiceExists(MS_POPUP_ADDPOPUPW)) { - POPUPDATAT ppd = { 0 }; - + if (ServiceExists(MS_POPUP_ADDPOPUPW)) { // delete old email popup if (dwType == MRA_POPUP_TYPE_EMAIL_STATUS && hWndEMailPopupStatus) { PUDeletePopup(hWndEMailPopupStatus); hWndEMailPopupStatus = NULL; } + POPUPDATAT ppd = { 0 }; // load icon switch (dwType) { case MRA_POPUP_TYPE_NONE:// proto icon @@ -247,7 +246,7 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP break; } - MraPopupData *dat = (MraPopupData*)mir_calloc( sizeof(MraPopupData)); + MraPopupData *dat = (MraPopupData*)mir_calloc(sizeof(MraPopupData)); dat->iPopupType = dwType; dat->ppro = this; @@ -282,6 +281,4 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP else PUAddPopupW(&ppd); } - else if (dwFlags & MRA_POPUP_ALLOW_MSGBOX) - MessageBox(NULL, lpszMessage, lpszTitle, MB_OK+(dwType == MRA_POPUP_TYPE_WARNING)?MB_ICONERROR:MB_ICONINFORMATION); } diff --git a/protocols/MRA/src/MraPopUp.h b/protocols/MRA/src/MraPopUp.h index ead13be0bc..893aac7546 100644 --- a/protocols/MRA/src/MraPopUp.h +++ b/protocols/MRA/src/MraPopUp.h @@ -4,15 +4,12 @@ #pragma once -#define MRA_POPUP_ALLOW_MSGBOX 1 -#define MRA_POPUP_ALLOW_ENTER 2 - -#define MRA_POPUP_TYPE_NONE 0 // proto icon -#define MRA_POPUP_TYPE_DEBUG 1 // IDI_APPLICATION -#define MRA_POPUP_TYPE_INFORMATION 2 // IDI_INFORMATION -#define MRA_POPUP_TYPE_QUESTION 3 // IDI_QUESTION -#define MRA_POPUP_TYPE_WARNING 4 // IDI_WARNING -#define MRA_POPUP_TYPE_ERROR 5 // IDI_ERROR -#define MRA_POPUP_TYPE_EMAIL_STATUS 6 // +#define MRA_POPUP_TYPE_NONE 0 // proto icon +#define MRA_POPUP_TYPE_DEBUG 1 // IDI_APPLICATION +#define MRA_POPUP_TYPE_INFORMATION 2 // IDI_INFORMATION +#define MRA_POPUP_TYPE_QUESTION 3 // IDI_QUESTION +#define MRA_POPUP_TYPE_WARNING 4 // IDI_WARNING +#define MRA_POPUP_TYPE_ERROR 5 // IDI_ERROR +#define MRA_POPUP_TYPE_EMAIL_STATUS 6 // #endif // !defined(AFX_MRA_POPUP_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 89b969790b..86da122f9d 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -75,10 +75,10 @@ struct CMraProto : public PROTO virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); void ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode); - void MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPCWSTR lpszMessage); - void MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage); - __forceinline void MraPopupShowFromAgentW(DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage) { - MraPopupShowFromContactW(NULL, dwType, dwFlags, lpszMessage); } + void MraPopupShowW(MCONTACT hContact, DWORD dwType, LPWSTR lpszTitle, LPCWSTR lpszMessage); + void MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, LPCWSTR lpszMessage); + __forceinline void MraPopupShowFromAgentW(DWORD dwType, LPCWSTR lpszMessage) { + MraPopupShowFromContactW(NULL, dwType, lpszMessage); } __forceinline bool mraGetStaticStringA(MCONTACT Contact, const char *ValueName, char *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { return DB_GetStaticStringA(Contact, m_szModuleName, ValueName, Ret, RetBuffSize, pRetBuffSize); } diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index adea964be4..928efc9328 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -24,8 +24,6 @@ struct RECURSION_DATA_STACK_ITEM WIN32_FIND_DATA w32fdFindFileData; }; -LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - CMStringA MraGetSelfVersionString() { LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : ""; @@ -668,9 +666,9 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & SkinPlaySound(szNewMailSound); if (hContact) {// update user info MraUpdateContactInfo(hContact); - MraPopupShowFromContactW(hContact, MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText); + MraPopupShowFromContactW(hContact, MRA_POPUP_TYPE_EMAIL_STATUS, szStatusText); } - else MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText); + else MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, szStatusText); } else { if ( !force_display && getByte("IncrementalNewMailNotify", MRA_DEFAULT_INC_NEW_MAIL_NOTIFY)) { @@ -681,7 +679,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & } else { mir_snwprintf(szStatusText, TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal); - MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, szStatusText); } } } @@ -867,7 +865,7 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode szErrDescription[dwErrDescriptionSize] = 0; mir_snwprintf(szErrorText, L"%s %lu: %s", TranslateW(lpwszErrText), dwErrorCode, szErrDescription); } - MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, szErrorText); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, szErrorText); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -923,10 +921,9 @@ CMStringA CopyNumber(const CMStringA &str) { CMStringA res; - for (LPCSTR p = str; *p; p++) { + for (LPCSTR p = str; *p; p++) if (*p >= '0' && *p <= '9') res.AppendChar(*p); - } return res; } @@ -937,7 +934,7 @@ void EnableControlsArray(HWND hWndDlg, WORD *pwControlsList, size_t dwControlsLi EnableWindow(GetDlgItem(hWndDlg, pwControlsList[i]), bEnabled); } -LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_CHAR) if (GetKeyState(VK_CONTROL) & 0x8000) { diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 83b69b6b9a..b9f669410c 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -18,14 +18,14 @@ DWORD CMraProto::StartConnect() CMStringA szPass; if (szEmail.GetLength() <= 5) - MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Please, setup e-mail in options")); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, TranslateT("Please, setup e-mail in options")); else if (!GetPassDB(szPass)) - MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Please, setup password in options")); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, TranslateT("Please, setup password in options")); else { InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount()); if (INVALID_HANDLE_VALUE != ForkThreadEx(&CMraProto::MraThreadProc, NULL, 0)) return 0; /* OK. */ - MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, TranslateT("Thread creation failure")); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, TranslateT("Thread creation failure")); } InterlockedExchange((volatile LONG*)&m_dwThreadWorkerRunning, FALSE); return ERROR_OPERATION_ABORTED; @@ -395,7 +395,7 @@ bool CMraProto::CmdLoginRejected(BinBuffer &buf) ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD); CMStringA reason; buf >> reason; - MraPopupShowW(NULL, MRA_POPUP_TYPE_ERROR, 0, TranslateT("Logon error: invalid login/password"), _A2T(reason.c_str())); + MraPopupShowW(NULL, MRA_POPUP_TYPE_ERROR, TranslateT("Logon error: invalid login/password"), _A2T(reason.c_str())); return false; } @@ -453,7 +453,7 @@ bool CMraProto::CmdMessageStatus(ULONG seq, BinBuffer &buf) } // not found in queue else if (dwTemp != MESSAGE_DELIVERED) - MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, TranslateT("MRIM_CS_MESSAGE_STATUS: not found in queue")); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, TranslateT("MRIM_CS_MESSAGE_STATUS: not found in queue")); return true; } @@ -591,7 +591,7 @@ bool CMraProto::CmdPopSession(BinBuffer &buf) } } //error - MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, 0, TranslateT("Server error: can't get MPOP key for web authorize")); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_WARNING, TranslateT("Server error: can't get MPOP key for web authorize")); MraMPopSessionQueueFlush(hMPopSessionQueue); return true; @@ -700,7 +700,7 @@ bool CMraProto::CmdUserStatus(BinBuffer &buf) CMStringW wszEmail, wszBuff; mraGetStringW(hContact, "e-mail", wszEmail); wszBuff.Format(L"%s <%s> - %s", pcli->pfnGetContactDisplayName(hContact, 0), wszEmail.c_str(), TranslateT("invisible status changed")); - MraPopupShowFromContactW(hContact, MRA_POPUP_TYPE_INFORMATION, 0, wszBuff); + MraPopupShowFromContactW(hContact, MRA_POPUP_TYPE_INFORMATION, wszBuff); MraSetContactStatus(hContact, ID_STATUS_INVISIBLE); } @@ -750,12 +750,12 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) default:// ## unknown error wchar_t szBuff[1024]; mir_snwprintf(szBuff, TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp); - MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, szBuff); break; } MraSendQueueFree(hSendQueueHandle, seq); } - else MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, TranslateT("MRIM_CS_*_CONTACT_ACK: not found in queue")); + else MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, TranslateT("MRIM_CS_*_CONTACT_ACK: not found in queue")); return true; } @@ -763,7 +763,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) { DWORD dwAckType, dwFlags; MCONTACT hContact; if (MraSendQueueFind(hSendQueueHandle, seq, &dwFlags, &hContact, &dwAckType, NULL, NULL)) { - MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, TranslateT("MRIM_ANKETA_INFO: not found in queue")); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, TranslateT("MRIM_ANKETA_INFO: not found in queue")); return true; } @@ -1044,7 +1044,7 @@ bool CMraProto::CmdGame(BinBuffer &buf) default: wchar_t szBuff[1024]; mir_snwprintf(szBuff, TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg); - MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, szBuff); break; } return true; @@ -1351,7 +1351,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) else { wchar_t szBuff[1024]; mir_snwprintf(szBuff, TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp); - MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff); + MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, szBuff); } } return true; @@ -1527,7 +1527,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) mir_free(pByte); MraSendQueueFree(hSendQueueHandle, pmaHeader->seq); } - else MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, TranslateT("MRIM_CS_SMS_ACK: not found in queue")); + else MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, TranslateT("MRIM_CS_SMS_ACK: not found in queue")); break; case MRIM_CS_PROXY_HELLO: @@ -1807,7 +1807,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & } if (dwFlags & MESSAGE_FLAG_SYSTEM) - MraPopupShowW(hContact, MRA_POPUP_TYPE_INFORMATION, 0, TranslateT("Mail.ru System notify"), (LPWSTR)pre.szMessage); + MraPopupShowW(hContact, MRA_POPUP_TYPE_INFORMATION, TranslateT("Mail.ru System notify"), (LPWSTR)pre.szMessage); } } } -- cgit v1.2.3