Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark a room as read #37

Open
erdnaxeli opened this issue Feb 21, 2021 · 2 comments
Open

Mark a room as read #37

erdnaxeli opened this issue Feb 21, 2021 · 2 comments

Comments

@erdnaxeli
Copy link
Contributor

erdnaxeli commented Feb 21, 2021

Like the title says, this would ease the use of other clients.

If I look at how it is done in the python script, a read marker is sent for the last event if:

  • we switch to a room buffer and the last message was not already read
  • when we send a message, we mark it as read when receiving it back

Sending send receipt or not should be configurable, with default to sending them.

I will try to propose a PR.

@erdnaxeli
Copy link
Contributor Author

erdnaxeli commented Feb 22, 2021

Ok so it looks like a bit harder than I thought 😅

In MatrixRoom, in handle_outgoing_message, I can look if I need to send a read marker or not. I need to save the last event id and the last read event id in the struct, this part is ok. But how can I access the matrix client object from there to send the read marker?

@poljar
Copy link
Owner

poljar commented Feb 22, 2021

Requests need to be executed on the Tokio runtime, the runtime and the client are contained inside a Connection object which abstracts those away.

You'll have to borrow the connection and if one is active, send the request using the connection. You'll probably will want to add a new helper method to the connection.

Take a look at how messages or typing notifications are handled here and here at the connection side.

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

No branches or pull requests

2 participants