diff options
Diffstat (limited to 'protocols/SkypeWeb/src/skype_request.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_request.cpp | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/protocols/SkypeWeb/src/skype_request.cpp b/protocols/SkypeWeb/src/skype_request.cpp index 4ba0fbd43a..9322ef8451 100644 --- a/protocols/SkypeWeb/src/skype_request.cpp +++ b/protocols/SkypeWeb/src/skype_request.cpp @@ -17,35 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-class SkypeResponseDelegate
+void SkypeHttpResponse(const NETLIBHTTPREQUEST *response, void *arg)
{
-private:
- CSkypeProto *proto;
- SkypeResponseCallback responseCallback;
- SkypeResponseWithArgCallback responseWithArgCallback;
-
- void *arg;
- bool hasArg;
-
-public:
- SkypeResponseDelegate(CSkypeProto *proto, SkypeResponseCallback responseCallback)
- : proto(proto), responseCallback(responseCallback), responseWithArgCallback(NULL), arg(NULL), hasArg(false) {}
-
- SkypeResponseDelegate(CSkypeProto *proto, SkypeResponseWithArgCallback responseCallback, void *arg)
- : proto(proto), responseCallback(NULL), responseWithArgCallback(responseCallback), arg(arg), hasArg(true) { }
-
- void Invoke(const NETLIBHTTPREQUEST *response)
- {
- if (hasArg)
- (proto->*(responseWithArgCallback))(response, arg);
- else
- (proto->*(responseCallback))(response);
- }
-};
-
-static void SkypeHttpResponse(const NETLIBHTTPREQUEST *response, void *arg)
-{
- SkypeResponseDelegate *delegate = (SkypeResponseDelegate*)arg;
+ SkypeResponseDelegateBase *delegate = (SkypeResponseDelegateBase*)arg;
delegate->Invoke(response);
delete delegate;
}
@@ -57,13 +31,13 @@ void CSkypeProto::PushRequest(HttpRequest *request) void CSkypeProto::PushRequest(HttpRequest *request, SkypeResponseCallback response)
{
- SkypeResponseDelegate *delegate = new SkypeResponseDelegate(this, response);
+ SkypeResponseDelegateBase *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);
+ SkypeResponseDelegateBase *delegate = new SkypeResponseDelegateWithArg(this, response, arg);
requestQueue->Push(request, SkypeHttpResponse, delegate);
}
@@ -74,12 +48,12 @@ void CSkypeProto::SendRequest(HttpRequest *request) void CSkypeProto::SendRequest(HttpRequest *request, SkypeResponseCallback response)
{
- SkypeResponseDelegate *delegate = new SkypeResponseDelegate(this, response);
+ SkypeResponseDelegateBase *delegate = new SkypeResponseDelegate(this, response);
requestQueue->Send(request, SkypeHttpResponse, delegate);
}
void CSkypeProto::SendRequest(HttpRequest *request, SkypeResponseWithArgCallback response, void *arg)
{
- SkypeResponseDelegate *delegate = new SkypeResponseDelegate(this, response, arg);
+ SkypeResponseDelegateBase *delegate = new SkypeResponseDelegateWithArg(this, response, arg);
requestQueue->Send(request, SkypeHttpResponse, delegate);
}
\ No newline at end of file |