Fix Matrix -> Telegram code block bridging
This commit is contained in:
@@ -143,7 +143,7 @@ class MatrixParser(HTMLParser):
|
||||
return indent
|
||||
|
||||
def _newline(self, allow_multi=False):
|
||||
if self._line_is_new or allow_multi:
|
||||
if self._line_is_new and not allow_multi:
|
||||
return
|
||||
self.text += "\n"
|
||||
self._line_is_new = True
|
||||
@@ -210,13 +210,13 @@ class MatrixParser(HTMLParser):
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
if tag in self.block_tags:
|
||||
self._newline(allow_multi=tag == "br")
|
||||
|
||||
entity = self._building_entities.pop(tag, None)
|
||||
if entity:
|
||||
self.entities.append(entity)
|
||||
|
||||
if tag in self.block_tags:
|
||||
self._newline(allow_multi=tag == "br")
|
||||
|
||||
|
||||
command_regex = re.compile("(\s|^)!([A-Za-z0-9@]+)")
|
||||
|
||||
|
||||
@@ -633,6 +633,7 @@ class Portal:
|
||||
else:
|
||||
self.log.debug("Unhandled Matrix event: %s", message)
|
||||
return
|
||||
self.log.debug("Handled Matrix message: %s", response)
|
||||
self.is_duplicate(response, (event_id, space))
|
||||
self.db.add(DBMessage(
|
||||
tgid=response.id,
|
||||
|
||||
Reference in New Issue
Block a user