diff options
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/contacts.cpp | 15 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/version.h | 2 |
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>
|