diff options
author | Robert Pösel <robyer@seznam.cz> | 2016-04-17 17:06:32 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2016-04-17 17:06:32 +0000 |
commit | 217cefab79fe09de8911fa3e94ff8c2fa6014a55 (patch) | |
tree | a4ad900cab4aada45c82299862f654f58ef0dd76 /protocols | |
parent | 9e64b26c646913d5669723269c07e6fe8277f10c (diff) |
Facebook: Remove useless sender_name field
git-svn-id: http://svn.miranda-ng.org/main/trunk@16702 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/entities.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 6 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 11 |
3 files changed, 7 insertions, 11 deletions
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h index ffdb16c955..88be2bd21e 100644 --- a/protocols/FacebookRM/src/entities.h +++ b/protocols/FacebookRM/src/entities.h @@ -81,7 +81,6 @@ struct facebook_chatroom struct facebook_message { std::string user_id; - std::string sender_name; std::string message_text; std::string message_id; std::string thread_id; diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index d4e4c84d87..d3cd1e7683 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -941,7 +941,6 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebo message->time = utils::time::from_string(action_["timestamp"].as_string()); message->user_id = id; message->message_id = message_id; - message->sender_name.clear(); message->thread_id = thread_id; message->type = CALL; @@ -1081,7 +1080,6 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< for (auto it = actions.begin(); it != actions.end(); ++it) { const JSONNode &author = (*it)["author"]; - const JSONNode &author_email = (*it)["author_email"]; const JSONNode &other_user_fbid = (*it)["other_user_fbid"]; const JSONNode &body = (*it)["body"]; const JSONNode &tid = (*it)["thread_id"]; @@ -1098,7 +1096,7 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< std::string message_text = body.as_string(); std::string author_id = author.as_string(); std::string other_user_id = other_user_fbid ? other_user_fbid.as_string() : ""; - std::string::size_type pos = author_id.find(":"); + std::string::size_type pos = author_id.find(":"); // strip "fbid:" prefix if (pos != std::string::npos) author_id = author_id.substr(pos + 1); @@ -1120,8 +1118,6 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< facebook_message* message = new facebook_message(); message->message_text = message_text; - if (author_email) - message->sender_name = author_email.as_string(); message->time = utils::time::from_string(timestamp.as_string()); message->thread_id = thread_id; message->message_id = message_id; diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 27383e09f1..ae521345a9 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -919,15 +919,17 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message*> messages, boo if (!tid || mir_strcmp(tid, messages[i]->thread_id.c_str())) setString(hChatContact, FACEBOOK_KEY_TID, messages[i]->thread_id.c_str()); - // Try to map name of this chat participant to his id - std::map<std::string, std::string>::iterator jt = fbc->participants.find(messages[i]->user_id); + // Get name of this chat participant + std::string name = messages[i]->user_id; // fallback to numeric id + + auto jt = fbc->participants.find(messages[i]->user_id); if (jt != fbc->participants.end()) { - messages[i]->sender_name = jt->second; + name = jt->second; } // TODO: support also system messages (rename chat, user quit, etc.)! (here? or it is somewhere else? // ... we must add some new "type" field into facebook_message structure and use it also for Pokes and similar) - UpdateChat(fbc->thread_id.c_str(), messages[i]->user_id.c_str(), messages[i]->sender_name.c_str(), messages[i]->message_text.c_str(), messages[i]->time); + UpdateChat(fbc->thread_id.c_str(), messages[i]->user_id.c_str(), name.c_str(), messages[i]->message_text.c_str(), messages[i]->time); // Automatically mark message as read because chatroom doesn't support onRead event (yet) hChatContacts->insert(hChatContact); // std::set checks duplicates at insert automatically @@ -938,7 +940,6 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message*> messages, boo facebook_user fbu; fbu.user_id = messages[i]->user_id; - fbu.real_name = messages[i]->sender_name; MCONTACT hContact = ContactIDToHContact(fbu.user_id); if (hContact == NULL) { |