summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Facebook/src/server.cpp17
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)