summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0004.py
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-08-19 19:53:56 -0700
committerNathan Fritz <nathan@andyet.net>2010-08-19 19:53:56 -0700
commiteb9e72fe3e0b125698cf91c3512ec9ecf4646ad8 (patch)
tree0f21d8bdf60e98f71c3aa51b12208f43c59901a8 /sleekxmpp/plugins/xep_0004.py
parentd150b35464742de7af9b3105bc7eeb55171b96ee (diff)
downloadslixmpp-eb9e72fe3e0b125698cf91c3512ec9ecf4646ad8.tar.gz
slixmpp-eb9e72fe3e0b125698cf91c3512ec9ecf4646ad8.tar.bz2
slixmpp-eb9e72fe3e0b125698cf91c3512ec9ecf4646ad8.tar.xz
slixmpp-eb9e72fe3e0b125698cf91c3512ec9ecf4646ad8.zip
added some xep-0004 compatibility changes
Diffstat (limited to 'sleekxmpp/plugins/xep_0004.py')
-rw-r--r--sleekxmpp/plugins/xep_0004.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0004.py b/sleekxmpp/plugins/xep_0004.py
index 037fc090..86963632 100644
--- a/sleekxmpp/plugins/xep_0004.py
+++ b/sleekxmpp/plugins/xep_0004.py
@@ -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')