summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/request_queue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src/request_queue.cpp')
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
index c3ae3fb798..aa5812aa0b 100644
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ b/protocols/SkypeWeb/src/request_queue.cpp
@@ -17,6 +17,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+AsyncHttpRequest::AsyncHttpRequest(int type, SkypeHost host, LPCSTR url, MTHttpRequestHandler pFunc) :
+ m_host(host)
+{
+ switch (host) {
+ case HOST_API: m_szUrl = "api.skype.com"; break;
+ case HOST_CONTACTS: m_szUrl = "contacts.skype.com"; break;
+ case HOST_GRAPH: m_szUrl = "skypegraph.skype.com"; break;
+ case HOST_LOGIN: m_szUrl = "login.skype.com"; break;
+ case HOST_DEFAULT:
+ m_szUrl.Format("%s/v1", g_plugin.szDefaultServer.c_str());
+ break;
+ }
+
+ AddHeader("User-Agent", NETLIB_USER_AGENT);
+
+ if (url)
+ m_szUrl.Append(url);
+ m_pFunc = pFunc;
+ flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT;
+ requestType = type;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CSkypeProto::StartQueue()
{
if (!m_isTerminated)
@@ -47,16 +71,11 @@ void CSkypeProto::PushRequest(AsyncHttpRequest *request)
m_hRequestQueueEvent.Set();
}
-void CSkypeProto::SendRequest(AsyncHttpRequest *request)
-{
- mir_forkthreadowner(&CSkypeProto::AsyncSendThread, this, request, nullptr);
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
NETLIBHTTPREQUEST* CSkypeProto::DoSend(AsyncHttpRequest *pReq)
{
- if (pReq->m_szUrl.Find("://") == -1)
+ if (pReq->m_host != HOST_OTHER)
pReq->m_szUrl.Insert(0, ((pReq->flags & NLHRF_SSL) ? "https://" : "http://"));
if (!pReq->m_szParam.IsEmpty()) {
@@ -122,15 +141,6 @@ void CSkypeProto::Execute(AsyncHttpRequest *item)
delete item;
}
-unsigned CSkypeProto::AsyncSendThread(void *owner, void *arg)
-{
- CSkypeProto *that = (CSkypeProto*)owner;
- AsyncHttpRequest *item = (AsyncHttpRequest*)arg;
-
- that->Execute(item);
- return 0;
-}
-
void CSkypeProto::WorkerThread(void*)
{
while (true) {