summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-12 19:44:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-12 19:44:03 +0300
commit3b55ee911e8e2186c2d72e03874307d3aec91b8c (patch)
treee315381ed43ecd0af9771852e31d45e92dfadd49
parentc74c7fe3605d7426afb6b6436d4ebaa978f34c2f (diff)
- stronger types, part II;
- don't call hNetlibUser hConnection
-rw-r--r--protocols/FacebookRM/src/client.h15
-rw-r--r--protocols/FacebookRM/src/http_request.h6
-rw-r--r--protocols/SkypeWeb/src/http_request.h6
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp6
-rw-r--r--protocols/SkypeWeb/src/request_queue.h5
-rw-r--r--protocols/Steam/src/http_request.h6
6 files changed, 20 insertions, 24 deletions
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index 6625c6919b..f36635c979 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -32,7 +32,6 @@ class facebook_client
public:
////////////////////////////////////////////////////////////
-
// Client definition
facebook_client()
@@ -198,11 +197,11 @@ public:
std::map<int, time_t> messages_timestamp;
bool loading_history;
- HANDLE loading_history_lock_;
+ HANDLE loading_history_lock_;
- bool channel();
- bool activity_ping();
- int send_message(int seqid, MCONTACT, const std::string &message_text, std::string *error_text, const std::string &captchaPersistData = "", const std::string &captcha = "");
+ bool channel();
+ bool activity_ping();
+ int send_message(int seqid, MCONTACT, const std::string &message_text, std::string *error_text, const std::string &captchaPersistData = "", const std::string &captcha = "");
////////////////////////////////////////////////////////////
@@ -218,12 +217,10 @@ public:
bool save_url(const std::string &url,const std::wstring &filename, HANDLE &nlc);
////////////////////////////////////////////////////////////
-
// Netlib handle
- HANDLE handle_;
-
- void set_handle(HANDLE h)
+ HNETLIBUSER handle_;
+ void set_handle(HNETLIBUSER h)
{
handle_ = h;
}
diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h
index 53423cb58c..64750eef39 100644
--- a/protocols/FacebookRM/src/http_request.h
+++ b/protocols/FacebookRM/src/http_request.h
@@ -276,7 +276,7 @@ public:
mir_free(headers);
}
- virtual NETLIBHTTPREQUEST* Send(HANDLE hConnection)
+ virtual NETLIBHTTPREQUEST* Send(HNETLIBUSER nlu)
{
if (url.Find("://") == -1)
url.Insert(0, ((flags & NLHRF_SSL) ? "https://" : "http://"));
@@ -287,9 +287,9 @@ public:
dataLength = (int)mir_strlen(pData);
}
- Netlib_Logf(Netlib_GetConnNlu(hConnection), "Send request to %s", szUrl);
+ Netlib_Logf(nlu, "Send request to %s", szUrl);
- return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)(NETLIBHTTPREQUEST*)this);
+ return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)nlu, (LPARAM)(NETLIBHTTPREQUEST*)this);
}
};
diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h
index a696a2f9c6..b7c8ef73be 100644
--- a/protocols/SkypeWeb/src/http_request.h
+++ b/protocols/SkypeWeb/src/http_request.h
@@ -263,7 +263,7 @@ public:
mir_free(headers);
}
- virtual NETLIBHTTPREQUEST* Send(HANDLE hConnection)
+ virtual NETLIBHTTPREQUEST* Send(HNETLIBUSER nlu)
{
if (url.Find("://") == -1)
url.Insert(0, ((flags & NLHRF_SSL) ? "https://" : "http://"));
@@ -274,9 +274,9 @@ public:
dataLength = (int)mir_strlen(pData);
}
- Netlib_Logf(Netlib_GetConnNlu(hConnection), "Send request to %s", szUrl);
+ Netlib_Logf(nlu, "Send request to %s", szUrl);
- return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)(NETLIBHTTPREQUEST*)this);
+ return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)nlu, (LPARAM)(NETLIBHTTPREQUEST*)this);
}
};
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
index fecc5f0adf..57c7cf40a4 100644
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ b/protocols/SkypeWeb/src/request_queue.cpp
@@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-RequestQueue::RequestQueue(HANDLE hConnection) :
-hConnection(hConnection), requests(1)
+RequestQueue::RequestQueue(HNETLIBUSER _nlu) :
+ nlu(_nlu), requests(1)
{
isTerminated = true;
hRequestQueueThread = NULL;
@@ -70,7 +70,7 @@ void RequestQueue::Send(HttpRequest *request, HttpResponseCallback response, voi
void RequestQueue::Execute(RequestQueueItem *item)
{
- NETLIBHTTPREQUEST *response = item->request->Send(hConnection);
+ NETLIBHTTPREQUEST *response = item->request->Send(nlu);
if (item->responseCallback != NULL)
item->responseCallback(response, item->arg);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
diff --git a/protocols/SkypeWeb/src/request_queue.h b/protocols/SkypeWeb/src/request_queue.h
index 5ea8e7d1e8..90ebb0cfa6 100644
--- a/protocols/SkypeWeb/src/request_queue.h
+++ b/protocols/SkypeWeb/src/request_queue.h
@@ -42,9 +42,8 @@ struct RequestQueueItem
class RequestQueue
{
-private:
bool isTerminated;
- HANDLE hConnection;
+ HNETLIBUSER nlu;
mir_cs requestQueueLock;
LIST<RequestQueueItem> requests;
EventHandle hRequestQueueEvent;
@@ -56,7 +55,7 @@ private:
static unsigned int __cdecl WorkerThread(void*);
public:
- RequestQueue(HANDLE hConnection);
+ RequestQueue(HNETLIBUSER nlu);
~RequestQueue();
void Start();
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h
index fbbd7d3e84..60d3c1b403 100644
--- a/protocols/Steam/src/http_request.h
+++ b/protocols/Steam/src/http_request.h
@@ -140,13 +140,13 @@ public:
mir_free(pData);
}
- HttpResponse* Send(HANDLE hConnection)
+ HttpResponse* Send(HNETLIBUSER nlu)
{
szUrl = m_url.GetBuffer();
- Netlib_Logf(Netlib_GetConnNlu(hConnection), "Send request to %s", szUrl);
+ Netlib_Logf(nlu, "Send request to %s", szUrl);
- NETLIBHTTPREQUEST* response = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)this);
+ NETLIBHTTPREQUEST* response = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)nlu, (LPARAM)this);
HttpResponse* result = new HttpResponse(response, this);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);