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

Add support for join rule handling #270

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

maltee1
Copy link
Contributor

@maltee1 maltee1 commented Aug 19, 2024

No description provided.

bridgev2/networkinterface.go Outdated Show resolved Hide resolved
@maltee1
Copy link
Contributor Author

maltee1 commented Aug 20, 2024

somehow, portal.handleMatrixJoinRules doesn't seem to be called upon receiving a join rule event

@tulir
Copy link
Member

tulir commented Aug 20, 2024

Probably missing the event handler in the matrix connector

@maltee1
Copy link
Contributor Author

maltee1 commented Aug 20, 2024

I implemented that, but it doesn't even get there. Seems portal.handleMatrixEvent isn't even called. I'm confused.

There should be some kind of debug output mentioning the event type, even if there is no handler, right? This is all I get:

{"level":"debug","transaction_id":"1359356","content":{"pdu":1,"unstable_edu":0,"unstable_to_device":0},"time":"2024-08-20T21:52:42.00156651+02:00","message":"Starting handling of transaction"}
{"level":"debug","transaction_id":"1359356","time":"2024-08-20T21:52:42.001723684+02:00","message":"Finished dispatching events from transaction"}

@tulir
Copy link
Member

tulir commented Aug 20, 2024

Portal is in the central bridge module, it only gets events that the matrix connector registers handlers for

@maltee1
Copy link
Contributor Author

maltee1 commented Aug 20, 2024

then why is portal.handleMatrixPowerLevels called even though this branch doesn't have a handler for power levels?

@tulir
Copy link
Member

tulir commented Aug 20, 2024

b899ef7

@maltee1
Copy link
Contributor Author

maltee1 commented Aug 20, 2024

oh...

@maltee1 maltee1 requested a review from tulir August 21, 2024 07:26
Copy link
Member

@tulir tulir left a comment

Choose a reason for hiding this comment

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

Looks like it should work

@@ -688,6 +688,13 @@ type PowerLevelHandlingNetworkAPI interface {
HandleMatrixPowerLevels(ctx context.Context, msg *MatrixPowerLevelChange) (bool, error)
}

type MatrixJoinRule MatrixRoomMeta[*event.JoinRulesEventContent]

type JoinRulesHandlingNetworkAPI interface {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type JoinRulesHandlingNetworkAPI interface {
type JoinRuleHandlingNetworkAPI interface {

@@ -1333,6 +1335,46 @@ func (portal *Portal) handleMatrixPowerLevels(
}
}

func (portal *Portal) handleMatrixJoinRules(
ctx context.Context,
sender *UserLogin,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this whole function should just be replaced with another case in handleMatrixRoomMeta 🤔

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

Successfully merging this pull request may close these issues.

2 participants