mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
modules/client/join: Add relevant user profile values to join event iov.
This commit is contained in:
parent
7bfd050131
commit
faefd5dd64
2 changed files with 46 additions and 0 deletions
|
@ -173,6 +173,29 @@ bootstrap(const m::room::alias &room_alias,
|
||||||
{ event, { "room_id", room_id }},
|
{ 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;
|
m::vm::opts opts;
|
||||||
opts.non_conform.set(m::event::conforms::MISSING_MEMBERSHIP);
|
opts.non_conform.set(m::event::conforms::MISSING_MEMBERSHIP);
|
||||||
opts.non_conform.set(m::event::conforms::MISSING_PREV_STATE);
|
opts.non_conform.set(m::event::conforms::MISSING_PREV_STATE);
|
||||||
|
|
|
@ -60,5 +60,28 @@ join__room_user(const room &room,
|
||||||
{ content, { "membership", "join" }},
|
{ 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);
|
return commit(room, event, content);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue