Skip to content

MSC4426 : support set/clear/fetch own user status #6703

Open
ganfra wants to merge 5 commits into
mainfrom
ganfra/set_user_status
Open

MSC4426 : support set/clear/fetch own user status #6703
ganfra wants to merge 5 commits into
mainfrom
ganfra/set_user_status

Conversation

@ganfra

@ganfra ganfra commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Adds support for MSC4426 (user status profile fields). Two new profile fields are exposed end-to-end behind a new unstable-msc4426.

  • m.status : user-set emoji + text.
  • m.call : call indicator with an optional call_joined_ts.

SDK: four new methods on Account : set_status / clear_status / set_call / clear_call

FFI : two uniffi records UserStatus { emoji, text } and UserCall { call_joined_ts }

  • Client::set_user_status(UserStatus) : writes m.status.
  • Client::clear_user_status() : concurrently clears both m.status and m.call (the latter prevents the call indicator from reappearing immediately after a manual clear).
  • Client::get_profile(user_id) now returns status: Option<UserStatus> and call: Option<UserCall> alongside the existing fields.

The FFI keeps the precedence rule (m.status over m.call) out of the API.

Handles part of #6616.

  • I've documented the public API changes in the appropriate changelog files (see Writing changelog entries).
  • This PR was made with the help of AI.

Signed-off-by:

@ganfra ganfra requested a review from a team as a code owner June 30, 2026 12:15
@ganfra ganfra requested review from Hywan and removed request for a team June 30, 2026 12:15
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@023f5bd). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6703   +/-   ##
=======================================
  Coverage        ?   89.94%           
=======================================
  Files           ?      397           
  Lines           ?   110671           
  Branches        ?   110671           
=======================================
  Hits            ?    99544           
  Misses          ?     7357           
  Partials        ?     3770           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@codspeed-hq

codspeed-hq Bot commented Jun 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing ganfra/set_user_status (13a78e0) with main (023f5bd)

Open in CodSpeed

@ganfra ganfra force-pushed the ganfra/set_user_status branch from a88cd1f to 13a78e0 Compare June 30, 2026 13:35

@Hywan Hywan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for the contribution. I left a couple of question regarding data validation client-side, I think it could be a nice addition to save calls to the server.

/// # Arguments
///
/// * `emoji` - the status emoji. The MSC limits this to 32 bytes; not
/// enforced client-side.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why “not enforced client-side”? It would save one roundtrip to the server.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversation on Ruma for reference ruma/ruma#2498 (comment). (Not saying that answers what we should do in the SDK, just noting that that's why Ruma doesn't do any checks on this)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. However, since the Rust SDK tries to be strict and consistent regarding the specification, I prefer to have a check here.

@ganfra ganfra Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of error should I return then? Can you point me to any parameter validation in the code base, because I fail to see one...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hywan this is blocking us, do you think we can move without it?

Comment on lines +461 to +462
/// * `text` - the status text. The MSC limits this to 256 bytes; not
/// enforced client-side.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question: why “not enforced client-side”? Same reason.

let client = server.client_builder().server_versions(vec![MatrixVersion::V1_16]).build().await;
let user_id = client.user_id().unwrap();

// Two PUTs expected: one with a join ts, one without.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to test the payload then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants