summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-06-17 07:20:36 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-06-17 07:20:36 +0000
commit5cc00bfae505d55ad1a2e7a7c0aea17bc6e557dd (patch)
tree6a052c9a690be47c2af166df0656c5ea2b6feee3 /protocols/SkypeWeb
parent06b7222a8359baa84e2dc185f4397a2fbb40ff58 (diff)
SkypeWeb: More fixes. Version bump.
git-svn-id: http://svn.miranda-ng.org/main/trunk@14227 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h2
-rw-r--r--protocols/SkypeWeb/src/skype_trouter.cpp97
-rw-r--r--protocols/SkypeWeb/src/version.h2
5 files changed, 56 insertions, 53 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index eea09a0389..cdd86adf49 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -250,11 +250,11 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
for (int i = 0; i < xi.getChildCount(xml); i++)
{
int fileSize;
- HXML xmlNode = xi.getNthChild(xml, L"file", i);
+ HXML xmlNode = xi.getNthChild(xml, _T("file"), i);
if (xmlNode == NULL)
break;
- fileSize = atoi(_T2A(xi.getAttrValue(xmlNode, L"size")));
- ptrA fileName(mir_t2a(xi.getText(xmlNode)));
+ fileSize = atoi(_T2A(xi.getAttrValue(xmlNode, _T("size"))));
+ ptrA fileName(mir_utf8encodeT(xi.getText(xmlNode)));
if (fileName == NULL || fileSize == NULL)
continue;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index c965d90a0e..30febdd140 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -58,6 +58,8 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL)
//sounds
SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound"));
SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound"));
+
+ m_hTrouterEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
CSkypeProto::~CSkypeProto()
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 8c4ac80eac..db136cd963 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -109,7 +109,7 @@ private:
RequestQueue *requestQueue;
bool isTerminated;
std::map<std::string, std::string> cookies;
- HANDLE m_pollingConnection, m_hPollingThread, m_hTrouterThread, m_TrouterConnection, m_hCallHook;
+ HANDLE m_pollingConnection, m_hPollingThread, m_hTrouterThread, m_TrouterConnection, m_hTrouterEvent, m_hCallHook;
static std::map<std::tstring, std::tstring> languages;
static INT_PTR CALLBACK PasswordEditorProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp
index 72f1ded025..bc3003336b 100644
--- a/protocols/SkypeWeb/src/skype_trouter.cpp
+++ b/protocols/SkypeWeb/src/skype_trouter.cpp
@@ -107,6 +107,8 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response, void *p)
TRouter.sessId = szToken.GetString();
if (!m_hTrouterThread)
m_hTrouterThread = ForkThreadEx(&CSkypeProto::TRouterThread, 0, NULL);
+ else
+ SetEvent(m_hTrouterEvent);
if (!isHealth)
SendRequest(new RegisterTrouterRequest(m_szTokenSecret, TRouter.url.c_str(), TRouter.sessId.c_str()));
@@ -125,6 +127,53 @@ void CSkypeProto::OnHealth(const NETLIBHTTPREQUEST*)
&CSkypeProto::OnGetTrouter, (void *)1);
}
+void CSkypeProto::TRouterThread(void*)
+{
+ debugLogA(__FUNCTION__": entering");
+
+ int errors = 0;
+
+ while (!isTerminated && errors < POLLING_ERRORS_LIMIT)
+ {
+ TrouterPollRequest *request = new TrouterPollRequest(TRouter.socketIo, TRouter.connId, TRouter.st, TRouter.se, TRouter.sig, TRouter.instance, TRouter.ccid, TRouter.sessId);
+ request->nlc = m_TrouterConnection;
+ NLHR_PTR response(request->Send(m_hNetlibUser));
+
+ if (response == NULL)
+ {
+ errors++;
+ delete request;
+ continue;
+ }
+
+ if (response->resultCode == 200)
+ {
+ if (response->pData)
+ {
+ char *json = strstr(response->pData, "{");
+ if (json != NULL)
+ {
+ JSONNode root = JSONNode::parse(json);
+ std::string szBody = root["body"].as_string();
+ const JSONNode &headers = root["headers"];
+ const JSONNode body = JSONNode::parse(szBody.c_str());
+ OnTrouterEvent(body, headers);
+ }
+ }
+ }
+ else
+ {
+ SendRequest(new HealthTrouterRequest(TRouter.ccid.c_str()), &CSkypeProto::OnHealth);
+ WaitForSingleObject(m_hTrouterEvent, INFINITE);
+ }
+ m_TrouterConnection = response->nlc;
+ delete request;
+ }
+ m_hTrouterThread = NULL;
+ m_TrouterConnection = NULL;
+ debugLogA(__FUNCTION__": leaving");
+}
+
void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
{
//std::string displayname = body["displayName"].as_string();
@@ -172,54 +221,6 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
}
}
-void CSkypeProto::TRouterThread(void*)
-{
- debugLogA(__FUNCTION__": entering");
-
- int errors = 0;
-
- while (!isTerminated && errors < POLLING_ERRORS_LIMIT)
- {
- TrouterPollRequest *request = new TrouterPollRequest(TRouter.socketIo, TRouter.connId, TRouter.st, TRouter.se, TRouter.sig, TRouter.instance, TRouter.ccid, TRouter.sessId);
- request->nlc = m_TrouterConnection;
- NLHR_PTR response(request->Send(m_hNetlibUser));
-
- if (response == NULL)
- {
- errors++;
- delete request;
- continue;
- }
-
- if (response->resultCode == 200)
- {
- if (response->pData)
- {
- char *json = strstr(response->pData, "{");
- if (json != NULL)
- {
- JSONNode root = JSONNode::parse(json);
- std::string szBody = root["body"].as_string();
- const JSONNode &headers = root["headers"];
- const JSONNode body = JSONNode::parse(szBody.c_str());
- OnTrouterEvent(body, headers);
- }
- }
- }
- else
- {
- SendRequest(new HealthTrouterRequest(TRouter.ccid.c_str()), &CSkypeProto::OnHealth);
- delete request;
- break;
- }
- m_TrouterConnection = response->nlc;
- delete request;
- }
- m_hTrouterThread = NULL;
- m_TrouterConnection = NULL;
- debugLogA(__FUNCTION__": leaving");
-}
-
INT_PTR CSkypeProto::OnIncomingCallCLE(WPARAM, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT*)lParam;
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h
index e07f325cbf..1a0be10427 100644
--- a/protocols/SkypeWeb/src/version.h
+++ b/protocols/SkypeWeb/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 12
#define __RELEASE_NUM 1
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>