summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/FacebookRM/src/client.h6
-rw-r--r--protocols/FacebookRM/src/communication.cpp15
-rw-r--r--protocols/FacebookRM/src/connection.cpp14
-rw-r--r--protocols/FacebookRM/src/http_request.h2
-rw-r--r--protocols/FacebookRM/src/requests/messages.h3
5 files changed, 29 insertions, 11 deletions
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index 14af119921..5b2c6da90f 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -40,7 +40,8 @@ public:
msgid_ = error_count_ = last_feeds_update_ = last_notification_time_ = random_ = chat_msgs_recv_ = chat_req_ = 0;
send_message_lock_ = notifications_lock_ = cookies_lock_ = NULL;
- hMsgCon = NULL;
+ hChannelCon = NULL;
+ hMessagesCon = NULL;
hFcbCon = NULL;
fcb_conn_lock_ = NULL;
handle_ = NULL;
@@ -49,7 +50,8 @@ public:
mbasicWorks = true;
}
- HANDLE hMsgCon;
+ HANDLE hChannelCon;
+ HANDLE hMessagesCon;
HANDLE hFcbCon;
HANDLE fcb_conn_lock_;
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 1ef867d44f..5ebc58549c 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -51,13 +51,13 @@ http::response facebook_client::sendRequest(HttpRequest *request)
}
// TODO: rather change http_request than doing this ifdef magic here?
-#ifdef _DEBUG
+/*#ifdef _DEBUG
request->flags &= ~NLHRF_NODUMP;
request->flags |= NLHRF_DUMPASTEXT;
#else
request->flags &= ~NLHRF_DUMPASTEXT;
request->flags |= NLHRF_NODUMP;
-#endif
+#endif*/
// Set persistent connection (or not)
switch (request->Persistent) {
@@ -66,7 +66,11 @@ http::response facebook_client::sendRequest(HttpRequest *request)
request->flags &= ~NLHRF_PERSISTENT;
break;
case ChannelRequest::CHANNEL:
- request->nlc = hMsgCon;
+ request->nlc = hChannelCon;
+ request->flags |= NLHRF_PERSISTENT;
+ break;
+ case ChannelRequest::MESSAGES:
+ request->nlc = hMessagesCon;
request->flags |= NLHRF_PERSISTENT;
break;
case ChannelRequest::DEFAULT:
@@ -86,7 +90,10 @@ http::response facebook_client::sendRequest(HttpRequest *request)
case ChannelRequest::NONE:
break;
case ChannelRequest::CHANNEL:
- hMsgCon = pnlhr ? pnlhr->nlc : NULL;
+ hChannelCon = pnlhr ? pnlhr->nlc : NULL;
+ break;
+ case ChannelRequest::MESSAGES:
+ hMessagesCon = pnlhr ? pnlhr->nlc : NULL;
break;
case ChannelRequest::DEFAULT:
ReleaseMutex(fcb_conn_lock_);
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 1a6c60ad50..3baeb2838e 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -37,10 +37,16 @@ void FacebookProto::ChangeStatus(void*)
SetEvent(update_loop_lock_);
// Shutdown and close channel handle
- Netlib_Shutdown(facy.hMsgCon);
- if (facy.hMsgCon)
- Netlib_CloseHandle(facy.hMsgCon);
- facy.hMsgCon = NULL;
+ Netlib_Shutdown(facy.hChannelCon);
+ if (facy.hChannelCon)
+ Netlib_CloseHandle(facy.hChannelCon);
+ facy.hChannelCon = NULL;
+
+ // Shutdown and close messages handle
+ Netlib_Shutdown(facy.hMessagesCon);
+ if (facy.hMessagesCon)
+ Netlib_CloseHandle(facy.hMessagesCon);
+ facy.hMessagesCon = NULL;
// Turn off chat on Facebook
if (getByte(FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT))
diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h
index 87423387fe..b0b689b051 100644
--- a/protocols/FacebookRM/src/http_request.h
+++ b/protocols/FacebookRM/src/http_request.h
@@ -234,7 +234,7 @@ public:
HttpRequestHeaders Headers;
HttpRequestBody Body;
- enum PersistentType { NONE, DEFAULT, CHANNEL };
+ enum PersistentType { NONE, DEFAULT, CHANNEL, MESSAGES };
bool NotifyErrors;
PersistentType Persistent;
diff --git a/protocols/FacebookRM/src/requests/messages.h b/protocols/FacebookRM/src/requests/messages.h
index a9427e401a..bc6c41784d 100644
--- a/protocols/FacebookRM/src/requests/messages.h
+++ b/protocols/FacebookRM/src/requests/messages.h
@@ -34,6 +34,9 @@ public:
// Don't notify errors for this request, because we're getting them inline in messaging window
NotifyErrors = false;
+ // Use own persistent connection for sending messages
+ Persistent = MESSAGES;
+
Url
<< "dpr=1";