-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Timestamp massaging in send_state_event #151
Comments
Overriding query params like that isn't supported, the proper way is the |
Thank you for letting me know of the The spec (v1.7) now says
I just tried manually calling the REST API, and can confirm timestamp massaging works for sending custom state events, but not in However, if I try doing it directly from mautrix-python, timestamp massaging works for leave events, but not for join events: # this does not work
await user_api.send_state_event(
ROOM,
EventType.ROOM_MEMBER,
MemberStateEventContent(membership=Membership.JOIN),
USER,
timestamp=TIMESTAMP,
)
# this works
await user_api.send_text(ROOM, "hi!", timestamp=TIMESTAMP)
# this works
await user_api.send_state_event(
ROOM,
EventType.ROOM_MEMBER,
MemberStateEventContent(membership=Membership.LEAVE),
USER,
timestamp=TIMESTAMP,
) |
This does seem to work: await user_api.api.request(
Method.PUT,
Path.v3.rooms[ROOM].state['m.room.member'][USER],
timestamp=TIMESTAMP,
content={'membership': 'join'},
) |
Some client API (application service) methods do not seem to have a way of doing timestamp massaging from within Mautrix methods.
Some methods like
send_text
,react
andsend_image
do accept an undocumentedtimestamp
parameter, but other methods likeensure_joined
,invite_user
,join_room
,pin_message
, etc do not have this.This would be useful to write an application service that lets you import messages from another platform to Matrix, including room join and message pin events (instead of inviting and joining all ghost users prior to bridging messages).
Update: I see that only the methods to send message events and state events in the Matrix API itself let you change the timestamp, so for a join I'd need to manually send a state event. I can probably do that if it's more of a Matrix limitation then.
It would be nice for other methods that ultimately result in a state event (even if only in the homeserver backend) to accept the
timestamp
parameter as well, and manually send state events if it is specified. But first,timestamp
needs to be supported insend_state_event
.The text was updated successfully, but these errors were encountered: