diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-07-06 09:00:17 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-07-06 09:00:17 +0000 |
commit | 9222cf1c6c5880bcd29f54be0e7c37cce1df574a (patch) | |
tree | 281bf8264e9aa97f4322bac9b9f924fce7218c7a /protocols | |
parent | 455353fb70882fb07e41b096ecde60a38ca265a3 (diff) |
Facebook: Fix creating duplicit contacts on window open (it's ugly, must be fixed better later)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9700 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index d0ff3ad01a..782fb3b40c 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -795,6 +795,7 @@ int facebook_json_parser::parse_thread_messages(void* data, std::vector< faceboo JSONNODE *is_canonical_user = json_get(it, "is_canonical_user");
JSONNODE *canonical = json_get(it, "canonical_fbid");
JSONNODE *thread_id = json_get(it, "thread_id");
+ JSONNODE *thread_fbid = json_get(it, "thread_fbid");
JSONNODE *name = json_get(it, "name");
//JSONNODE *message_count = json_get(it, "message_count");
JSONNODE *unread_count = json_get(it, "unread_count"); // TODO: use it to check against number of loaded messages... but how?
@@ -805,7 +806,9 @@ int facebook_json_parser::parse_thread_messages(void* data, std::vector< faceboo std::string id = json_as_pstring(canonical);
std::string tid = json_as_pstring(thread_id);
+ std::string tfbid = json_as_pstring(thread_fbid);
+ // FIXME: fix this ugliness better (it was quick workaround for stable release)
std::map<std::string, facebook_chatroom*>::iterator iter = chatrooms->find(tid);
if (iter != chatrooms->end()) {
if (json_as_bool(is_canonical_user)) {
@@ -815,6 +818,22 @@ int facebook_json_parser::parse_thread_messages(void* data, std::vector< faceboo }
}
+ iter = chatrooms->find(tfbid);
+ if (iter != chatrooms->end()) {
+ if (json_as_bool(is_canonical_user)) {
+ chatrooms->erase(iter); // this is not chatroom
+ }
+ else {
+ iter->second->chat_name = json_as_string(name); // TODO: create name from users if there is no name...
+ }
+ }
+
+ iter = chatrooms->find(id);
+ if (iter != chatrooms->end()) {
+ chatrooms->erase(iter); // this is not chatroom
+ }
+ // END OF FIXME
+
if (inboxOnly && json_as_pstring(folder) != "inbox")
continue;
|