diff options
author | George Hazan <ghazan@miranda.im> | 2020-01-25 20:11:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-01-25 20:11:06 +0300 |
commit | c21e6b480eea5cca423d2b98475189f3349598db (patch) | |
tree | 4958038fb453f13a93d0dc86e02d652e3f61bfa0 /protocols | |
parent | a3c013d6d824956dccebaac66c708f8c0a855167 (diff) |
Facebook: create a fake name for unnamed group chats
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Facebook/src/server.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index 2e21d01bf1..704e21e44f 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -177,6 +177,23 @@ void FacebookProto::RefreshThreads() CMStringW chatId(n["thread_key"]["thread_fbid"].as_mstring()); CMStringW name(n["name"].as_mstring()); + if (name.IsEmpty()) { + for (auto &u : n["all_participants"]["nodes"]) { + auto &ur = u["messaging_actor"]; + CMStringW userId(ur["id"].as_mstring()); + if (_wtoi64(userId) == m_uid) + continue; + + if (!name.IsEmpty()) + name.Append(L", "); + name += ur["name"].as_mstring(); + } + + if (name.GetLength() > 128) { + name.Truncate(125); + name.Append(L"..."); + } + } auto *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, chatId, name); if (si == nullptr) |