summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/communication.cpp29
-rw-r--r--protocols/FacebookRM/src/http_request.h5
-rw-r--r--protocols/FacebookRM/src/requests/channel.h1
-rw-r--r--protocols/FacebookRM/src/requests/login.h2
4 files changed, 18 insertions, 19 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 452a6fe24a..1ef867d44f 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -59,49 +59,40 @@ http::response facebook_client::sendRequest(HttpRequest *request)
request->flags |= NLHRF_NODUMP;
#endif
- // FIXME: Support persistent connection for various requests
- /*
// Set persistent connection (or not)
- switch (request_type) {
- case REQUEST_LOGIN:
+ switch (request->Persistent) {
+ case ChannelRequest::NONE:
request->nlc = NULL;
+ request->flags &= ~NLHRF_PERSISTENT;
break;
-
- case REQUEST_MESSAGES_RECEIVE:
+ case ChannelRequest::CHANNEL:
request->nlc = hMsgCon;
request->flags |= NLHRF_PERSISTENT;
break;
-
- default:
+ case ChannelRequest::DEFAULT:
WaitForSingleObject(fcb_conn_lock_, INFINITE);
request->nlc = hFcbCon;
request->flags |= NLHRF_PERSISTENT;
break;
}
- */
+
parent->debugLogA("@@@ Sending request to '%s'", request->szUrl);
// Send the request
NETLIBHTTPREQUEST *pnlhr = request->Send(handle_);
- // FIXME: Support persistent connection for various requests
- /*
// Remember the persistent connection handle (or not)
- switch (request_type) {
- case REQUEST_LOGIN:
- case REQUEST_SETUP_MACHINE:
+ switch (request->Persistent) {
+ case ChannelRequest::NONE:
break;
-
- case REQUEST_MESSAGES_RECEIVE:
+ case ChannelRequest::CHANNEL:
hMsgCon = pnlhr ? pnlhr->nlc : NULL;
break;
-
- default:
+ case ChannelRequest::DEFAULT:
ReleaseMutex(fcb_conn_lock_);
hFcbCon = pnlhr ? pnlhr->nlc : NULL;
break;
}
- */
// Check and copy response data
if (pnlhr != NULL) {
diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h
index 86a23cb5c8..87423387fe 100644
--- a/protocols/FacebookRM/src/http_request.h
+++ b/protocols/FacebookRM/src/http_request.h
@@ -234,7 +234,10 @@ public:
HttpRequestHeaders Headers;
HttpRequestBody Body;
+ enum PersistentType { NONE, DEFAULT, CHANNEL };
+
bool NotifyErrors;
+ PersistentType Persistent;
HttpRequest(int type, LPCSTR url)
: Url(*this, url), Headers(*this)
@@ -246,6 +249,7 @@ public:
timeout = 20 * 1000;
NotifyErrors = true;
+ Persistent = DEFAULT;
}
HttpRequest(int type, HttpRequestUrlFormat, LPCSTR urlFormat, ...)
@@ -259,6 +263,7 @@ public:
timeout = 20 * 1000;
NotifyErrors = true;
+ Persistent = DEFAULT;
}
virtual ~HttpRequest()
diff --git a/protocols/FacebookRM/src/requests/channel.h b/protocols/FacebookRM/src/requests/channel.h
index 03f36241df..3e05e2c747 100644
--- a/protocols/FacebookRM/src/requests/channel.h
+++ b/protocols/FacebookRM/src/requests/channel.h
@@ -37,6 +37,7 @@ public:
{
if (type == PULL) {
timeout = 65 * 1000;
+ Persistent = CHANNEL;
}
bool isPing = (type == PING);
diff --git a/protocols/FacebookRM/src/requests/login.h b/protocols/FacebookRM/src/requests/login.h
index 85a2da36c6..e067374d2b 100644
--- a/protocols/FacebookRM/src/requests/login.h
+++ b/protocols/FacebookRM/src/requests/login.h
@@ -37,6 +37,8 @@ public:
LoginRequest(const char *username, const char *password, const char *urlData, const char *bodyData) :
HttpRequest(REQUEST_POST, FACEBOOK_SERVER_LOGIN "/login.php")
{
+ Persistent = NONE;
+
Url
<< "login_attempt=1"
<< urlData; // additional data parsed from form