From 8b3de7af5b6799b1c8ca41fe4633617a70c0894f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 26 May 2015 08:33:42 +0000 Subject: Unify Netlib initialization error message in some protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@13841 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/proto.cpp | 7 +++++-- protocols/MinecraftDynmap/src/proto.cpp | 4 +++- protocols/Omegle/src/proto.cpp | 7 +++++-- protocols/Twitter/src/proto.cpp | 14 ++++++++++---- protocols/WhatsApp/src/proto.cpp | 7 +++++-- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 6cee2f91a0..188df14797 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -96,8 +96,11 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) : mir_sntprintf(descr, SIZEOF(descr), TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - if (m_hNetlibUser == NULL) - MessageBox(NULL, TranslateT("Unable to get Netlib connection for Facebook"), m_tszUserName, MB_OK); + if (m_hNetlibUser == NULL) { + TCHAR error[200]; + mir_sntprintf(error, SIZEOF(error), TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + MessageBox(NULL, error, _T("Miranda NG"), MB_OK | MB_ICONERROR); + } facy.set_handle(m_hNetlibUser); diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 7cfa8e533c..3375654557 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -49,7 +49,9 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const TCHAR* nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); if (m_hNetlibUser == NULL) { - MessageBox(NULL, TranslateT("Unable to get Netlib connection for Minecraft Dynmap"), m_tszUserName, MB_OK); + TCHAR error[200]; + mir_sntprintf(error, SIZEOF(error), TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + MessageBox(NULL, error, _T("Miranda NG"), MB_OK | MB_ICONERROR); } // Http connection handles diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index dd4b332c1a..fa5a0a7d04 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -50,8 +50,11 @@ OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) : mir_sntprintf(descr,SIZEOF(descr),TranslateT("%s server connection"),m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu); - if(m_hNetlibUser == NULL) - MessageBox(NULL,TranslateT("Unable to get Netlib connection for Omegle"),m_tszUserName,MB_OK); + if (m_hNetlibUser == NULL) { + TCHAR error[200]; + mir_sntprintf(error, SIZEOF(error), TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + MessageBox(NULL, error, _T("Miranda NG"), MB_OK | MB_ICONERROR); + } facy.set_handle(m_hNetlibUser); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 5ad228ab3e..b2992b22f4 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -324,8 +324,11 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) mir_sntprintf(descr, SIZEOF(descr), TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - if (m_hNetlibUser == 0) - MessageBox(0, TranslateT("Unable to get Netlib connection for Twitter"), TranslateT("Twitter"), 0); + if (m_hNetlibUser == NULL) { + TCHAR error[200]; + mir_sntprintf(error, SIZEOF(error), TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + MessageBox(NULL, error, _T("Miranda NG"), MB_OK | MB_ICONERROR); + } // Create avatar network connection (TODO: probably remove this) char module[512]; @@ -334,8 +337,11 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) mir_sntprintf(descr, SIZEOF(descr), TranslateT("%s avatar connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; hAvatarNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - if (hAvatarNetlib_ == 0) - MessageBox(0, TranslateT("Unable to get avatar Netlib connection for Twitter"), TranslateT("Twitter"), 0); + if (hAvatarNetlib_ == NULL) { + TCHAR error[200]; + mir_sntprintf(error, SIZEOF(error), TranslateT("Unable to initialize Netlib for %s."), TranslateT("Twitter (avatars)")); + MessageBox(NULL, error, _T("Miranda NG"), MB_OK | MB_ICONERROR); + } twit_.set_handle(this, m_hNetlibUser); diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index a26284fb0b..acf47543cd 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -41,8 +41,11 @@ WhatsAppProto::WhatsAppProto(const char* proto_name, const TCHAR* username) : nlu.szSettingsModule = m_szModuleName; nlu.ptszDescriptiveName = descr; m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - if (m_hNetlibUser == NULL) - MessageBox(NULL, TranslateT("Unable to get Netlib connection for WhatsApp"), m_tszUserName, MB_OK); + if (m_hNetlibUser == NULL) { + TCHAR error[200]; + mir_sntprintf(error, SIZEOF(error), TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); + MessageBox(NULL, error, _T("Miranda NG"), MB_OK | MB_ICONERROR); + } WASocketConnection::initNetwork(m_hNetlibUser); -- cgit v1.2.3