slixmpp/sleekxmpp/xmlstream/handler/waiter.py
Nathan Fritz 07018c0afa * fixed many stanza bugs
* added stanza unhandled (unhandled iqs now reply with feature-not-implemented)
* added stanza exceptions (stanzas may now reply with exceptions when their handler raises an exception)
2009-12-17 01:54:22 +00:00

26 lines
546 B
Python

from . import base
import queue
import logging
from .. stanzabase import StanzaBase
class Waiter(base.BaseHandler):
def __init__(self, name, matcher):
base.BaseHandler.__init__(self, name, matcher)
self._payload = queue.Queue()
def prerun(self, payload):
self._payload.put(payload)
def run(self, payload):
pass
def wait(self, timeout=60):
try:
return self._payload.get(True, timeout)
except queue.Empty:
logging.warning("Timed out waiting for %s" % self.name)
return False
def checkDelete(self):
return True