mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
added some xep-0004 compatibility changes
This commit is contained in:
parent
d150b35464
commit
eb9e72fe3e
2 changed files with 17 additions and 1 deletions
|
@ -40,7 +40,7 @@ class jobs(base.base_plugin):
|
|||
iq['psstate']['payload'] = state
|
||||
result = iq.send()
|
||||
if result is None or type(result) == types.BooleanType or result['type'] != 'result':
|
||||
logging.error("Unable to change %s:%s to %s" % (node, jobid, state))
|
||||
logging.error("Unable to change %s:%s to %s" % (node, jobid, state))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
|
|
@ -23,6 +23,15 @@ class Form(ElementBase):
|
|||
sub_interfaces = set(('title',))
|
||||
form_types = set(('cancel', 'form', 'result', 'submit'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
title = None
|
||||
if 'title' in kwargs:
|
||||
title = kwargs['title']
|
||||
del kwargs['title']
|
||||
ElementBase.__init__(self, *args, **kwargs)
|
||||
if title is not None:
|
||||
self['title'] = title
|
||||
|
||||
def setup(self, xml=None):
|
||||
if ElementBase.setup(self, xml): #if we had to generate xml
|
||||
self['type'] = 'form'
|
||||
|
@ -339,6 +348,13 @@ class xep_0004(base.base_plugin):
|
|||
registerStanzaPlugin(Form, FormField)
|
||||
registerStanzaPlugin(Message, Form)
|
||||
|
||||
def makeForm(self, ftype='form', title='', instructions=''):
|
||||
f = Form()
|
||||
f['type'] = ftype
|
||||
f['title'] = title
|
||||
f['instructions'] = instructions
|
||||
return f
|
||||
|
||||
def post_init(self):
|
||||
base.base_plugin.post_init(self)
|
||||
self.xmpp.plugin['xep_0030'].add_feature('jabber:x:data')
|
||||
|
|
Loading…
Reference in a new issue