diff options
author | mrDoctorWho <mrdoctorwho@gmail.com> | 2014-09-01 12:17:56 +0400 |
---|---|---|
committer | mrDoctorWho <mrdoctorwho@gmail.com> | 2014-09-01 12:17:56 +0400 |
commit | 21b998ac45435545caf0ca4a881b1cbfa4dd40c2 (patch) | |
tree | beddf3f42cb3a2ab06d724513df84b4adb79925f | |
parent | 1acb471d2e3ea18c0f3bd404b8486f132b9032c1 (diff) |
add: Advanced fields support
add: Advanced buildReply() tags in Iq
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | xmpp/protocol.py | 18 |
2 files changed, 11 insertions, 9 deletions
@@ -1,4 +1,4 @@ xmpppy ====== -Just another fork of xmpppy library. Provides full compability with standart xmpppy but also have a lot of security fixes.
\ No newline at end of file +Just another fork of xmpppy library. Provides full compability with standart xmpppy but also have a couple of security and performance fixes.
\ No newline at end of file diff --git a/xmpp/protocol.py b/xmpp/protocol.py index 2260d6d..7c70784 100644 --- a/xmpp/protocol.py +++ b/xmpp/protocol.py @@ -912,6 +912,8 @@ class Iq(Protocol): iq = Iq(typ, to=self.getFrom(), frm=self.getTo(), attrs={"id": self.getID()})
if self.getTag("query"):
iq.setQueryNS(self.getQueryNS())
+ if self.getTagAttr("query", "node"):
+ iq.setQuerynode(self.getQuerynode())
return iq
class ErrorNode(Node):
@@ -992,8 +994,8 @@ class DataField(Node): self.setValue(value)
if typ:
self.setType(typ)
- elif not typ and not node:
- self.setType("text-single")
+# elif not typ and not node:
+# self.setType("text-single")
if required:
self.setRequired(required)
if label:
@@ -1162,14 +1164,14 @@ class DataReported(Node): """
return self.getTag("field", attrs={"var": name})
- def setField(self, name, typ=None, label=None):
+ def setField(self, name, typ=None, label=None, options=[]):
"""
Create if nessessary or get the existing datafield object with name "name" and return it.
If created, attributes "type" and "label" are applied to new datafield.
"""
field = self.getField(name)
if not field:
- field = self.addChild(node=DataField(name, None, typ, 0, label))
+ field = self.addChild(node=DataField(name, None, typ, 0, label, options=options))
return field
def asDict(self):
@@ -1234,13 +1236,13 @@ class DataItem(Node): """
return self.getTag("field", attrs={"var": name})
- def setField(self, name, value=None, typ=None):
+ def setField(self, name, value=None, typ=None, options=[]):
"""
Create if nessessary or get the existing datafield object with name "name" and return it.
"""
field = self.getField(name)
if not field:
- field = self.addChild(node=DataField(name, value, typ))
+ field = self.addChild(node=DataField(name, value, typ, options=options))
return field
def asDict(self):
@@ -1381,13 +1383,13 @@ class DataForm(Node): """
return self.getTag("field", attrs={"var": name})
- def setField(self, name, value=None, typ=None):
+ def setField(self, name, value=None, typ=None, options=[]):
"""
Create if nessessary or get the existing datafield object with name "name" and return it.
"""
field = self.getField(name)
if not field:
- field = self.addChild(node=DataField(name, value, typ))
+ field = self.addChild(node=DataField(name, value, typ, options=options))
return field
def asDict(self):
|