mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Continue converting to underscored names.
This commit is contained in:
parent
4375ac7d8b
commit
e18354ae0e
3 changed files with 15 additions and 13 deletions
|
@ -25,10 +25,10 @@ class BaseHandler(object):
|
||||||
stream -- The stream this handler is assigned to.
|
stream -- The stream this handler is assigned to.
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
match -- Compare a stanza with the handler's matcher.
|
match -- Compare a stanza with the handler's matcher.
|
||||||
prerun -- Handler execution during stream processing.
|
prerun -- Handler execution during stream processing.
|
||||||
run -- Handler execution during the main event loop.
|
run -- Handler execution during the main event loop.
|
||||||
checkDelete -- Indicate if the handler may be removed from use.
|
check_delete -- Indicate if the handler may be removed from use.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, matcher, stream=None):
|
def __init__(self, name, matcher, stream=None):
|
||||||
|
@ -42,6 +42,8 @@ class BaseHandler(object):
|
||||||
this handler.
|
this handler.
|
||||||
stream -- The XMLStream instance the handler should monitor.
|
stream -- The XMLStream instance the handler should monitor.
|
||||||
"""
|
"""
|
||||||
|
self.checkDelete = self.check_delete
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.stream = stream
|
self.stream = stream
|
||||||
self._destroy = False
|
self._destroy = False
|
||||||
|
@ -79,7 +81,7 @@ class BaseHandler(object):
|
||||||
"""
|
"""
|
||||||
self._payload = payload
|
self._payload = payload
|
||||||
|
|
||||||
def checkDelete(self):
|
def check_delete(self):
|
||||||
"""
|
"""
|
||||||
Check if the handler should be removed from the list of stream
|
Check if the handler should be removed from the list of stream
|
||||||
handlers.
|
handlers.
|
||||||
|
|
|
@ -25,11 +25,11 @@ class Waiter(BaseHandler):
|
||||||
waiter has timed out.
|
waiter has timed out.
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
checkDelete -- Overrides BaseHandler.checkDelete
|
check_delete -- Overrides BaseHandler.check_delete
|
||||||
prerun -- Overrides BaseHandler.prerun
|
prerun -- Overrides BaseHandler.prerun
|
||||||
run -- Overrides BaseHandler.run
|
run -- Overrides BaseHandler.run
|
||||||
wait -- Wait for a stanza to arrive and return it to
|
wait -- Wait for a stanza to arrive and return it to
|
||||||
an event handler.
|
an event handler.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, matcher, stream=None):
|
def __init__(self, name, matcher, stream=None):
|
||||||
|
@ -89,10 +89,10 @@ class Waiter(BaseHandler):
|
||||||
self.stream.removeHandler(self.name)
|
self.stream.removeHandler(self.name)
|
||||||
return stanza
|
return stanza
|
||||||
|
|
||||||
def checkDelete(self):
|
def check_delete(self):
|
||||||
"""
|
"""
|
||||||
Always remove waiters after use.
|
Always remove waiters after use.
|
||||||
|
|
||||||
Overrides BaseHandler.checkDelete
|
Overrides BaseHandler.check_delete
|
||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -755,7 +755,7 @@ class XMLStream(object):
|
||||||
handler.prerun(stanza_copy)
|
handler.prerun(stanza_copy)
|
||||||
self.event_queue.put(('stanza', handler, stanza_copy))
|
self.event_queue.put(('stanza', handler, stanza_copy))
|
||||||
try:
|
try:
|
||||||
if handler.checkDelete():
|
if handler.check_delete():
|
||||||
self.__handlers.pop(self.__handlers.index(handler))
|
self.__handlers.pop(self.__handlers.index(handler))
|
||||||
except:
|
except:
|
||||||
pass # not thread safe
|
pass # not thread safe
|
||||||
|
|
Loading…
Reference in a new issue