diff options
author | George Hazan <ghazan@miranda.im> | 2019-01-28 21:31:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-01-28 21:31:35 +0300 |
commit | 24b5718cb9f3e02f262230b1acddabb311437644 (patch) | |
tree | bfb01f3df89f1ce378239c568da5b894856e2af9 /protocols/ICQ-WIM/src | |
parent | f8d8f76be9ee765dd1c0038825778297b4300fd6 (diff) |
fixes #1796 (ICQ10: add message about wrong password)
Diffstat (limited to 'protocols/ICQ-WIM/src')
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 33 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/stdafx.h | 2 |
3 files changed, 30 insertions, 7 deletions
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 522dae7736..77bc9d5268 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -124,7 +124,7 @@ class CIcqProto : public PROTO<CIcqProto> bool m_bOnline = false, m_bTerminated = false; MCONTACT CheckOwnMessage(const CMStringA &reqId, const CMStringA &msgId, bool bRemove); void CheckPassword(void); - void ConnectionFailed(int iReason); + void ConnectionFailed(int iReason, int iErrorCode = 0); void MoveContactToGroup(MCONTACT hContact, const wchar_t *pwszGroup, const wchar_t *pwszNewGroup); void RetrieveUserHistory(MCONTACT, __int64 startMsgId, __int64 endMsgId); void RetrieveUserInfo(MCONTACT); diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 06994acbb1..2393d94ab2 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -84,10 +84,33 @@ void CIcqProto::CheckPassword() else StartSession(); } -void CIcqProto::ConnectionFailed(int iReason) +void CIcqProto::ConnectionFailed(int iReason, int iErrorCode) { debugLogA("ConnectionFailed -> reason %d", iReason); + if (g_bPopupService) { + POPUPDATAT Popup = {}; + Popup.lchIcon = IcoLib_GetIconByHandle(Skin_GetIconHandle(SKINICON_ERROR), true); + wcscpy_s(Popup.lptzContactName, m_tszUserName); + switch (iReason) { + case LOGINERR_BADUSERID: + mir_snwprintf(Popup.lptzText, LPGENW("You have not entered an ICQ number.\nConfigure this in Options -> Network -> ICQ and try again.")); + break; + case LOGINERR_WRONGPASSWORD: + mir_snwprintf(Popup.lptzText, LPGENW("Connection failed.\nYour ICQ number or password was rejected (%d)."), iErrorCode); + break; + case LOGINERR_NONETWORK: + case LOGINERR_NOSERVER: + mir_snwprintf(Popup.lptzText, LPGENW("Connection failed.\nThe server is temporarily unavailable (%d)."), iErrorCode); + break; + default: + mir_snwprintf(Popup.lptzText, LPGENW("Connection failed.\nUnknown error during sign on: %d"), iErrorCode); + break; + } + + CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&Popup, 0); + } + ProtoBroadcastAck(0, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, iReason); ShutdownSession(); } @@ -457,11 +480,11 @@ void CIcqProto::OnCheckPassword(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) case 330: case 440: - ConnectionFailed(LOGINERR_WRONGPASSWORD); + ConnectionFailed(LOGINERR_WRONGPASSWORD, root.error()); return; default: - ConnectionFailed(LOGINERR_WRONGPROTOCOL); + ConnectionFailed(LOGINERR_WRONGPROTOCOL, root.error()); return; } @@ -596,11 +619,11 @@ void CIcqProto::OnStartSession(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) delSetting(DB_KEY_SESSIONKEY); CheckPassword(); } - else ConnectionFailed(LOGINERR_WRONGPASSWORD); + else ConnectionFailed(LOGINERR_WRONGPASSWORD, root.error()); return; default: - ConnectionFailed(LOGINERR_WRONGPROTOCOL); + ConnectionFailed(LOGINERR_WRONGPROTOCOL, root.error()); return; } diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index a0c05d46c5..d0c78a1a45 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -102,4 +102,4 @@ int StatusFromString(const CMStringW&); char* time2text(time_t time); extern HWND g_hwndHeartbeat; -extern bool g_bMessageState; +extern bool g_bPopupService, g_bMessageState; |