diff options
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/res/facebook.rc | 10 | ||||
-rw-r--r-- | protocols/FacebookRM/src/constants.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/db.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 13 | ||||
-rw-r--r-- | protocols/FacebookRM/src/resource.h | 1 |
6 files changed, 17 insertions, 11 deletions
diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index 6223e64449..f4f03f28ef 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -127,10 +127,11 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN
GROUPBOX "Event notifications",IDC_STATIC,6,7,292,106
CONTROL "Notifications",IDC_NOTIFICATIONS_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,23,272,8
- CONTROL "News feeds",IDC_FEEDS_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,43,272,8
- RTEXT "News Feed types to notify:",IDC_STATIC,16,59,121,8
- COMBOBOX IDC_FEED_TYPE,151,57,137,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Other events",IDC_OTHER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,75,272,8
+ CONTROL "News feeds",IDC_FEEDS_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,39,272,8
+ RTEXT "News feed types to notify:",IDC_STATIC,26,51,117,8
+ COMBOBOX IDC_FEED_TYPE,150,49,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Don't show advertising posts",IDC_FILTER_ADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,67,138,8
+ CONTROL "Other events",IDC_OTHER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,79,272,8
CONTROL "Client notifications",IDC_CLIENT_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,272,8
PUSHBUTTON "Preview",IDC_PREVIEW,117,137,68,14
CONTROL "Use balloon notifications in system tray instead of popups",IDC_SYSTRAY_NOTIFY,
@@ -217,6 +218,7 @@ BEGIN LEFTMARGIN, 6
RIGHTMARGIN, 298
VERTGUIDE, 16
+ VERTGUIDE, 150
VERTGUIDE, 288
TOPMARGIN, 7
BOTTOMMARGIN, 158
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h index bfa54d2ec7..29fa13751e 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -75,6 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DEFAULT_LOAD_PAGES 0
#define DEFAULT_KEEP_UNREAD 0
#define DEFAULT_INBOX_ONLY 0
+#define DEFAULT_FILTER_ADS 0
#define DEFAULT_EVENT_NOTIFICATIONS_ENABLE 1
#define DEFAULT_EVENT_FEEDS_ENABLE 1
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index 536462d9e7..be6f42c41e 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -54,6 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define FACEBOOK_KEY_LOAD_PAGES "LoadPages"
#define FACEBOOK_KEY_KEEP_UNREAD "KeepUnread" // (byte) 1 = don't mark messages as read on server (works globally or per contact)
#define FACEBOOK_KEY_INBOX_ONLY "InboxOnly"
+#define FACEBOOK_KEY_FILTER_ADS "FilterAds"
#define FACEBOOK_KEY_POLL_RATE "PollRate" // [HIDDEN]
#define FACEBOOK_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 76b7f1a100..d9ed46a869 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -535,6 +535,7 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa LoadDBCheckState(proto, hwnd, IDC_FEEDS_ENABLE, FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_CLIENT_ENABLE, FACEBOOK_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_OTHER_ENABLE, FACEBOOK_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE);
+ LoadDBCheckState(proto, hwnd, IDC_FILTER_ADS, FACEBOOK_KEY_FILTER_ADS, DEFAULT_FILTER_ADS);
} return TRUE;
@@ -569,6 +570,7 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa StoreDBCheckState(proto, hwnd, IDC_FEEDS_ENABLE, FACEBOOK_KEY_EVENT_FEEDS_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_OTHER_ENABLE, FACEBOOK_KEY_EVENT_OTHER_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_CLIENT_ENABLE, FACEBOOK_KEY_EVENT_CLIENT_ENABLE);
+ StoreDBCheckState(proto, hwnd, IDC_FILTER_ADS, FACEBOOK_KEY_FILTER_ADS);
}
} return TRUE;
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; } diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index 4c706e58e5..19958fceb4 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -36,6 +36,7 @@ #define IDC_FEEDS_ENABLE 1042
#define IDC_OTHER_ENABLE 1043
#define IDC_CLIENT_ENABLE 1044
+#define IDC_FILTER_ADS 1045
#define IDC_SYSTRAY_NOTIFY 1098
#define IDC_PREVIEW 1099
#define IDC_SET_STATUS 1126
|