diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-04-03 06:14:34 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-04-03 06:14:34 +0000 |
commit | 45cf5a88078cd23be4a4e0ccc569763dab4220b0 (patch) | |
tree | de0db275d63ea71d8d14698ea6d0332a466db35e /protocols/SkypeWeb/src | |
parent | 201ced87c58de8ee50cb15562506d700f51d09a1 (diff) |
incoming messages now work
git-svn-id: http://svn.miranda-ng.org/main/trunk@12583 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_poll_processing.cpp | 20 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_polling.cpp | 104 |
3 files changed, 64 insertions, 62 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 1fee5e1fa9..c4f9498885 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -14,7 +14,7 @@ int CSkypeProto::OnReceiveMessage(MCONTACT hContact, PROTORECVEVENT *pre) dbei.timestamp = pre->timestamp;
dbei.flags = DBEF_UTF;
dbei.eventType = pre->lParam;
- dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
+ dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
dbei.pBlob = (PBYTE)pre->szMessage;
return (INT_PTR)db_event_add(hContact, &dbei);
diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp index 23008451b7..5597257188 100644 --- a/protocols/SkypeWeb/src/skype_poll_processing.cpp +++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp @@ -80,13 +80,15 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node) ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(node, "conversationLink")))));
time_t timeStamp = IsoToUnixTime(composeTime);//time(NULL); // it should be rewritten
- PROTORECVEVENT recv = { 0 };
- recv.flags = PREF_UTF;
- recv.timestamp = timeStamp;
- recv.szMessage = content;
- debugLogA("Incoming message from %s", ContactUrlToName(from));
- if(IsMe(ContactUrlToName(from)))
- return; //it should be rewritten
- MCONTACT hContact = GetContact(ContactUrlToName(from));
- OnReceiveMessage(hContact, &recv);
+ if (!mir_strcmpi(messagetype, "Text")) {
+ PROTORECVEVENT recv = { 0 };
+ recv.flags = PREF_UTF;
+ recv.timestamp = timeStamp;
+ recv.szMessage = content;
+ debugLogA("Incoming message from %s", ContactUrlToName(from));
+ if (IsMe(ContactUrlToName(from)))
+ return; //it should be rewritten
+ MCONTACT hContact = GetContact(ContactUrlToName(from));
+ OnReceiveMessage(hContact, &recv);
+ }
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index aed47be086..c9dda8f31a 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -1,11 +1,11 @@ -#include "common.h" - -#define POLLING_ERRORS_LIMIT 3 - -void CSkypeProto::ParsePollData(JSONNODE *data) -{ - debugLogA("CSkypeProto::ParsePollData"); - JSONNODE *node, *item = NULL; +#include "common.h"
+
+#define POLLING_ERRORS_LIMIT 3
+
+void CSkypeProto::ParsePollData(JSONNODE *data)
+{
+ debugLogA("CSkypeProto::ParsePollData");
+ JSONNODE *node, *item = NULL;
node = json_get(data, "eventMessages");
if (node != NULL)
{
@@ -40,54 +40,54 @@ void CSkypeProto::ParsePollData(JSONNODE *data) }
}
- } -} - -void CSkypeProto::PollingThread(void*) -{ - debugLog(_T("CSkypeProto::PollingThread: entering")); - - ptrA regToken(getStringA("registrationToken")); - const char *server = getStringA("Server"); - + }
+}
+
+void CSkypeProto::PollingThread(void*)
+{
+ debugLog(_T("CSkypeProto::PollingThread: entering"));
+
+ ptrA regToken(getStringA("registrationToken"));
+ const char *server = getStringA("Server");
+
SubscriptionsRequest *request = new SubscriptionsRequest(regToken, server);
request->Send(m_hNetlibUser);
- delete request; - - int errors = 0; - bool breaked = false; - while (!isTerminated && !breaked && errors < POLLING_ERRORS_LIMIT) - { - PollRequest *request = new PollRequest(regToken, server); - NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); - delete request; - - if (response != NULL) - { - m_pollingConnection = response->nlc; - JSONROOT root(response->pData); + delete request;
+
+ int errors = 0;
+ bool breaked = false;
+ while (!isTerminated && !breaked && errors < POLLING_ERRORS_LIMIT)
+ {
+ PollRequest *request = new PollRequest(regToken, server);
+ NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser);
+ delete request;
+
+ if (response != NULL)
+ {
+ m_pollingConnection = response->nlc;
+ JSONROOT root(response->pData);
if (json_get(root, "errorCode") != NULL)
{
errors++;
continue;
- } - ParsePollData (root); - } - /*if (response->resultCode != 200) - { - errors++; - continue; - } - else - errors = 0;*/ - } - m_hPollingThread = NULL; - m_pollingConnection = NULL; - debugLog(_T("CSkypeProto::PollingThread: leaving")); - - if (!isTerminated) - { - debugLog(_T("CSkypeProto::PollingThread: unexpected termination; switching protocol to offline")); - SetStatus(ID_STATUS_OFFLINE); - } + }
+ ParsePollData (root);
+ }
+ /*if (response->resultCode != 200)
+ {
+ errors++;
+ continue;
+ }
+ else
+ errors = 0;*/
+ }
+ m_hPollingThread = NULL;
+ m_pollingConnection = NULL;
+ debugLog(_T("CSkypeProto::PollingThread: leaving"));
+
+ if (!isTerminated)
+ {
+ debugLog(_T("CSkypeProto::PollingThread: unexpected termination; switching protocol to offline"));
+ SetStatus(ID_STATUS_OFFLINE);
+ }
}
\ No newline at end of file |