summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-02-06 10:00:00 +0000
committerRobert Pösel <robyer@seznam.cz>2015-02-06 10:00:00 +0000
commit57890ac884743d836690db5058185db1e6dea5d8 (patch)
tree937ab0cd988dddc58de40135a7c825227440e086
parent1d9a2d26d7b7b458d7e65a683e7ca3d7506ced8b (diff)
Facebook: Fix loading sent messages via other instances (website) to wrong contact in Miranda; Version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@12018 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/FacebookRM/src/contacts.cpp15
-rw-r--r--protocols/FacebookRM/src/json.cpp2
-rw-r--r--protocols/FacebookRM/src/version.h2
3 files changed, 17 insertions, 2 deletions
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index e36b120c4e..a1e2abcf0e 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -77,6 +77,11 @@ bool FacebookProto::IsMyContact(MCONTACT hContact, bool include_chat)
MCONTACT FacebookProto::ChatIDToHContact(const std::tstring &chat_id)
{
+ if (chat_id.empty()) {
+ debugLogA("!!! Calling ChatIDToContactID() with empty chat_id");
+ return 0;
+ }
+
// First check cache
std::map<std::tstring, MCONTACT>::iterator it = facy.chat_id_to_hcontact.find(chat_id);
if (it != facy.chat_id_to_hcontact.end()) {
@@ -104,6 +109,11 @@ MCONTACT FacebookProto::ChatIDToHContact(const std::tstring &chat_id)
MCONTACT FacebookProto::ContactIDToHContact(const std::string &user_id)
{
+ if (user_id.empty()) {
+ debugLogA("!!! Calling ContactIDToHContact() with empty user_id");
+ return 0;
+ }
+
// First check cache
std::map<std::string, MCONTACT>::iterator it = facy.user_id_to_hcontact.find(user_id);
if (it != facy.user_id_to_hcontact.end()) {
@@ -131,6 +141,11 @@ MCONTACT FacebookProto::ContactIDToHContact(const std::string &user_id)
std::string FacebookProto::ThreadIDToContactID(const std::string &thread_id)
{
+ if (thread_id.empty()) {
+ debugLogA("!!! Calling ThreadIDToContactID() with empty thread_id");
+ return "";
+ }
+
// First check cache
std::map<std::string, std::string>::iterator it = facy.thread_id_to_user_id.find(thread_id);
if (it != facy.thread_id_to_user_id.end()) {
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 3a08e928fa..b24afdb330 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -557,7 +557,7 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo
if (!message->isChat && !message->isIncoming) {
message->sender_name.clear();
- message->user_id = proto->ThreadIDToContactID(message->thread_id); // TODO: Check if we have contact with this user_id in friendlist and otherwise do something different?
+ message->user_id = !other_user_id.empty() ? other_user_id : proto->ThreadIDToContactID(message->thread_id); // TODO: Check if we have contact with this user_id in friendlist and otherwise do something different?
}
messages->push_back(message);
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index e782d40cce..490dd1ce7a 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 9
-#define __BUILD_NUM 9
+#define __BUILD_NUM 10
#include <stdver.h>