Commands: dataforms sent have type="submit"; commands' window show form title

This commit is contained in:
Tomasz Melcer 2007-01-06 19:05:45 +00:00
parent 3be5a9df3b
commit dea9879dfa
3 changed files with 11 additions and 2 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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()