Skip to content
Snippets Groups Projects
Commit 9cf9de2a authored by zimio's avatar zimio
Browse files

Created Acks builder class

parent eccdc14a
No related branches found
No related tags found
No related merge requests found
......@@ -143,6 +143,7 @@ NS_DATA_LAYOUT = 'http://jabber.org/protocol/xdata-layout' # XEP-0141
NS_DATA_VALIDATE = 'http://jabber.org/protocol/xdata-validate' # XEP-0122
NS_XMPP_STREAMS = 'urn:ietf:params:xml:ns:xmpp-streams'
NS_RECEIPTS = 'urn:xmpp:receipts'
NS_STREAM_MGMT = 'urn:xmpp:sm:3' # XEP-198
xmpp_stream_error_conditions = '''
bad-format -- -- -- The entity has sent XML that cannot be processed.
......@@ -978,6 +979,35 @@ class Iq(Protocol):
iq.setQueryNS(self.getQueryNS())
return iq
class Acks(Node):
"""
Acknowledgement elements for Stream Management
"""
def __init__(self, nsp=NS_STREAM_MGMT):
Node.__init__(self, None, {}, [], None, None,False, None)
self.setNamespace(nsp)
def buildAnswer(self, handled): # handled is the number of stanzas handled
self.setName('a')
self.setAttr('h', handled)
def buildRequest(self):
self.setName('r')
def buildEnable(self, resume=False):
self.setName('enable')
if resume:
self.setAttr('resume', 'true')
def buildResume(self, handled, previd):
self.setName('resume')
self.setAttr('h', handled)
self.setAttr('previd', previd)
class ErrorNode(Node):
"""
XMPP-style error element
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment