-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: add knockroom api #615
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid it's just a tad harder than just that.
lib/connection.cpp
Outdated
// with a sync yet. If the room object is not there, provideRoom() will | ||
// create it in Join state. finished() is used here instead of success() | ||
// to overtake clients that may add their own slots to finished(). | ||
connect(job, &BaseJob::finished, this, [this, job] { | ||
if (job->status().good()) | ||
provideRoom(job->roomId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You really should have read this comment before copying it from joinRoom()
... provideRoom()
creates a room in Join
state by default - this is not the desired behaviour here.
// with a sync yet. If the room object is not there, provideRoom() will | |
// create it in Join state. finished() is used here instead of success() | |
// to overtake clients that may add their own slots to finished(). | |
connect(job, &BaseJob::finished, this, [this, job] { | |
if (job->status().good()) | |
provideRoom(job->roomId()); | |
// with a sync yet. If the room object is not there, provideRoom() will | |
// create it in Knock state. finished() is used here instead of success() | |
// to overtake clients that may add their own slots to finished(). | |
connect(job, &BaseJob::finished, this, [this, job] { | |
if (job->status().good()) | |
provideRoom(job->roomId(), JoinState::Knock); |
There's yet another potential problem here: provideRoom()
was written with just three join states in mind, and I cannot figure off the top of my head how it will behave if the room is found but is not in the Leave
state. The code of provideRoom()
should be reviewed and possibly updated to make sure Quotient clients don't accidentally turn, e.g., already joined rooms into knock rooms (the homeserver won't allow that but the local state may be screwed).
add a knockRoom to connection.h