From a21c1d4a3f987b174a0178bca1430398852916f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 29 Mar 2014 10:26:33 +0000 Subject: Facebook: Add hidden setting for "Naseem's spam mode", where we ignore outgoing messages sent from other instances To enable it, add byte key "NaseemsSpamMode" with value 1 git-svn-id: http://svn.miranda-ng.org/main/trunk@8782 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/db.h | 1 + protocols/FacebookRM/src/process.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'protocols/FacebookRM/src') diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index 02947cd314..e7f659b7b1 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -60,6 +60,7 @@ along with this program. If not, see . #define FACEBOOK_KEY_DISABLE_LOGOUT "DisableLogout" // [HIDDEN] #define FACEBOOK_KEY_LOCALE "Locale" // [HIDDEN] - en_US, cs_CZ, etc. #define FACEBOOK_KEY_LOCAL_TIMESTAMP_UNREAD "UseLocalTimestampUnread" // [HIDDEN] - 1 = use local timestamp for offline messages +#define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode" #define FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE "EventNotificationsEnable" #define FACEBOOK_KEY_EVENT_FEEDS_ENABLE "EventFeedsEnable" diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 831b4873f5..32ae2eb73d 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -409,6 +409,8 @@ void FacebookProto::ProcessUnreadMessage(void *p) void FacebookProto::ReceiveMessages(std::vector messages, bool local_timestamp) { + bool naseemsSpamMode = getBool(FACEBOOK_KEY_NASEEMS_SPAM_MODE, false); + for(std::vector::size_type i = 0; i < messages.size(); i++) { if (messages[i]->isChat) { debugLogA(" Got chat message: %s", messages[i]->message_text.c_str()); @@ -425,6 +427,10 @@ void FacebookProto::ReceiveMessages(std::vector messages, boo // RM TODO: better use check if chatroom exists/is in db/is online... no? /// e.g. HANDLE hChatContact = proto->ChatIDToHContact(thread_id); ? if (GetChatUsers(tthread_id.c_str()) == NULL) { + // In Naseem's spam mode we ignore outgoing messages sent from other instances + if (naseemsSpamMode && !messages[i]->isIncoming) + continue; + AddChat(tthread_id.c_str(), tthread_id.c_str()); // TODO: use correct name for chat, not thread_id hChatContact = ChatIDToHContact(tthread_id); // Set thread id (TID) for later @@ -445,6 +451,10 @@ void FacebookProto::ReceiveMessages(std::vector messages, boo MCONTACT hContact = ContactIDToHContact(fbu.user_id); if (hContact == NULL) { + // In Naseem's spam mode we ignore outgoing messages sent from other instances + if (naseemsSpamMode && !messages[i]->isIncoming) + continue; + // We don't have this contact, lets load info about him LoadContactInfo(&fbu); -- cgit v1.2.3