Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop

This commit is contained in:
Lance Stout 2010-11-03 12:39:44 -04:00
commit 5769935720
2 changed files with 272 additions and 262 deletions

View file

@ -241,8 +241,7 @@ class xep_0030(base.base_plugin):
A default handler for disco#info requests. If another A default handler for disco#info requests. If another
handler is registered, this one will defer and not run. handler is registered, this one will defer and not run.
""" """
handlers = self.xmpp.event_handlers['disco_info_request'] if not forwarded and self.xmpp.event_handled('disco_info_request'):
if not forwarded and len(handlers) > 1:
return return
node_name = iq['disco_info']['node'] 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 If this handler is called by your own custom handler with
forwarded set to True, then it will run as normal. forwarded set to True, then it will run as normal.
""" """
handlers = self.xmpp.event_handlers['disco_items_request'] if not forwarded and self.xmpp.event_handled('disco_items_request'):
if not forwarded and len(handlers) > 1:
return return
node_name = iq['disco_items']['node'] node_name = iq['disco_items']['node']

View file

@ -379,6 +379,7 @@ class XMLStream(object):
""" """
if self.ssl_support: if self.ssl_support:
logging.info("Negotiating TLS") logging.info("Negotiating TLS")
logging.info("Using SSL version: %s" % str(self.ssl_version))
ssl_socket = ssl.wrap_socket(self.socket, ssl_socket = ssl.wrap_socket(self.socket,
ssl_version=self.ssl_version, ssl_version=self.ssl_version,
do_handshake_on_connect=False) do_handshake_on_connect=False)
@ -527,6 +528,17 @@ class XMLStream(object):
self.__event_handlers[name] = filter(filter_pointers, self.__event_handlers[name] = filter(filter_pointers,
self.__event_handlers[name]) 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): def event(self, name, data={}, direct=False):
""" """
Manually trigger a custom event. Manually trigger a custom event.