summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/handler/waiter.py
blob: 7c06ddf19c4bcc82953227f72f69f90c882d587a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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