summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0004.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2009-10-19 05:16:43 +0000
committerNathan Fritz <fritzy@netflint.net>2009-10-19 05:16:43 +0000
commit349b1c0b283cc417fe4a51da4d111a7118416cde (patch)
treef6591fa3f4fd60095c2c8b875853f0da8e9dd013 /sleekxmpp/plugins/xep_0004.py
parenta18051c1649bb4cef8b6d0b82f798051d6b21215 (diff)
downloadslixmpp-349b1c0b283cc417fe4a51da4d111a7118416cde.tar.gz
slixmpp-349b1c0b283cc417fe4a51da4d111a7118416cde.tar.bz2
slixmpp-349b1c0b283cc417fe4a51da4d111a7118416cde.tar.xz
slixmpp-349b1c0b283cc417fe4a51da4d111a7118416cde.zip
* added form merging
Diffstat (limited to 'sleekxmpp/plugins/xep_0004.py')
-rw-r--r--sleekxmpp/plugins/xep_0004.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0004.py b/sleekxmpp/plugins/xep_0004.py
index c85b09a5..ee6646fa 100644
--- a/sleekxmpp/plugins/xep_0004.py
+++ b/sleekxmpp/plugins/xep_0004.py
@@ -95,6 +95,19 @@ class Form(FieldContainer):
self.reported = []
self.items = []
+ def merge(self, form2):
+ form1 = Form(self.xmpp, self.type, self.title, self.instructions)
+ form1.fromXML(self.getXML(self.type))
+ for field in form2.fields:
+ if not field.var in form1.fields:
+ form1.addField(field.var, field.type, field.label, field.desc, field.required, field.value):
+ else:
+ form1.fields[field.var].value = field.value
+ for option, label in field.options:
+ if (option, label) not in form1.fields[field.var].options:
+ form1.fields[field.var].addOption(option, label)
+ return form1
+
def getValues(self):
result = {}
for field in self.fields: