summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/communication.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2012-10-16 12:26:39 +0000
committerRobert Pösel <robyer@seznam.cz>2012-10-16 12:26:39 +0000
commit51c5b6906f9571f17a9905d7f1111baa1f2dc126 (patch)
tree2fd4e7f98b18aa296330ea819a7c195af4a24740 /protocols/FacebookRM/src/communication.cpp
parent5edc875e696a39cdf62d873a664d8a6cb2d26ad9 (diff)
Fixed Facebook channel change.
git-svn-id: http://svn.miranda-ng.org/main/trunk@1955 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r--protocols/FacebookRM/src/communication.cpp34
1 files changed, 6 insertions, 28 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 7aa116d653..19478d165a 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -303,9 +303,6 @@ std::string facebook_client::choose_server( int request_type, std::string* data,
case FACEBOOK_REQUEST_MESSAGES_RECEIVE:
{
std::string server = FACEBOOK_SERVER_CHAT;
- if (!this->chat_channel_jslogger_.empty())
- server = FACEBOOK_SERVER_CHAT2;
-
utils::text::replace_first( &server, "%s", "0" );
utils::text::replace_first( &server, "%s", this->chat_channel_host_ );
return server;
@@ -446,16 +443,10 @@ std::string facebook_client::choose_action( int request_type, std::string* data,
case FACEBOOK_REQUEST_MESSAGES_RECEIVE:
{
- std::string action = "/x/%s/0/true/p_%s=%s";
- if (!this->chat_channel_jslogger_.empty()) {
- action = "/pull?clientid=&channel=p_%s&seq=%s&cb=&state=active";
- //utils::text::replace_first( &action, "%s", dtsg_ );
- } else {
- utils::text::replace_first( &action, "%s", utils::time::unix_timestamp());
- }
-
- utils::text::replace_first( &action, "%s", self_.user_id );
- utils::text::replace_first( &action, "%s", chat_sequence_num_.empty() ? "0" : chat_sequence_num_ );
+ std::string action = "/pull?channel=" + (this->chat_channel_.empty() ? "p_" + self_.user_id : this->chat_channel_);
+ action += "&seq=" + (this->chat_sequence_num_.empty() ? "0" : this->chat_sequence_num_);
+ action += "&partition=" + (this->chat_channel_partition_.empty() ? "0" : this->chat_channel_partition_);
+ action += "&clientid=&cb=&idle=0&state=active";
return action;
}
@@ -888,8 +879,8 @@ bool facebook_client::reconnect( )
{
case HTTP_CODE_OK:
{
- this->chat_channel_jslogger_ = utils::text::source_get_value( &resp.data, 2, "\"jslogger_suffix\":\"", "\"" );
- parent->Log(" Got self channel jslogger: %s", this->chat_channel_jslogger_.c_str());
+ this->chat_channel_ = utils::text::source_get_value( &resp.data, 2, "\"user_channel\":\"", "\"" );
+ parent->Log(" Got self channel: %s", this->chat_channel_.c_str());
this->chat_channel_partition_ = utils::text::source_get_value2( &resp.data, "\"partition\":", ",}" );
parent->Log(" Got self channel partition: %s", this->chat_channel_partition_.c_str());
@@ -900,13 +891,6 @@ bool facebook_client::reconnect( )
this->chat_sequence_num_ = utils::text::source_get_value2( &resp.data, "\"seq\":", ",}" );
parent->Log(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
- if (this->chat_channel_jslogger_.empty()) {
- if (!atoi(this->chat_channel_host_.substr(0, this->chat_channel_host_.find(".")).c_str())) {
- this->chat_channel_jslogger_ = "SOMETHING";
- parent->Log(" Got no jslogger, changed.");
- }
- }
-
return handle_success( "reconnect" );
}
@@ -1069,12 +1053,6 @@ bool facebook_client::channel( )
case HTTP_CODE_FAKE_DISCONNECTED:
case HTTP_CODE_FAKE_ERROR:
default:
- // Testing workaround for channel change
- if (!this->chat_channel_jslogger_.empty())
- this->chat_channel_jslogger_ = "_";
- else
- this->chat_channel_jslogger_.clear();
-
return handle_error( "channel" );
}
}