cleanup/bugfixes

This commit is contained in:
2019-03-10 17:05:59 +01:00
parent 5f2e2e517d
commit 09c69468a8
2 changed files with 9 additions and 2 deletions

View File

@@ -109,6 +109,9 @@ class XMPPTelegram(ComponentXMPP):
"""
jid = iq['from'].bare
if iq['type'] == 'normal':
raise XMPPError(text="Sorry, this type of message is not supported")
if iq['to'] == self.config['jid'] and iq['type'] == 'chat': # message to gateway
if iq['body'].startswith('!'):
self.process_command(iq)
@@ -161,6 +164,8 @@ class XMPPTelegram(ComponentXMPP):
result = None
# detect media
#TODO: fix
#TODO: implement OOB for images
if msg.startswith('http') and re.match(r'(?:http\:|https\:)?\/\/.*\.(?:' + self.config['media_external_formats'] + ')', msg):
urls = re.findall(r'(?:http\:|https\:)?\/\/.*\.(?:' + self.config['media_external_formats'] + ')', msg)
message = msg.replace(urls[0], '')