diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-05-28 14:27:38 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-05-28 14:27:38 +0000 |
commit | 4d556a607649ff90b846f0c6e1b033d365d3b744 (patch) | |
tree | b7d5510363e89d3a2f545907ff7580a9e68f96fc /protocols/FacebookRM/src/process.cpp | |
parent | 2bc466a8af4b4ed77f20cab4b61886124db259e5 (diff) |
Facebook: Added option to not show advertising posts from news feeds
git-svn-id: http://svn.miranda-ng.org/main/trunk@9335 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 03c99f246f..3fc432943e 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -744,14 +744,11 @@ void FacebookProto::ProcessFeeds(void* data) // Get feeds http::response resp = facy.flap(REQUEST_FEEDS); - if (resp.code != HTTP_CODE_OK) { + if (resp.code != HTTP_CODE_OK || resp.data.empty()) { facy.handle_error("feeds"); return; } - if (resp.data.empty() /*|| resp.data.find("\"num_stories\":0") != std::string::npos*/) - return; - CODE_BLOCK_TRY debugLogA("***** Starting processing feeds"); @@ -762,6 +759,7 @@ void FacebookProto::ProcessFeeds(void* data) UINT limit = 0; DWORD new_time = facy.last_feeds_update_; + bool filterAds = getBool(FACEBOOK_KEY_FILTER_ADS, DEFAULT_FILTER_ADS); while ((pos = resp.data.find("<div class=\"userContentWrapper", pos)) != std::string::npos && limit <= 25) { @@ -836,15 +834,16 @@ void FacebookProto::ProcessFeeds(void* data) nf->user_id = utils::text::source_get_value(&post_header, 2, "user.php?id=", "&"); nf->link = utils::text::special_expressions_decode(post_link); - //utils::text::source_get_value(&post_link, 2, "href=\\\"", "\\\">")); + + // Check if we don't want to show ads posts + bool filtered = filterAds && nf->link.find("/about/ads") != std::string::npos; nf->text = utils::text::trim( utils::text::special_expressions_decode( utils::text::remove_html( utils::text::edit_html(post_message)))); - if (!nf->title.length() || !nf->text.length()) - { + if (filtered || !nf->title.length() || !nf->text.length()) { delete nf; continue; } |