From 4f6bc9073ea24b911de038cbf94395789bf63fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Tue, 14 Dec 2021 11:05:58 +0100 Subject: /upload to original tab and not current tab (thanks jonas)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugins/embed.py | 4 ++-- plugins/upload.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/embed.py b/plugins/embed.py index 3ce2a9d3..4a68f035 100644 --- a/plugins/embed.py +++ b/plugins/embed.py @@ -29,8 +29,8 @@ class Plugin(BasePlugin): help='Embed an image url into the contact\'s client', usage='') - def embed_image_url(self, url): - tab = self.api.current_tab() + def embed_image_url(self, url, tab=None): + tab = tab or self.api.current_tab() message = self.core.xmpp.make_message(tab.jid) message['body'] = url message['oob']['url'] = url diff --git a/plugins/upload.py b/plugins/upload.py index 9a70a965..fbf41034 100644 --- a/plugins/upload.py +++ b/plugins/upload.py @@ -66,10 +66,10 @@ class Plugin(BasePlugin): return None return url - async def send_upload(self, filename): + async def send_upload(self, filename, tab): url = await self.upload(filename) if url is not None: - self.embed.embed_image_url(url) + self.embed.embed_image_url(url, tab) @command_args_parser.quoted(1) def command_upload(self, args): @@ -78,7 +78,8 @@ class Plugin(BasePlugin): return filename, = args filename = expanduser(filename) - asyncio.create_task(self.send_upload(filename)) + tab = self.api.current_tab() + asyncio.create_task(self.send_upload(filename, tab)) @staticmethod def completion_filename(the_input): -- cgit v1.2.3