Set history & join rules to match KakaoTalk behaviour
This commit is contained in:
parent
2be6a761b6
commit
73f8792b75
|
@ -30,6 +30,10 @@ class KnownChannelType(str, Enum):
|
||||||
def is_direct(cls, value: Union["KnownChannelType", str]) -> bool:
|
def is_direct(cls, value: Union["KnownChannelType", str]) -> bool:
|
||||||
return value in [cls.DirectChat, cls.MemoChat]
|
return value in [cls.DirectChat, cls.MemoChat]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def is_open(cls, value: Union["KnownChannelType", str]) -> bool:
|
||||||
|
return value in [cls.OM, cls.OD]
|
||||||
|
|
||||||
|
|
||||||
ChannelType = Union[KnownChannelType, str] # Substitute for ChannelType = "name1" | ... | "nameN" | str
|
ChannelType = Union[KnownChannelType, str] # Substitute for ChannelType = "name1" | ... | "nameN" | str
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ from mautrix.types import (
|
||||||
EventType,
|
EventType,
|
||||||
FileInfo,
|
FileInfo,
|
||||||
ImageInfo,
|
ImageInfo,
|
||||||
|
JoinRule,
|
||||||
|
JoinRulesStateEventContent,
|
||||||
LocationMessageEventContent,
|
LocationMessageEventContent,
|
||||||
MediaInfo,
|
MediaInfo,
|
||||||
MediaMessageEventContent,
|
MediaMessageEventContent,
|
||||||
|
@ -630,6 +632,17 @@ class Portal(DBPortal, BasePortal):
|
||||||
"content": self.bridge_info,
|
"content": self.bridge_info,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
if KnownChannelType.is_open(info.channel_info.type):
|
||||||
|
initial_state.extend((
|
||||||
|
{
|
||||||
|
"type": str(EventType.ROOM_JOIN_RULES),
|
||||||
|
"content": JoinRulesStateEventContent(join_rule=JoinRule.PUBLIC).serialize(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "m.room.guest_access",
|
||||||
|
"content": {"guest_access": "forbidden"},
|
||||||
|
},
|
||||||
|
))
|
||||||
invites = []
|
invites = []
|
||||||
if self.config["bridge.encryption.default"] and self.matrix.e2ee:
|
if self.config["bridge.encryption.default"] and self.matrix.e2ee:
|
||||||
self.encrypted = True
|
self.encrypted = True
|
||||||
|
|
Loading…
Reference in New Issue