summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0332
diff options
context:
space:
mode:
authorSangeeth Saravanaraj <sangeeth@riptideio.com>2015-02-03 12:33:25 +0530
committerSangeeth Saravanaraj <sangeeth@riptideio.com>2015-02-03 12:33:25 +0530
commitc16b86220047e2a2b77c585d6b0d72f5087c1371 (patch)
tree965bcfdd31cd2b2665b14219ef458d69bb5c5b30 /sleekxmpp/plugins/xep_0332
parenta96f608469e74d39d3e7a2a86399dbb724ffadec (diff)
downloadslixmpp-c16b86220047e2a2b77c585d6b0d72f5087c1371.tar.gz
slixmpp-c16b86220047e2a2b77c585d6b0d72f5087c1371.tar.bz2
slixmpp-c16b86220047e2a2b77c585d6b0d72f5087c1371.tar.xz
slixmpp-c16b86220047e2a2b77c585d6b0d72f5087c1371.zip
Raise http_request and http_response events.
Diffstat (limited to 'sleekxmpp/plugins/xep_0332')
-rw-r--r--sleekxmpp/plugins/xep_0332/http.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0332/http.py b/sleekxmpp/plugins/xep_0332/http.py
index 166e6ec3..06ba1477 100644
--- a/sleekxmpp/plugins/xep_0332/http.py
+++ b/sleekxmpp/plugins/xep_0332/http.py
@@ -91,10 +91,12 @@ class XEP_0332(BasePlugin):
def _handle_request(self, iq):
log.debug("XEP_0332:: _handle_request()")
print iq
+ self.xmpp.event('http_request', iq)
def _handle_response(self, iq):
log.debug("XEP_0332:: _handle_response()")
print iq
+ self.xmpp.event('http_response', iq)
def send_request(self, to=None, method=None, resource=None, headers=None,
data=None, **kwargs):
@@ -107,12 +109,13 @@ class XEP_0332(BasePlugin):
iq['req']['method'] = method
iq['req']['resource'] = resource
iq['req']['version'] = '1.1' # TODO: set this implicitly
- iq['req']['data'] = data
+ if data:
+ iq['req']['data'] = data
print iq
- # return iq.send(timeout=kwargs.get('timeout', None),
- # block=kwargs.get('block', True),
- # callback=kwargs.get('callback', None),
- # timeout_callback=kwargs.get('timeout_callback', None))
+ return iq.send(timeout=kwargs.get('timeout', None),
+ block=kwargs.get('block', True),
+ callback=kwargs.get('callback', None),
+ timeout_callback=kwargs.get('timeout_callback', None))
def send_response(self, to=None, code=None, headers=None, data=None,
**kwargs):
@@ -124,7 +127,8 @@ class XEP_0332(BasePlugin):
iq['resp']['headers'] = headers
iq['resp']['code'] = code
iq['resp']['version'] = '1.1' # TODO: set this implicitly
- iq['resp']['data'] = data
+ if data:
+ iq['resp']['data'] = data
print iq
# return iq.send(timeout=kwargs.get('timeout', None),
# block=kwargs.get('block', True),