summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/res/facebook.rc36
-rw-r--r--protocols/FacebookRM/src/constants.h1
-rw-r--r--protocols/FacebookRM/src/db.h1
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp20
-rw-r--r--protocols/FacebookRM/src/json.h6
-rw-r--r--protocols/FacebookRM/src/process.cpp30
-rw-r--r--protocols/FacebookRM/src/resource.h3
8 files changed, 31 insertions, 68 deletions
diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc
index 591aa48184..ded6c1f4d1 100644
--- a/protocols/FacebookRM/res/facebook.rc
+++ b/protocols/FacebookRM/res/facebook.rc
@@ -187,26 +187,24 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Messages",IDC_STATIC,7,7,294,57
- CONTROL "Receive messages from ""inbox"" folder only",IDC_INBOX_ONLY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,19,281,10
+ GROUPBOX "Messages",IDC_STATIC,7,7,294,43
CONTROL "Keep messages as unread on server (don't send ""seen"" info)",IDC_KEEP_UNREAD,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,33,281,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,19,281,10
CONTROL "Show stickers as custom smileys (EXPERIMENTAL)",IDC_CUSTOM_SMILEYS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,48,281,10
- GROUPBOX "Multi user chats",IDC_STATIC,7,70,294,43
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,281,10
+ GROUPBOX "Multi user chats",IDC_STATIC,7,56,294,43
CONTROL "Enable multi user chats support",IDC_ENABLE_CHATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,83,281,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,69,281,10
CONTROL "Do not open chat windows on creation",IDC_HIDE_CHATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,97,281,10
- GROUPBOX "History synchronization",IDC_STATIC,7,121,294,59
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,83,281,10
+ GROUPBOX "History synchronization",IDC_STATIC,7,107,294,59
CONTROL "Load last messages (24 hours old) on login (EXPERIMENTAL)",IDC_LOGIN_SYNC,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,135,281,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,121,281,10
CONTROL "Load last messages on opening message window (EXPERIMENTAL)",IDC_MESSAGES_ON_OPEN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,149,281,10
- RTEXT "Number of messages to load:",IDC_STATIC,13,163,231,8
- EDITTEXT IDC_MESSAGES_COUNT,249,160,34,14,ES_AUTOHSCROLL
- CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,160,11,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,135,281,10
+ RTEXT "Number of messages to load:",IDC_STATIC,13,149,231,8
+ EDITTEXT IDC_MESSAGES_COUNT,249,146,34,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,146,11,14
END
IDD_GUARD DIALOGEX 0, 0, 193, 94
@@ -214,11 +212,11 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Facebook Login Approval"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT "Your security settings requires to input a security code to access your account from unknown browsers.\n\nYou can get the code via Facebook application on your phone or click button below to receive it via SMS.", IDC_STATIC, 7, 7, 179, 40
- PUSHBUTTON "Send SMS", IDC_SEND_SMS, 7, 53, 59, 15
- EDITTEXT IDC_TEXT, 72, 54, 114, 12, ES_AUTOHSCROLL | ES_NUMBER
- DEFPUSHBUTTON "OK",IDOK,82,75,50,14
- PUSHBUTTON "Cancel",IDCANCEL,136,75,50,14
+ LTEXT "Your security settings requires to input a security code to access your account from unknown browsers.\n\nYou can get the code via Facebook application on your phone or click button below to receive it via SMS.",IDC_STATIC,7,7,179,40
+ PUSHBUTTON "Send SMS",IDC_SEND_SMS,7,53,59,15
+ EDITTEXT IDC_TEXT,72,54,114,12,ES_AUTOHSCROLL | ES_NUMBER
+ DEFPUSHBUTTON "OK",IDOK,82,75,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,136,75,50,14
END
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h
index d86ea571d8..8ab4171eda 100644
--- a/protocols/FacebookRM/src/constants.h
+++ b/protocols/FacebookRM/src/constants.h
@@ -82,7 +82,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEFAULT_CUSTOM_SMILEYS 0
#define DEFAULT_LOAD_PAGES 0
#define DEFAULT_KEEP_UNREAD 0
-#define DEFAULT_INBOX_ONLY 0
#define DEFAULT_FILTER_ADS 0
#define DEFAULT_LOGIN_SYNC 0
#define DEFAULT_MESSAGES_ON_OPEN 0
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index 1c475c8237..f6c0d603bb 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -57,7 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FACEBOOK_KEY_PLACE "Place"
#define FACEBOOK_KEY_LAST_WALL "LastWall"
#define FACEBOOK_KEY_LOAD_PAGES "LoadPages"
-#define FACEBOOK_KEY_INBOX_ONLY "InboxOnly"
#define FACEBOOK_KEY_FILTER_ADS "FilterAds"
#define FACEBOOK_KEY_LOGON_TS "LogonTS"
#define FACEBOOK_KEY_LOGIN_SYNC "LoginSync" // (byte) 0 = get only unread messages, 1 = sync messages since last activity (default is 0)
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 70bc1f3856..85571b2508 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -583,7 +583,6 @@ INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam,
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
LoadDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS);
- LoadDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY, DEFAULT_INBOX_ONLY);
LoadDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD, DEFAULT_KEEP_UNREAD);
LoadDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN);
LoadDBCheckState(proto, hwnd, IDC_LOGIN_SYNC, FACEBOOK_KEY_LOGIN_SYNC, DEFAULT_LOGIN_SYNC);
@@ -617,7 +616,6 @@ INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam,
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS);
- StoreDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY);
StoreDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD);
StoreDBCheckState(proto, hwnd, IDC_LOGIN_SYNC, FACEBOOK_KEY_LOGIN_SYNC);
StoreDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN);
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 2e7f743cd0..ecd69d393b 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -511,7 +511,7 @@ void parseAttachments2(FacebookProto *proto, std::string *message_text, const JS
}
}
-int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebook_message* >* messages, std::map< std::string, facebook_notification* >* notifications, bool inboxOnly)
+int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebook_message* >* messages, std::map< std::string, facebook_notification* >* notifications)
{
// remove old received messages from map
for (std::map<std::string, int>::iterator it = proto->facy.messages_ignore.begin(); it != proto->facy.messages_ignore.end();) {
@@ -548,8 +548,6 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebo
const JSONNode &cls_ = delta_["class"];
std::string cls = cls_.as_string();
if (cls == "NewMessage") {
- // TODO: Support for "folders" was probably removed, we should remove the "inboxOnly" option too - but first check how does that "allow messages request" works
-
const JSONNode &meta_ = delta_["messageMetadata"];
if (!meta_) {
proto->debugLogA("json::parse_messages - No messageMetadata element");
@@ -961,7 +959,7 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebo
return EXIT_SUCCESS;
}
-int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< std::string >* threads, bool inboxOnly)
+int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< std::string >* threads)
{
std::string jsonData = data->substr(9);
@@ -974,12 +972,8 @@ int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< s
return EXIT_FAILURE;
for (auto it = unread_threads.begin(); it != unread_threads.end(); ++it) {
- const JSONNode &folder = (*it)["folder"];
const JSONNode &thread_ids = (*it)["thread_ids"];
- if (inboxOnly && folder.as_string() != "inbox")
- continue;
-
for (auto jt = thread_ids.begin(); jt != thread_ids.end(); ++jt)
threads->push_back((*jt).as_string());
}
@@ -987,7 +981,7 @@ int facebook_json_parser::parse_unread_threads(std::string *data, std::vector< s
return EXIT_SUCCESS;
}
-int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< facebook_message* >* messages, std::map< std::string, facebook_chatroom* >* chatrooms, bool unreadOnly, bool inboxOnly)
+int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< facebook_message* >* messages, std::map< std::string, facebook_chatroom* >* chatrooms, bool unreadOnly)
{
std::string jsonData = data->substr(9);
@@ -1023,7 +1017,6 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
const JSONNode &name = (*it)["name"];
//const JSONNode &message_count = (*it)["message_count");
//const JSONNode &unread_count = (*it)["unread_count"); // TODO: use it to check against number of loaded messages... but how?
- const JSONNode &folder = (*it)["folder"];
if (!other_user_fbid || !thread_id) {
proto->debugLogA("!!! Missing other_user_fbid/thread_id");
@@ -1053,9 +1046,6 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
if (iter != chatrooms->end())
chatrooms->erase(iter); // this is not chatroom
- if (inboxOnly && folder.as_string() != "inbox")
- continue;
-
if (id == "null")
continue;
@@ -1071,15 +1061,11 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector<
const JSONNode &mid = (*it)["message_id"];
const JSONNode &timestamp = (*it)["timestamp"];
const JSONNode &filtered = (*it)["is_filtered_content"];
- const JSONNode &folder = (*it)["folder"];
const JSONNode &is_unread = (*it)["is_unread"];
if (!author || !body || !mid || !tid || !timestamp)
continue;
- if (inboxOnly && folder.as_string() != "inbox")
- continue;
-
std::string thread_id = tid.as_string();
std::string message_id = mid.as_string();
std::string message_text = body.as_string();
diff --git a/protocols/FacebookRM/src/json.h b/protocols/FacebookRM/src/json.h
index 21663281f0..08aca60918 100644
--- a/protocols/FacebookRM/src/json.h
+++ b/protocols/FacebookRM/src/json.h
@@ -33,9 +33,9 @@ public:
int parse_buddy_list(std::string*, List::List< facebook_user >*);
int parse_friends(std::string*, std::map< std::string, facebook_user* >*);
int parse_notifications(std::string*, std::map< std::string, facebook_notification* >*);
- int parse_messages(std::string*, std::vector< facebook_message* >*, std::map< std::string, facebook_notification* >*, bool inboxOnly);
- int parse_unread_threads(std::string*, std::vector< std::string >*, bool inboxOnly);
- int parse_thread_messages(std::string*, std::vector< facebook_message* >*, std::map< std::string, facebook_chatroom* >*, bool unreadOnly, bool inboxOnly);
+ int parse_messages(std::string*, std::vector< facebook_message* >*, std::map< std::string, facebook_notification* >*);
+ int parse_unread_threads(std::string*, std::vector< std::string >*);
+ int parse_thread_messages(std::string*, std::vector< facebook_message* >*, std::map< std::string, facebook_chatroom* >*, bool unreadOnly);
int parse_thread_info(std::string* data, std::string* user_id);
int parse_user_info(std::string* data, facebook_user* fbu);
int parse_chat_info(std::string* data, facebook_chatroom* fbc);
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index a1f5938fee..c1986f2b7d 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -309,12 +309,7 @@ void FacebookProto::ProcessUnreadMessages(void*)
facy.handle_entry("ProcessUnreadMessages");
- // receive messages from all folders by default, use hidden setting to receive only inbox messages
- bool inboxOnly = getBool(FACEBOOK_KEY_INBOX_ONLY, 0);
-
- std::string data = "folders[0]=inbox";
- if (!inboxOnly)
- data += "&folders[1]=other";
+ std::string data = "folders[0]=inbox&folders[1]=other"; // TODO: I'm not sure if this is still valid/used on fb side (or it has any effect at all)
data += "&client=mercury";
data += "&__user=" + facy.self_.user_id;
data += "&fb_dtsg=" + facy.dtsg_;
@@ -332,7 +327,7 @@ void FacebookProto::ProcessUnreadMessages(void*)
std::vector<std::string> threads;
facebook_json_parser* p = new facebook_json_parser(this);
- p->parse_unread_threads(&resp.data, &threads, inboxOnly);
+ p->parse_unread_threads(&resp.data, &threads);
delete p;
ForkThread(&FacebookProto::ProcessUnreadMessage, new std::vector<std::string>(threads));
@@ -365,9 +360,6 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
int offset = 0;
int limit = 21;
- // receive messages from all folders by default, use hidden setting to receive only inbox messages
- bool inboxOnly = getBool(FACEBOOK_KEY_INBOX_ONLY, 0);
-
http::response resp;
// TODO: First load info about amount of unread messages, then load exactly this amount for each thread
@@ -405,7 +397,7 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
std::map<std::string, facebook_chatroom*> chatrooms;
facebook_json_parser* p = new facebook_json_parser(this);
- p->parse_thread_messages(&resp.data, &messages, &chatrooms, false, inboxOnly);
+ p->parse_thread_messages(&resp.data, &messages, &chatrooms, false);
delete p;
for (std::map<std::string, facebook_chatroom*>::iterator it = chatrooms.begin(); it != chatrooms.end();) {
@@ -526,7 +518,7 @@ void FacebookProto::LoadLastMessages(void *pParam)
std::map<std::string, facebook_chatroom*> chatrooms;
facebook_json_parser* p = new facebook_json_parser(this);
- p->parse_thread_messages(&resp.data, &messages, &chatrooms, false, false);
+ p->parse_thread_messages(&resp.data, &messages, &chatrooms, false);
delete p;
// TODO: do something with this, chat is loading somewhere else... (in receiveMessages method right now)
@@ -596,16 +588,11 @@ void FacebookProto::SyncThreads(void*)
timestamp = daysBefore;
}
- // Receive messages from all folders by default, use hidden setting to receive only inbox messages
- bool inboxOnly = getBool(FACEBOOK_KEY_INBOX_ONLY, 0);
-
// Get milli timestamp string for Facebook
std::string time = utils::conversion::to_string((void*)&timestamp, UTILS_CONV_TIME_T) + "000";
std::string data = "last_action_timestamp=" + time;
- data += "&folders[0]=inbox";
- if (!inboxOnly)
- data += "&folders[1]=other";
+ data += "&folders[0]=inbox&folders[1]=other"; // TODO: I'm not sure if this is still valid/used on fb side (or it has any effect at all)
data += "&client=mercury_sync";
data += "&__user=" + facy.self_.user_id;
data += "&__dyn=" + facy.__dyn();
@@ -629,7 +616,7 @@ void FacebookProto::SyncThreads(void*)
std::map<std::string, facebook_chatroom*> chatrooms;
facebook_json_parser* p = new facebook_json_parser(this);
- p->parse_thread_messages(&resp.data, &messages, &chatrooms, false, false);
+ p->parse_thread_messages(&resp.data, &messages, &chatrooms, false);
delete p;
ReceiveMessages(messages, true);
@@ -1036,9 +1023,6 @@ void FacebookProto::ProcessMessages(void* data)
return;
}
- // receive messages from all folders by default, use hidden setting to receive only inbox messages
- bool inboxOnly = getBool(FACEBOOK_KEY_INBOX_ONLY, 0);
-
debugLogA("*** Starting processing messages");
CODE_BLOCK_TRY
@@ -1046,7 +1030,7 @@ void FacebookProto::ProcessMessages(void* data)
std::vector< facebook_message* > messages;
facebook_json_parser* p = new facebook_json_parser(this);
- p->parse_messages(resp, &messages, &facy.notifications, inboxOnly);
+ p->parse_messages(resp, &messages, &facy.notifications);
delete p;
ReceiveMessages(messages);
diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h
index ba66e994a0..2c43b7a224 100644
--- a/protocols/FacebookRM/src/resource.h
+++ b/protocols/FacebookRM/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by ..\res\facebook.rc
+// Used by D:\Development\Miranda NG\Miranda NG\protocols\FacebookRM\res\facebook.rc
//
#define IDC_EXPAND 3
#define IDI_FACEBOOK 101
@@ -33,7 +33,6 @@
#define IDC_CUSTOM_SMILEYS 1034
#define IDC_LOAD_PAGES 1036
#define IDC_KEEP_UNREAD 1037
-#define IDC_INBOX_ONLY 1038
#define IDC_MESSAGES_ON_OPEN 1039
#define IDC_HIDE_CHATS 1040
#define IDC_NOTIFICATIONS_ENABLE 1041