(matrix) Fetch own displayname, use correct user ID
This commit is contained in:
parent
604082466e
commit
8456e00bd8
|
@ -129,16 +129,25 @@ MatrixApp::Connect()
|
||||||
void
|
void
|
||||||
MatrixApp::StartLoop()
|
MatrixApp::StartLoop()
|
||||||
{
|
{
|
||||||
BMessage ready(IM_MESSAGE);
|
client->get_profile(client->user_id().to_string(),
|
||||||
ready.AddInt32("im_what", IM_PROTOCOL_READY);
|
[this](const mtx::responses::Profile &res, mtx::http::RequestErr err)
|
||||||
SendMessage(ready);
|
{
|
||||||
|
if (err) {
|
||||||
|
print_error(err, "Failed getting own info after login…");
|
||||||
|
StartLoop();
|
||||||
|
snooze(1000000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BMessage ready(IM_MESSAGE);
|
||||||
|
ready.AddInt32("im_what", IM_PROTOCOL_READY);
|
||||||
|
SendMessage(ready);
|
||||||
|
|
||||||
BString mxId("@");
|
BMessage init(IM_MESSAGE);
|
||||||
mxId << fUser << ":" << fServer;
|
init.AddInt32("im_what", IM_OWN_CONTACT_INFO);
|
||||||
BMessage init(IM_MESSAGE);
|
init.AddString("user_id", client->user_id().to_string().c_str());
|
||||||
init.AddInt32("im_what", IM_OWN_CONTACT_INFO);
|
init.AddString("user_name", res.display_name.c_str());
|
||||||
init.AddString("user_id", mxId);
|
SendMessage(init);
|
||||||
SendMessage(init);
|
});
|
||||||
|
|
||||||
BMessage status(IM_MESSAGE);
|
BMessage status(IM_MESSAGE);
|
||||||
status.AddInt32("im_what", IM_OWN_STATUS_SET);
|
status.AddInt32("im_what", IM_OWN_STATUS_SET);
|
||||||
|
|
Ŝarĝante…
Reference in New Issue