diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index 87eecc9818b2eb2b2cc97a258f3d1b5e99e182ff..0525dd565a712ab869f7bbe6e4d3aaaf3a4a1af8 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -104,7 +104,7 @@ module SGXbwmsgsv2 client.register_handler_before(type, *guards, &block) end - def self.send_media(from, to, media_url, desc=nil, subject=nil) + def self.send_media(from, to, media_url, desc=nil, subject=nil, m=nil) # we assume media_url is of the form (always the case so far): # https://messaging.bandwidth.com/api/v2/users/[u]/media/[path] @@ -117,6 +117,10 @@ module SGXbwmsgsv2 # put URL in the body (so Conversations will still see it)... msg = Blather::Stanza::Message.new(to, proxy_url) + if m + msg = m + msg.body = proxy_url + end msg.from = from msg.subject = subject if subject @@ -917,7 +921,8 @@ class WebhookHandler < Goliath::API SGXbwmsgsv2.send_media( others_num + '@' + ARGV[0], - bare_jid, media_url + bare_jid, media_url, + nil, nil, msg.copy ) end end unless not jparams['media']