Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
3f11cbb4
Commit
3f11cbb4
authored
5 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
make FederationClient.make_membership_event async
parent
24d814ca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/federation/federation_client.py
+11
-10
11 additions, 10 deletions
synapse/federation/federation_client.py
with
11 additions
and
10 deletions
synapse/federation/federation_client.py
+
11
−
10
View file @
3f11cbb4
...
@@ -35,6 +35,7 @@ from synapse.api.errors import (
...
@@ -35,6 +35,7 @@ from synapse.api.errors import (
from
synapse.api.room_versions
import
(
from
synapse.api.room_versions
import
(
KNOWN_ROOM_VERSIONS
,
KNOWN_ROOM_VERSIONS
,
EventFormatVersions
,
EventFormatVersions
,
RoomVersion
,
RoomVersions
,
RoomVersions
,
)
)
from
synapse.events
import
EventBase
,
builder
,
room_version_to_event_format
from
synapse.events
import
EventBase
,
builder
,
room_version_to_event_format
...
@@ -404,7 +405,7 @@ class FederationClient(FederationBase):
...
@@ -404,7 +405,7 @@ class FederationClient(FederationBase):
raise
SynapseError
(
502
,
"
Failed to %s via any server
"
%
(
description
,))
raise
SynapseError
(
502
,
"
Failed to %s via any server
"
%
(
description
,))
def
make_membership_event
(
async
def
make_membership_event
(
self
,
self
,
destinations
:
Iterable
[
str
],
destinations
:
Iterable
[
str
],
room_id
:
str
,
room_id
:
str
,
...
@@ -412,7 +413,7 @@ class FederationClient(FederationBase):
...
@@ -412,7 +413,7 @@ class FederationClient(FederationBase):
membership
:
str
,
membership
:
str
,
content
:
dict
,
content
:
dict
,
params
:
Dict
[
str
,
str
],
params
:
Dict
[
str
,
str
],
):
)
->
Tuple
[
str
,
EventBase
,
RoomVersion
]
:
"""
"""
Creates an m.room.member event, with context, without participating in the room.
Creates an m.room.member event, with context, without participating in the room.
...
@@ -433,19 +434,19 @@ class FederationClient(FederationBase):
...
@@ -433,19 +434,19 @@ class FederationClient(FederationBase):
content: Any additional data to put into the content field of the
content: Any additional data to put into the content field of the
event.
event.
params: Query parameters to include in the request.
params: Query parameters to include in the request.
Return:
Deferred[Tuple[str, FrozenEvent, RoomVersion]]: resolves to a tuple of
Returns:
`(origin, event, room_version)` where origin is the remote
`(origin, event, room_version)` where origin is the remote
homeserver which generated the event, and room_version is the
homeserver which generated the event, and room_version is the
version of the room.
version of the room.
Fails with a `UnsupportedRoomVersionError` if remote responds with
Raises:
a room version we don
'
t understand.
UnsupportedRoomVersionError: if remote responds with
a room version we don
'
t understand.
Fails with a ``SynapseError`` if the chosen remote server
SynapseError: if the chosen remote server returns a 300/400 code.
returns a 300/400 code.
Fails with a ``
RuntimeError
``
if no servers were reachable.
RuntimeError
:
if no servers were reachable.
"""
"""
valid_memberships
=
{
Membership
.
JOIN
,
Membership
.
LEAVE
}
valid_memberships
=
{
Membership
.
JOIN
,
Membership
.
LEAVE
}
if
membership
not
in
valid_memberships
:
if
membership
not
in
valid_memberships
:
...
@@ -491,7 +492,7 @@ class FederationClient(FederationBase):
...
@@ -491,7 +492,7 @@ class FederationClient(FederationBase):
return
(
destination
,
ev
,
room_version
)
return
(
destination
,
ev
,
room_version
)
return
self
.
_try_destination_list
(
return
await
self
.
_try_destination_list
(
"
make_
"
+
membership
,
destinations
,
send_request
"
make_
"
+
membership
,
destinations
,
send_request
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment