summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-12 21:11:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-12 21:11:48 +0300
commit2e6dde78703f4a6a954bc2942d00bbb13b7facdc (patch)
tree3b3baf80be47130dde26c20d6fe44e1a84879b92 /protocols/FacebookRM
parent4f0a7d544b64cb9b4b95f448349eaea90be21425 (diff)
unused parameters removed
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/client.h2
-rw-r--r--protocols/FacebookRM/src/history.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp14
-rw-r--r--protocols/FacebookRM/src/process.cpp6
-rw-r--r--protocols/FacebookRM/src/proto.h2
5 files changed, 12 insertions, 14 deletions
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index a71fab6aff..67c1298854 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -224,7 +224,7 @@ public:
// history.cpp
HttpRequest* threadInfoRequest(bool isChat, const char *id, const char* timestamp = nullptr, int limit = -1, bool loadMessages = false);
- HttpRequest* threadInfoRequest(const LIST<char> &ids, int offset, int limit);
+ HttpRequest* threadInfoRequest(const LIST<char> &ids, int limit);
HttpRequest* unreadThreadsRequest();
// login.cpp
diff --git a/protocols/FacebookRM/src/history.cpp b/protocols/FacebookRM/src/history.cpp
index 82d37ddae1..abffd56647 100644
--- a/protocols/FacebookRM/src/history.cpp
+++ b/protocols/FacebookRM/src/history.cpp
@@ -64,7 +64,7 @@ HttpRequest* facebook_client::threadInfoRequest(bool isChat, const char *id, con
}
// Request both thread info and messages for more threads
-HttpRequest* facebook_client::threadInfoRequest(const LIST<char> &ids, int offset, int limit)
+HttpRequest* facebook_client::threadInfoRequest(const LIST<char> &ids, int limit)
{
HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/api/graphqlbatch/");
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 589aa1e3ac..98048df928 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -510,7 +510,7 @@ const char* FacebookProto::ParseIcon(const std::string &url)
return (itr == reactions.end()) ? nullptr : itr->second.c_str();
}
-int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_message>* messages, std::map< std::string, facebook_notification* >* notifications)
+int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_message>* messages)
{
// remove old received messages from map
for (auto it = facy.messages_ignore.begin(); it != facy.messages_ignore.end();) {
@@ -773,8 +773,8 @@ int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_messag
UpdateNotificationsChatRoom(notification);
// If it's unseen, remember it, otherwise forget it (here it will always be unseen)
- if (notifications->find(notification->id) == notifications->end() && !notification->seen)
- notifications->insert(std::make_pair(notification->id, notification));
+ if (facy.notifications.find(notification->id) == facy.notifications.end() && !notification->seen)
+ facy.notifications.insert(std::make_pair(notification->id, notification));
else
delete notification;
}
@@ -825,7 +825,7 @@ int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_messag
// Write notification to chatroom
UpdateNotificationsChatRoom(notification);
- notifications->insert(std::make_pair(notification->id, notification));
+ facy.notifications.insert(std::make_pair(notification->id, notification));
}
}
else if (t == "jewel_requests_add") {
@@ -1088,13 +1088,13 @@ int FacebookProto::ParseMessages(std::string *pData, std::vector<facebook_messag
const JSONNode &alerts = it["alert_ids"];
for (auto &itAlerts : alerts) {
- auto itAlert = notifications->find(itAlerts.as_string());
- if (itAlert != notifications->end()) {
+ auto itAlert = facy.notifications.find(itAlerts.as_string());
+ if (itAlert != facy.notifications.end()) {
if (itAlert->second->hWndPopup != nullptr)
PUDeletePopup(itAlert->second->hWndPopup); // close popup
delete itAlert->second;
- notifications->erase(itAlert);
+ facy.notifications.erase(itAlert);
}
}
}
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 9ec6e093f6..101ebb7cfc 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -194,7 +194,6 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
facy.handle_entry("ProcessUnreadMessage");
- int offset = 0;
int limit = 21;
// FIXME: Rework this whole request as offset doesn't work anyway, and allow to load all the unread messages for each thread (IMHO could be done in 2 single requests = 1) get number of messages for all threads 2) load the counts of messages for all threads)
@@ -207,7 +206,7 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
for (std::vector<std::string>::size_type i = 0; i < threads->size(); i++)
ids.insert(mir_strdup(threads->at(i).c_str()));
- http::response resp = facy.sendRequest(facy.threadInfoRequest(ids, offset, limit));
+ http::response resp = facy.sendRequest(facy.threadInfoRequest(ids, limit));
FreeList(ids);
ids.destroy();
@@ -228,7 +227,6 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
}
else facy.handle_error("ProcessUnreadMessage");
- // offset += limit;
// limit = 20; // TODO: use better limits?
threads->clear(); // TODO: if we have limit messages from one user, there may be more unread messages... continue with it... otherwise remove that threadd from threads list -- or do it in json parser? hm = allow more than "limit" unread messages to be parsed
@@ -913,7 +911,7 @@ void FacebookProto::ProcessMessages(void* data)
try {
std::vector<facebook_message> messages;
- ParseMessages(resp, &messages, &facy.notifications);
+ ParseMessages(resp, &messages);
ReceiveMessages(messages);
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index a9b2e798dc..999ca5b704 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -37,7 +37,7 @@ class FacebookProto : public PROTO<FacebookProto>
int ParseChatParticipants(std::string *data, std::map<std::string, chatroom_participant>* participants);
int ParseFriends(std::string*, std::map< std::string, facebook_user* >*, bool);
int ParseHistory(std::string* data, std::vector<facebook_message>* messages, std::string* firstTimestamp);
- int ParseMessages(std::string*, std::vector< facebook_message >*, std::map< std::string, facebook_notification* >*);
+ int ParseMessages(std::string*, std::vector< facebook_message >*);
int ParseMessagesCount(std::string *data, int *messagesCount, int *unreadCount);
int ParseNotifications(std::string*, std::map< std::string, facebook_notification* >*);
int ParseThreadInfo(std::string* data, std::string* user_id);