diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-05-04 20:44:10 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-05-04 21:05:47 +0200 |
commit | d78b7df68b452bd81af153e285224fc568962af4 (patch) | |
tree | 5f6a5e22651231a087308e0d78f9aa686141c775 /src/tabs | |
parent | bbc55fa40eaaed6bb57fddd2e9cc5eb1d3baa8cc (diff) | |
download | poezio-d78b7df68b452bd81af153e285224fc568962af4.tar.gz poezio-d78b7df68b452bd81af153e285224fc568962af4.tar.bz2 poezio-d78b7df68b452bd81af153e285224fc568962af4.tar.xz poezio-d78b7df68b452bd81af153e285224fc568962af4.zip |
Implement the execution of ad-hoc commands (#1832)
Diffstat (limited to 'src/tabs')
-rw-r--r-- | src/tabs/adhoc_commands_list.py | 12 | ||||
-rw-r--r-- | src/tabs/data_forms.py | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/tabs/adhoc_commands_list.py b/src/tabs/adhoc_commands_list.py index d0504677..76cd941a 100644 --- a/src/tabs/adhoc_commands_list.py +++ b/src/tabs/adhoc_commands_list.py @@ -25,12 +25,14 @@ class AdhocCommandsListTab(ListTab): self.key_func['^M'] = self.execute_selected_command def execute_selected_command(self): - row = self.listview.get_selected_row() - log.debug("Executing command %s", row) + node, name, jid = self.listview.get_selected_row() + session = {'next': self.core.on_next_adhoc_step, + 'error': self.core.on_adhoc_error} + self.core.xmpp.plugin['xep_0050'].start_command(jid, node, session) def get_columns_sizes(self): - return {'Node': int(self.width * 2 / 8), - 'Description': int(self.width * 6 / 8)} + return {'Node': int(self.width * 3 / 8), + 'Description': int(self.width * 5 / 8)} def on_list_received(self, iq): """ @@ -39,14 +41,12 @@ class AdhocCommandsListTab(ListTab): if iq['type'] == 'error': self.set_error(iq['error']['type'], iq['error']['code'], iq['error']['text']) return - log.debug("iq: %s", iq) def get_items(): substanza = iq['disco_items'] for item in substanza['substanzas']: if isinstance(item, DiscoItem): yield item items = [(item['node'], item['name'] or '', item['jid']) for item in get_items()] - log.debug(items) self.listview.set_lines(items) self.info_header.message = _('Ad-hoc commands of JID %s') % self.name if self.core.current_tab() is self: diff --git a/src/tabs/data_forms.py b/src/tabs/data_forms.py index ecd28e33..44c29e6c 100644 --- a/src/tabs/data_forms.py +++ b/src/tabs/data_forms.py @@ -44,13 +44,13 @@ class DataFormsTab(Tab): self.update_commands() def on_cancel(self): - self._on_cancel(self._form) + self._on_cancel(self._form, **self._kwargs) return True def on_send(self): self._form.reply() self.form_win.reply() - self._on_send(self._form) + self._on_send(self._form, **self._kwargs) return True def on_input(self, key, raw=False): |