mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
This commit is contained in:
commit
5769935720
2 changed files with 272 additions and 262 deletions
|
@ -241,8 +241,7 @@ class xep_0030(base.base_plugin):
|
|||
A default handler for disco#info requests. If another
|
||||
handler is registered, this one will defer and not run.
|
||||
"""
|
||||
handlers = self.xmpp.event_handlers['disco_info_request']
|
||||
if not forwarded and len(handlers) > 1:
|
||||
if not forwarded and self.xmpp.event_handled('disco_info_request'):
|
||||
return
|
||||
|
||||
node_name = iq['disco_info']['node']
|
||||
|
@ -270,8 +269,7 @@ class xep_0030(base.base_plugin):
|
|||
If this handler is called by your own custom handler with
|
||||
forwarded set to True, then it will run as normal.
|
||||
"""
|
||||
handlers = self.xmpp.event_handlers['disco_items_request']
|
||||
if not forwarded and len(handlers) > 1:
|
||||
if not forwarded and self.xmpp.event_handled('disco_items_request'):
|
||||
return
|
||||
|
||||
node_name = iq['disco_items']['node']
|
||||
|
|
|
@ -379,6 +379,7 @@ class XMLStream(object):
|
|||
"""
|
||||
if self.ssl_support:
|
||||
logging.info("Negotiating TLS")
|
||||
logging.info("Using SSL version: %s" % str(self.ssl_version))
|
||||
ssl_socket = ssl.wrap_socket(self.socket,
|
||||
ssl_version=self.ssl_version,
|
||||
do_handshake_on_connect=False)
|
||||
|
@ -527,6 +528,17 @@ class XMLStream(object):
|
|||
self.__event_handlers[name] = filter(filter_pointers,
|
||||
self.__event_handlers[name])
|
||||
|
||||
def event_handled(self, name):
|
||||
"""
|
||||
Indicates if an event has any associated handlers.
|
||||
|
||||
Returns the number of registered handlers.
|
||||
|
||||
Arguments:
|
||||
name -- The name of the event to check.
|
||||
"""
|
||||
return len(self.__event_handlers.get(name, []))
|
||||
|
||||
def event(self, name, data={}, direct=False):
|
||||
"""
|
||||
Manually trigger a custom event.
|
||||
|
|
Loading…
Reference in a new issue