This commit is contained in:
rnhmjoj 2017-02-27 00:18:10 +01:00
parent bc3be91376
commit 32076079c6
No known key found for this signature in database
GPG Key ID: 362BB82B7E496B7C

View File

@ -77,14 +77,6 @@ class Matrix extends Adapter
url: imageURL url: imageURL
send: (envelope, lines...) ->
[..., last] = lines
if typeof last is 'function'
callback = lines.pop()
syn.eachSeries lines, (@handleURL envelope), ->
callback() if callback?
sendText: (envelope, text, callback) -> sendText: (envelope, text, callback) ->
@client.sendNotice(envelope.room.id, text).catch (err) => @client.sendNotice(envelope.room.id, text).catch (err) =>
if err.name == 'UnknownDeviceError' if err.name == 'UnknownDeviceError'
@ -95,7 +87,12 @@ class Matrix extends Adapter
sendImage: (envelope, buffer, info, callback) -> sendImage: (envelope, buffer, info, callback) ->
try try
@client.uploadContent(buffer, name: info.url, type: info.mimetype, rawResponse: false, onlyContentUri: true).done (content_uri) => @client.uploadContent(buffer,
name: info.url
type: info.mimetype
rawResponse: false
onlyContentUri: true
).done (content_uri) =>
@client.sendImageMessage(envelope.room.id, content_uri, info, info.url).catch (err) => @client.sendImageMessage(envelope.room.id, content_uri, info, info.url).catch (err) =>
if err.name == 'UnknownDeviceError' if err.name == 'UnknownDeviceError'
@handleUnknownDevices err @handleUnknownDevices err
@ -107,6 +104,14 @@ class Matrix extends Adapter
callback() if callback? callback() if callback?
send: (envelope, lines...) ->
[..., last] = lines
if typeof last is 'function'
callback = lines.pop()
syn.eachSeries lines, (@handleURL envelope), ->
callback() if callback?
emote: (envelope, lines...) -> emote: (envelope, lines...) ->
for line in lines for line in lines
@client.sendEmoteMessage(envelope.room.id, line).catch (err) => @client.sendEmoteMessage(envelope.room.id, line).catch (err) =>