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

Leave group #245

Merged
merged 4 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mausignald/signald.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ async def join_group(self, username: str, uri: str) -> JoinGroupResponse:
resp = await self.request_v1("join_group", account=username, uri=uri)
return JoinGroupResponse.deserialize(resp)

async def leave_group(self, username: str, group_id: GroupID) -> None:
await self.request_v1("leave_group", account=username, groupID=group_id)

async def update_group(
self,
username: str,
Expand Down
1 change: 1 addition & 0 deletions mautrix_signal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def do_update(self, helper: ConfigUpdateHelper) -> None:

copy("bridge.relay.enabled")
copy_dict("bridge.relay.message_formats")
copy("bridge.bridge_matrix_leave")

def _get_permissions(self, key: str) -> Permissions:
level = self["bridge.permissions"].get(key, "")
Expand Down
2 changes: 2 additions & 0 deletions mautrix_signal/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ bridge:
resend_bridge_info: false
# Interval at which to resync contacts (in seconds).
periodic_sync: 0
# Should leaving the room on Matrix make the user leave on Signal?
bridge_matrix_leave: true

# Provisioning API part of the web server for automated portal creation and fetching information.
# Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager).
Expand Down
2 changes: 2 additions & 0 deletions mautrix_signal/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,8 @@ async def handle_matrix_leave(self, user: u.User) -> None:
await self.cleanup_and_delete()
else:
self.log.debug(f"{user.mxid} left portal to {self.chat_id}")
if self.config["bridge.bridge_matrix_leave"]:
await self.signal.leave_group(user.username, self.chat_id)
# TODO cleanup if empty

async def handle_matrix_name(self, user: u.User, name: str) -> None:
Expand Down