diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-04-04 20:10:50 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-04-04 20:10:50 +0000 |
commit | c89e8a054ac888b27065916ffde96af73404228c (patch) | |
tree | 5538dfdd531108fb653e107bc6ff54d1aea5a96d /protocols/SkypeWeb/src/skype_request.cpp | |
parent | 817c5f883a658c4abca078df852ad81f6ec7f861 (diff) |
SkypeWeb:
- history sync (patch from MikalaiR)
- refactored message sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@12599 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_request.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_request.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/protocols/SkypeWeb/src/skype_request.cpp b/protocols/SkypeWeb/src/skype_request.cpp index 61d9754ec0..b0026de980 100644 --- a/protocols/SkypeWeb/src/skype_request.cpp +++ b/protocols/SkypeWeb/src/skype_request.cpp @@ -5,14 +5,24 @@ class SkypeResponseDelegate private:
CSkypeProto *proto;
SkypeResponseCallback responseCallback;
+ SkypeResponseWithArgCallback responseWithArgCallback;
+
+ void *arg;
+ bool hasArg;
public:
SkypeResponseDelegate(CSkypeProto *proto, SkypeResponseCallback responseCallback)
- : proto(proto), responseCallback(responseCallback) { }
+ : proto(proto), responseCallback(responseCallback), arg(NULL), hasArg(false) {}
+
+ SkypeResponseDelegate(CSkypeProto *proto, SkypeResponseWithArgCallback responseCallback, void *arg)
+ : proto(proto), responseWithArgCallback(responseCallback), arg(arg), hasArg(true) { }
void Invoke(const NETLIBHTTPREQUEST *response)
{
- (proto->*(responseCallback))(response);
+ if (hasArg)
+ (proto->*(responseWithArgCallback))(response, arg);
+ else
+ (proto->*(responseCallback))(response);
}
};
@@ -21,22 +31,20 @@ static void SkypeHttpResponse(const NETLIBHTTPREQUEST *response, void *arg) ((SkypeResponseDelegate*)arg)->Invoke(response);
}
-void CSkypeProto::PushRequest(HttpRequest *request, SkypeResponseCallback response)
+void CSkypeProto::PushRequest(HttpRequest *request)
{
- if (!cookies.empty())
- {
- CMStringA allCookies;
- for (std::map<std::string, std::string>::iterator cookie = cookies.begin(); cookie != cookies.end(); ++cookie)
- allCookies.AppendFormat("%s=%s; ", cookie->first.c_str(), cookie->second.c_str());
- request->Headers << CHAR_VALUE("Set-Cookie", allCookies);
- }
-
- if (response == NULL)
- {
- requestQueue->Push(request);
- return;
- }
+ requestQueue->Push(request);
+ return;
+}
+void CSkypeProto::PushRequest(HttpRequest *request, SkypeResponseCallback response)
+{
SkypeResponseDelegate *delegate = new SkypeResponseDelegate(this, response);
requestQueue->Push(request, SkypeHttpResponse, delegate);
+}
+
+void CSkypeProto::PushRequest(HttpRequest *request, SkypeResponseWithArgCallback response, void *arg)
+{
+ SkypeResponseDelegate *delegate = new SkypeResponseDelegate(this, response, arg);
+ requestQueue->Push(request, SkypeHttpResponse, delegate);
}
\ No newline at end of file |