mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-30 19:19:55 +00:00
05c9ea5c1d
* sleekxmpp no longer spawns threads for callback handlers -- there are now two threads: one for handlers and one for reading. callback handlers can get results from the read queue directly with the "wait" handler which is used in .send() for the reply catching argument.
24 lines
450 B
Python
24 lines
450 B
Python
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 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:
|
|
return False
|
|
|
|
def checkDelete(self):
|
|
return True
|