From 3da29896dfa48c2fcacbb06e4234357bd2c99a7c Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 5 May 2021 15:37:33 +0200 Subject: [PATCH] plugin XEP-0050: show notes when there is a data form on completed command: Notes are now added on completed command, as text widgets. --- sat/plugins/plugin_xep_0050.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sat/plugins/plugin_xep_0050.py b/sat/plugins/plugin_xep_0050.py index cbc08159..64bf390f 100644 --- a/sat/plugins/plugin_xep_0050.py +++ b/sat/plugins/plugin_xep_0050.py @@ -483,7 +483,14 @@ class XEP_0050(object): ) if session_id is None: - return xml_tools.dataFormEltResult2XMLUI(data_elt) + xmlui = xml_tools.dataFormEltResult2XMLUI(data_elt) + if notes: + for level, note in notes: + if level != "info": + note = f"[{level}] {note}" + xmlui.addWidget("text", note) + return xmlui + form = data_form.Form.fromElement(data_elt) # we add any present note to the instructions form.instructions.extend(self._mergeNotes(notes))