diff --git a/modules/client/join.cc b/modules/client/join.cc index 9ec88cfa0..8aec28c7c 100644 --- a/modules/client/join.cc +++ b/modules/client/join.cc @@ -173,6 +173,29 @@ bootstrap(const m::room::alias &room_alias, { event, { "room_id", room_id }}, }; + const m::user user + { + user_id + }; + + char displayname_buf[256]; + const string_view displayname + { + user.profile(displayname_buf, "displayname") + }; + + char avatar_url_buf[256]; + const string_view avatar_url + { + user.profile(avatar_url_buf, "avatar_url") + }; + + const json::iov::add_if add_if[] + { + { content, !empty(displayname), { "displayname", displayname }}, + { content, !empty(avatar_url), { "avatar_url", avatar_url }}, + }; + m::vm::opts opts; opts.non_conform.set(m::event::conforms::MISSING_MEMBERSHIP); opts.non_conform.set(m::event::conforms::MISSING_PREV_STATE); diff --git a/modules/client/rooms/join.cc b/modules/client/rooms/join.cc index 858169ab8..ae5b1ebb5 100644 --- a/modules/client/rooms/join.cc +++ b/modules/client/rooms/join.cc @@ -60,5 +60,28 @@ join__room_user(const room &room, { content, { "membership", "join" }}, }; + const m::user user + { + user_id + }; + + char displayname_buf[256]; + const string_view displayname + { + user.profile(displayname_buf, "displayname") + }; + + char avatar_url_buf[256]; + const string_view avatar_url + { + user.profile(avatar_url_buf, "avatar_url") + }; + + const json::iov::add_if add_if[] + { + { content, !empty(displayname), { "displayname", displayname }}, + { content, !empty(avatar_url), { "avatar_url", avatar_url }}, + }; + return commit(room, event, content); }