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