/upload to original tab and not current tab (thanks jonas)"
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
88db537027
commit
4f6bc9073e
2 changed files with 6 additions and 5 deletions
|
@ -29,8 +29,8 @@ class Plugin(BasePlugin):
|
||||||
help='Embed an image url into the contact\'s client',
|
help='Embed an image url into the contact\'s client',
|
||||||
usage='<image_url>')
|
usage='<image_url>')
|
||||||
|
|
||||||
def embed_image_url(self, url):
|
def embed_image_url(self, url, tab=None):
|
||||||
tab = self.api.current_tab()
|
tab = tab or self.api.current_tab()
|
||||||
message = self.core.xmpp.make_message(tab.jid)
|
message = self.core.xmpp.make_message(tab.jid)
|
||||||
message['body'] = url
|
message['body'] = url
|
||||||
message['oob']['url'] = url
|
message['oob']['url'] = url
|
||||||
|
|
|
@ -66,10 +66,10 @@ class Plugin(BasePlugin):
|
||||||
return None
|
return None
|
||||||
return url
|
return url
|
||||||
|
|
||||||
async def send_upload(self, filename):
|
async def send_upload(self, filename, tab):
|
||||||
url = await self.upload(filename)
|
url = await self.upload(filename)
|
||||||
if url is not None:
|
if url is not None:
|
||||||
self.embed.embed_image_url(url)
|
self.embed.embed_image_url(url, tab)
|
||||||
|
|
||||||
@command_args_parser.quoted(1)
|
@command_args_parser.quoted(1)
|
||||||
def command_upload(self, args):
|
def command_upload(self, args):
|
||||||
|
@ -78,7 +78,8 @@ class Plugin(BasePlugin):
|
||||||
return
|
return
|
||||||
filename, = args
|
filename, = args
|
||||||
filename = expanduser(filename)
|
filename = expanduser(filename)
|
||||||
asyncio.create_task(self.send_upload(filename))
|
tab = self.api.current_tab()
|
||||||
|
asyncio.create_task(self.send_upload(filename, tab))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def completion_filename(the_input):
|
def completion_filename(the_input):
|
||||||
|
|
Loading…
Reference in a new issue