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

feat: add joinrule api and joinrulesevent #616

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Decodetalkers
Copy link

add joinrule, code from neochat

Copy link
Member

@KitsuneRal KitsuneRal left a comment

Choose a reason for hiding this comment

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

A few changes will be needed before moving forward.

lib/events/joinrulesevent.cpp Outdated Show resolved Hide resolved
lib/events/joinrulesevent.h Outdated Show resolved Hide resolved
Comment on lines +8 to +16
class JoinRulesEvent : public StateEvent {
public:
QUO_EVENT(JoinRulesEvent, "m.room.join_rules")

explicit JoinRulesEvent(const QJsonObject& obj) : StateEvent(obj) {}

QString joinRule() const;
QJsonArray allow() const;
};
Copy link
Member

Choose a reason for hiding this comment

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

This is a rather basic implementation of m.room.join_rules, missing the safeguards that I would expect it to have. At the very least, joinRule should be an enum (hopefully we don't get a tide of new join rules in the next year, as we've just added a bunch). Even better, allow could actually be made a vector of AllowCondition structures defined in the spec. I realise this is more work than just copying code from NeoChat - if you don't feel like doing it, let me know and I will help.

lib/room.cpp Outdated Show resolved Hide resolved
lib/room.cpp Outdated Show resolved Hide resolved
lib/room.h Show resolved Hide resolved
@KitsuneRal
Copy link
Member

I'll take this over if you don't mind.

@Decodetalkers
Copy link
Author

I'll take this over if you don't mind.

Thanks

@KitsuneRal KitsuneRal added the enhancement A feature or change request for the library label Jul 22, 2023
@KitsuneRal KitsuneRal self-assigned this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or change request for the library
Projects
Status: 0.9 - To Do
Development

Successfully merging this pull request may close these issues.

3 participants