forked from MirrorHub/synapse
Update federation client pokes
This commit is contained in:
parent
e5ea6dd021
commit
332839f6ea
1 changed files with 22 additions and 13 deletions
|
@ -16,6 +16,7 @@
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.errors import SynapseError
|
from synapse.api.errors import SynapseError
|
||||||
|
from synapse.types import get_domain_from_id
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -41,8 +42,11 @@ def _create_rerouter(func_name):
|
||||||
return getattr(self.groups_server_handler, func_name)(
|
return getattr(self.groups_server_handler, func_name)(
|
||||||
group_id, *args, **kwargs
|
group_id, *args, **kwargs
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
return getattr(self.transport_client, func_name)(group_id, *args, **kwargs)
|
destination = get_domain_from_id(group_id)
|
||||||
|
return getattr(self.transport_client, func_name)(
|
||||||
|
destination, group_id, *args, **kwargs
|
||||||
|
)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +102,9 @@ class GroupsLocalHandler(object):
|
||||||
)
|
)
|
||||||
defer.returnValue(res)
|
defer.returnValue(res)
|
||||||
|
|
||||||
res = yield self.transport_client.get_group_summary(group_id, requester_user_id)
|
res = yield self.transport_client.get_group_summary(
|
||||||
|
get_domain_from_id(group_id), group_id, requester_user_id,
|
||||||
|
)
|
||||||
|
|
||||||
# Loop through the users and validate the attestations.
|
# Loop through the users and validate the attestations.
|
||||||
chunk = res["users_section"]["users"]
|
chunk = res["users_section"]["users"]
|
||||||
|
@ -131,7 +137,9 @@ class GroupsLocalHandler(object):
|
||||||
group_id, user_id, content
|
group_id, user_id, content
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.transport_client.create_group(group_id, user_id, content) # TODO
|
return self.transport_client.create_group(
|
||||||
|
get_domain_from_id(group_id), group_id, user_id, content,
|
||||||
|
) # TODO
|
||||||
|
|
||||||
def add_room(self, group_id, user_id, room_id, content):
|
def add_room(self, group_id, user_id, room_id, content):
|
||||||
if self.is_mine_id(group_id):
|
if self.is_mine_id(group_id):
|
||||||
|
@ -140,8 +148,8 @@ class GroupsLocalHandler(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.transport_client.add_room_to_group(
|
return self.transport_client.add_room_to_group(
|
||||||
group_id, user_id, room_id, content,
|
get_domain_from_id(group_id), group_id, user_id, room_id, content,
|
||||||
) # TODO
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_users_in_group(self, group_id, requester_user_id):
|
def get_users_in_group(self, group_id, requester_user_id):
|
||||||
|
@ -151,9 +159,9 @@ class GroupsLocalHandler(object):
|
||||||
)
|
)
|
||||||
defer.returnValue(res)
|
defer.returnValue(res)
|
||||||
|
|
||||||
res = yield self.transport_client.get_users_in_group(
|
res = yield self.transport_client.get_group_users(
|
||||||
group_id, requester_user_id,
|
get_domain_from_id(group_id), group_id, requester_user_id,
|
||||||
) # TODO
|
)
|
||||||
|
|
||||||
chunk = res["chunk"]
|
chunk = res["chunk"]
|
||||||
valid_entries = []
|
valid_entries = []
|
||||||
|
@ -191,7 +199,7 @@ class GroupsLocalHandler(object):
|
||||||
content["attestation"] = local_attestation
|
content["attestation"] = local_attestation
|
||||||
|
|
||||||
res = yield self.transport_client.accept_group_invite(
|
res = yield self.transport_client.accept_group_invite(
|
||||||
group_id, user_id, content,
|
get_domain_from_id(group_id), group_id, user_id, content,
|
||||||
)
|
)
|
||||||
|
|
||||||
remote_attestation = res["attestation"]
|
remote_attestation = res["attestation"]
|
||||||
|
@ -224,7 +232,8 @@ class GroupsLocalHandler(object):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
res = yield self.transport_client.invite_to_group(
|
res = yield self.transport_client.invite_to_group(
|
||||||
group_id, user_id, requester_user_id, content,
|
get_domain_from_id(group_id), group_id, user_id, requester_user_id,
|
||||||
|
content,
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue(res)
|
defer.returnValue(res)
|
||||||
|
@ -269,8 +278,8 @@ class GroupsLocalHandler(object):
|
||||||
else:
|
else:
|
||||||
content["requester_user_id"] = requester_user_id
|
content["requester_user_id"] = requester_user_id
|
||||||
res = yield self.transport_client.remove_user_from_group(
|
res = yield self.transport_client.remove_user_from_group(
|
||||||
group_id, user_id, content
|
get_domain_from_id(group_id), group_id, user_id, content
|
||||||
) # TODO
|
)
|
||||||
|
|
||||||
defer.returnValue(res)
|
defer.returnValue(res)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue