summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/handler/waiter.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/xmlstream/handler/waiter.py')
-rw-r--r--sleekxmpp/xmlstream/handler/waiter.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/sleekxmpp/xmlstream/handler/waiter.py b/sleekxmpp/xmlstream/handler/waiter.py
new file mode 100644
index 00000000..7c06ddf1
--- /dev/null
+++ b/sleekxmpp/xmlstream/handler/waiter.py
@@ -0,0 +1,21 @@
+from . import base
+import Queue
+import logging
+
+class Waiter(base.BaseHandler):
+
+ def __init__(self, name, matcher):
+ base.BaseHandler.__init__(self, name, matcher)
+ self._payload = Queue.Queue()
+
+ def run(self, payload):
+ self._payload.put(payload)
+
+ def wait(self, timeout=60):
+ try:
+ return self._payload.get(True, timeout)
+ except Queue.Empty:
+ return False
+
+ def checkDelete(self):
+ return True