diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-04-21 14:50:43 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-04-21 14:50:43 +0000 |
commit | cebc18b4b133798537488e8cb7ea8c0cb9966314 (patch) | |
tree | 108a94f6dd351503565435c41e6140357d8d79b1 | |
parent | cdde7a98ea50cfb2c7330cd2424afb071084d21c (diff) |
Facebook: Small cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@9012 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/FacebookRM/src/chat.cpp | 3 | ||||
-rw-r--r-- | protocols/FacebookRM/src/entities.h | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 30 |
3 files changed, 4 insertions, 31 deletions
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 93be3281a1..d0e412ab22 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -43,9 +43,6 @@ void FacebookProto::UpdateChat(const TCHAR *tchat_id, const char *id, const char std::map<std::tstring, facebook_chatroom>::iterator chatroom = facy.chat_rooms.find(tchat_id);
chatroom->second.message_readers = "";
-
- //HANDLE hChatContact = ChatIDToHContact(chat_id);
- //CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)mir_a2u("Unseen"));
}
void FacebookProto::RenameChat(const char *chat_id, const char *name)
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h index a82b0843bb..188bd19df8 100644 --- a/protocols/FacebookRM/src/entities.h +++ b/protocols/FacebookRM/src/entities.h @@ -84,8 +84,6 @@ struct facebook_user struct facebook_chatroom
{
- HANDLE handle;
-
std::tstring chat_name;
std::tstring thread_id;
std::map<std::string, std::string> participants;
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index df58d2d5f3..f5a60b1466 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -431,40 +431,18 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa if (chatroom != proto->facy.chat_rooms.end()) {
std::map<std::string, std::string>::const_iterator participant = chatroom->second.participants.find(reader_id);
if (participant == chatroom->second.participants.end()) {
- // TODO: remove or write better all of this
- std::string tidA = _T2A(tid.c_str());
- std::string search = utils::url::encode(tidA) + "?";
- http::response resp = proto->facy.flap(REQUEST_USER_INFO, NULL, &search);
-
- if (resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end()) {
- search = utils::text::source_get_value(&resp.headers["Location"], 2, FACEBOOK_SERVER_MOBILE"/", "_rdr", true);
- resp = proto->facy.flap(REQUEST_USER_INFO, NULL, &search);
- }
-
- if (resp.code == HTTP_CODE_OK) {
- std::string about = utils::text::source_get_value(&resp.data, 2, "<div class=\"timeline", "<div id=\"footer");
-
- std::string name = utils::text::source_get_value(&about, 3, "class=\"profileName", ">", "</");
- std::string surname;
-
- std::string::size_type pos;
- if ((pos = name.find(" ")) != std::string::npos) {
- surname = name.substr(pos + 1, name.length() - pos - 1);
- name = name.substr(0, pos);
- }
-
- proto->AddChatContact(tid.c_str(), reader_id.c_str(), name.c_str());
- }
+ // TODO: load name of this participant
+ std::string name = reader_id;
+ proto->AddChatContact(tid.c_str(), reader_id.c_str(), name.c_str());
}
participant = chatroom->second.participants.find(reader_id);
if (participant != chatroom->second.participants.end()) {
MCONTACT hChatContact = proto->ChatIDToHContact(tid);
- const char *participant_name = participant->second.c_str();
if (!chatroom->second.message_readers.empty())
chatroom->second.message_readers += ", ";
- chatroom->second.message_readers += participant_name;
+ chatroom->second.message_readers += participant->second;
ptrT readers(mir_utf8decodeT(chatroom->second.message_readers.c_str()));
|