diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-08 22:10:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-08 22:10:14 +0000 |
commit | bb952e431866d131bae95c08e579ec8a00f00343 (patch) | |
tree | 60881668cf328b50906346c5f66ce47da2d9ad88 /protocols/FacebookRM/src/communication.cpp | |
parent | c181af64bab27eb50e684c64c0a3caa49f8bbe39 (diff) |
core protocol helpers for creating protocol evengs, services & threads
git-svn-id: http://svn.miranda-ng.org/main/trunk@5286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 619f082a45..2a79fa8e87 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -950,14 +950,10 @@ bool facebook_client::buddy_list() // Process result data
validate_response(&resp);
- switch (resp.code)
- {
+ switch (resp.code) {
case HTTP_CODE_OK:
- {
- std::string* response_data = new std::string(resp.data);
- ForkThread(&FacebookProto::ProcessBuddyList, this->parent, (void*)response_data);
+ parent->ForkThread(&FacebookProto::ProcessBuddyList, new std::string(resp.data));
return handle_success("buddy_list");
- }
case HTTP_CODE_FAKE_ERROR:
case HTTP_CODE_FAKE_DISCONNECTED:
@@ -976,14 +972,11 @@ bool facebook_client::load_friends() // Process result data
validate_response(&resp);
- switch (resp.code)
- {
+ switch (resp.code) {
case HTTP_CODE_OK:
- {
- std::string* response_data = new std::string(resp.data);
- ForkThread(&FacebookProto::ProcessFriendList, this->parent, (void*)response_data);
+ parent->ForkThread(&FacebookProto::ProcessFriendList, new std::string(resp.data));
return handle_success("load_friends");
- }
+
case HTTP_CODE_FAKE_ERROR:
case HTTP_CODE_FAKE_DISCONNECTED:
default:
@@ -1001,13 +994,11 @@ bool facebook_client::feeds() // Process result data
validate_response(&resp);
- switch (resp.code)
- {
+ switch (resp.code) {
case HTTP_CODE_OK:
- if (resp.data.find("\"num_stories\":0") == std::string::npos) {
- std::string* response_data = new std::string(resp.data);
- ForkThread(&FacebookProto::ProcessFeeds, this->parent, (void*)response_data);
- }
+ if (resp.data.find("\"num_stories\":0") == std::string::npos)
+ parent->ForkThread(&FacebookProto::ProcessFeeds, new std::string(resp.data));
+
return handle_success("feeds");
case HTTP_CODE_FAKE_ERROR:
@@ -1062,7 +1053,7 @@ bool facebook_client::channel() } else {
// Something has been received, throw to new thread to process
std::string* response_data = new std::string(resp.data);
- ForkThread(&FacebookProto::ProcessMessages, this->parent, (void*)response_data);
+ parent->ForkThread(&FacebookProto::ProcessMessages, response_data);
// Increment sequence number
this->chat_sequence_num_ = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}");
|