summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/contacts.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2017-03-05 15:05:51 +0100
committerRobert Pösel <robyer@seznam.cz>2017-03-05 15:06:02 +0100
commitda611f505c0e9a8d8476de272967891efba48872 (patch)
tree9c3b2ea1ca752b9a3628748fafa6cd78dbb0b101 /protocols/FacebookRM/src/contacts.cpp
parent5417b1e4a79c86ac64cb3f84cde17eec2e0d0c87 (diff)
Facebook: Fix reseting chat name
When user changed thread name from website and set it to "", in Miranda it previously stay "". Now it correctly generates new name from participant names.
Diffstat (limited to 'protocols/FacebookRM/src/contacts.cpp')
-rw-r--r--protocols/FacebookRM/src/contacts.cpp31
1 files changed, 2 insertions, 29 deletions
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 60fa9c0247..8f4bf3489b 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -332,35 +332,8 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc)
// If chat has no name, create name from participants list
if (fbc->chat_name.empty()) {
- unsigned int namesUsed = 0;
-
- for (auto it = fbc->participants.begin(); it != fbc->participants.end(); ++it) {
- std::string participant = it->second.nick;
-
- // Ignore self contact, empty and numeric only participant names
- if (it->second.role == ROLE_ME || participant.empty() || participant.find_first_not_of("0123456789") == std::string::npos)
- continue;
-
- if (namesUsed > 0)
- fbc->chat_name += L", ";
-
- std::wstring tname = _A2T(participant.c_str(), CP_UTF8);
- fbc->chat_name += utils::text::prepare_name(tname, false);
-
- if (++namesUsed >= FACEBOOK_CHATROOM_NAMES_COUNT)
- break;
- }
-
- // Participants.size()-1 because we ignore self contact
- if (fbc->participants.size() - 1 > namesUsed) {
- wchar_t more[200];
- mir_snwprintf(more, TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - 1 - namesUsed); // -1 because we ignore self contact
- fbc->chat_name = more;
- }
-
- // If there are no participants to create a name from, use just thread_id
- if (fbc->chat_name.empty())
- fbc->chat_name = std::wstring(_A2T(fbc->thread_id.c_str())); // TODO: is this needed? Isn't it showed automatically as id if there is no name?
+ std::string newName = GenerateChatName(fbc);
+ fbc->chat_name = _A2T(newName.c_str(), CP_UTF8);
}
debugLogA("*** Chat thread info processed");