diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-05 12:51:06 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-05 12:51:06 +0000 |
commit | 81e0419a0c18dd5a07a68ecac2e1fc6058bcea00 (patch) | |
tree | 63fc70d03799b8b76e0efdd5ed682ebb8fc7650a /protocols/SkypeWeb/src/skype_trouter.cpp | |
parent | 49b0ad7d704b422b436c3752be331b73591f7a1e (diff) |
SkypeWeb: TRouter errors handling. Other fixes.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13440 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_trouter.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index cbf2526e22..a93188e2b3 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -19,15 +19,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response)
{
if (response == NULL || response->pData == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
return;
-
+ }
JSONROOT root(response->pData);
+ if (root == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
ptrA ccid(mir_t2a(ptrT(json_as_string(json_get(root, "ccid")))));
ptrA connId(mir_t2a(ptrT(json_as_string(json_get(root, "connId")))));
ptrA instance(mir_t2a(ptrT(json_as_string(json_get(root, "instance")))));
ptrA socketio(mir_t2a(ptrT(json_as_string(json_get(root, "socketio")))));
ptrA url(mir_t2a(ptrT(json_as_string(json_get(root, "url")))));
+
+ if (ccid == NULL || connId == NULL || instance == NULL || socketio == NULL || url == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
setString("Trouter_ccid", ccid);
setString("Trouter_connId", connId);
setString("Trouter_instance", instance);
@@ -40,13 +55,29 @@ void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response)
{
if (response == NULL || response->pData == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
return;
+ }
JSONROOT root(response->pData);
+ if (root == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
ptrA st(mir_t2a(ptrT(json_as_string(json_get(root, "st")))));
ptrA se(mir_t2a(ptrT(json_as_string(json_get(root, "se")))));
ptrA sig(mir_t2a(ptrT(json_as_string(json_get(root, "sig")))));
+
+ if (st == NULL || se == NULL || sig == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
+ return;
+ }
+
setString("Trouter_st", st);
setString("Trouter_se", se);
setString("Trouter_sig", sig);
@@ -66,8 +97,10 @@ void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response, void *p)
{
if (response == NULL || response->pData == NULL)
+ {
+ ShowNotification(_A2T(m_szModuleName), _T("Failed establish a TRouter connection."));
return;
-
+ }
bool isHealth = (bool)p;
CMStringA data(response->pData);
@@ -145,7 +178,6 @@ void CSkypeProto::TRouterThread(void*) debugLogA(__FUNCTION__": entering");
int errors = 0;
- isTerminated = false;
ptrA socketIo(getStringA("Trouter_socketio"));
ptrA connId(getStringA("Trouter_connId"));
|