Add option to not make publicly joinable channels public on Matrix. Fixes #128

This commit is contained in:
Tulir Asokan
2018-04-28 21:39:43 +03:00
parent c87f410d3e
commit 8da06c969c
3 changed files with 6 additions and 2 deletions
+2
View File
@@ -98,6 +98,8 @@ bridge:
# Only enable this if your displayname_template has some static part that the bridge can use to
# reliably identify what is a plaintext highlight.
plaintext_highlights: false
# Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
public_portals: true
# The prefix for commands. Only required in non-management rooms.
command_prefix: "!tg"
+1
View File
@@ -175,6 +175,7 @@ class Config(DictWithRecursion):
copy("bridge.allow_matrix_login")
copy("bridge.inline_images")
copy("bridge.plaintext_highlights")
copy("bridge.public_portals")
copy("bridge.command_prefix")
+3 -2
View File
@@ -244,7 +244,7 @@ class Portal:
self._main_intent = puppet.intent if direct else self.az.intent
if self.peer_type == "channel" and entity.username:
public = True
public = config["bridge.public_portals"]
alias = self._get_alias_localpart(entity.username)
self.username = entity.username
else:
@@ -403,7 +403,8 @@ class Portal:
self.username = username or None
if self.username:
await self.main_intent.add_room_alias(self.mxid, self._get_alias_localpart())
await self.main_intent.set_join_rule(self.mxid, "public")
if config["bridge.public_portals"]:
await self.main_intent.set_join_rule(self.mxid, "public")
else:
await self.main_intent.set_join_rule(self.mxid, "invite")