From dea9879dfab290b6661fdc649fc053abb338c1f2 Mon Sep 17 00:00:00 2001 From: Tomasz Melcer Date: Sat, 6 Jan 2007 19:05:45 +0000 Subject: [PATCH] Commands: dataforms sent have type="submit"; commands' window show form title --- src/adhoc_commands.py | 7 +++++++ src/common/commands.py | 4 +++- src/common/dataforms.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/adhoc_commands.py b/src/adhoc_commands.py index c0c12223e..49f51d8d7 100644 --- a/src/adhoc_commands.py +++ b/src/adhoc_commands.py @@ -266,6 +266,8 @@ class CommandWindow: self.data_form_widget.set_sensitive(False) if self.data_form_widget.get_data_form() is None: self.data_form_widget.hide() + else: + self.data_form_widget.data_form.type='submit' self.close_button.set_sensitive(True) self.back_button.set_sensitive(False) @@ -296,7 +298,11 @@ class CommandWindow: except dataforms.Error: # FIXME: translate self.stage5(error='Service sent malformed data', senderror=True) + return self.data_form_widget.show() + if self.data_form_widget.title: + self.window.set_title("%s - Ad-hoc Commands - Gajim" % \ + self.data_form_widget.title) else: self.data_form_widget.hide() @@ -465,6 +471,7 @@ class CommandWindow: if self.data_form_widget.data_form is not None: # cmdnode.addChild(node=dataforms.DataForm(tofill=self.data_form_widget.data_form)) # FIXME: simplified form to send + cmdnode.addChild(node=self.data_form_widget.data_form) def callback(response): diff --git a/src/common/commands.py b/src/common/commands.py index 20c9127ee..6240a573a 100644 --- a/src/common/commands.py +++ b/src/common/commands.py @@ -128,7 +128,9 @@ class ChangeStatusCommand(AdHocCommand): response, cmd = self.buildResponse(request, status='completed') cmd.addChild('note', {}, 'The status has been changed.') - self.connection.connection.send(response) + # if going offline, we need to push response so it won't go into + # queue and disappear + self.connection.connection.send(response, presencetype=='offline') # send new status gajim.interface.roster.send_status(self.connection.name, presencetype, presencedesc) diff --git a/src/common/dataforms.py b/src/common/dataforms.py index e5d249244..8dc778cf2 100644 --- a/src/common/dataforms.py +++ b/src/common/dataforms.py @@ -341,7 +341,7 @@ class DataForm(ExtendedNode): filledform = DataForm(replyto=thisform)...''' def fget(self): return self.getAttr('type') - def fset(self): + def fset(self, type): assert type in ('form', 'submit', 'cancel', 'result') self.setAttr('type', type) return locals()