aboutsummaryrefslogtreecommitdiff
path: root/backends/networking
diff options
context:
space:
mode:
Diffstat (limited to 'backends/networking')
-rw-r--r--backends/networking/curl/curljsonrequest.cpp2
-rw-r--r--backends/networking/curl/request.h12
2 files changed, 12 insertions, 2 deletions
diff --git a/backends/networking/curl/curljsonrequest.cpp b/backends/networking/curl/curljsonrequest.cpp
index 59bc830692..929723c671 100644
--- a/backends/networking/curl/curljsonrequest.cpp
+++ b/backends/networking/curl/curljsonrequest.cpp
@@ -75,7 +75,7 @@ bool CurlJsonRequest::handle() {
if (_callback) {
char *contents = getPreparedContents();
Common::JSONValue *json = Common::JSON::parse(contents);
- _callback(json); //potential memory leak, free it in your callbacks!
+ _callback(this, json); //potential memory leak, free it in your callbacks!
}
return true;
}
diff --git a/backends/networking/curl/request.h b/backends/networking/curl/request.h
index 4f901f7c94..d405ec8551 100644
--- a/backends/networking/curl/request.h
+++ b/backends/networking/curl/request.h
@@ -27,7 +27,7 @@ namespace Networking {
class Request {
protected:
- typedef void(*Callback)(void *result);
+ typedef void(*Callback)(Request* request, void *result);
/**
* Callback, which should be called before Request returns true in handle().
@@ -36,6 +36,13 @@ protected:
Callback _callback;
+ /**
+ * Pointer, which could be set by Request creating code. It might be accessed
+ * from this Request when callback is called, for example.
+ */
+
+ void *_pointer;
+
public:
Request(Callback cb): _callback(cb) {};
virtual ~Request() {};
@@ -47,6 +54,9 @@ public:
*/
virtual bool handle() = 0;
+
+ void setPointer(void *ptr) { _pointer = ptr; }
+ void *pointer() const { return _pointer; }
};
} //end of namespace Cloud