Try to prevent infinite loop of state changes with double puppeting
Fixes #464
This commit is contained in:
@@ -392,6 +392,11 @@ class MatrixHandler(BaseMatrixHandler):
|
||||
def filter_matrix_event(self, evt: Event) -> bool:
|
||||
if not isinstance(evt, (RedactionEvent, MessageEvent, StateEvent, EncryptedEvent)):
|
||||
return True
|
||||
if evt.content.get("net.maunium.telegram.puppet", False):
|
||||
puppet = pu.Puppet.get_by_custom_mxid(evt.sender)
|
||||
if puppet:
|
||||
self.log.debug("Ignoring puppet-sent event %s", evt.event_id)
|
||||
return True
|
||||
return evt.sender and (evt.sender == self.az.bot_mxid
|
||||
or pu.Puppet.get_id_from_mxid(evt.sender) is not None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user