Allow disco queries to got to server when no JID is specified and marked not local.

This commit is contained in:
Lance Stout 2012-09-26 01:42:51 -07:00
parent 90807dd973
commit b8f04983e1

View File

@ -288,7 +288,7 @@ class XEP_0030(BasePlugin):
'cached': cached} 'cached': cached}
return self.api['has_identity'](jid, node, ifrom, data) return self.api['has_identity'](jid, node, ifrom, data)
def get_info(self, jid=None, node=None, local=False, def get_info(self, jid=None, node=None, local=None,
cached=None, **kwargs): cached=None, **kwargs):
""" """
Retrieve the disco#info results from a given JID/node combination. Retrieve the disco#info results from a given JID/node combination.
@ -325,17 +325,18 @@ class XEP_0030(BasePlugin):
received instead of blocking and waiting for received instead of blocking and waiting for
the reply. the reply.
""" """
if jid is not None and not isinstance(jid, JID): if local is None:
jid = JID(jid) if jid is not None and not isinstance(jid, JID):
if self.xmpp.is_component: jid = JID(jid)
if jid.domain == self.xmpp.boundjid.domain: if self.xmpp.is_component:
local = True if jid.domain == self.xmpp.boundjid.domain:
else: local = True
if str(jid) == str(self.xmpp.boundjid): else:
local = True if str(jid) == str(self.xmpp.boundjid):
jid = jid.full local = True
elif jid in (None, ''): jid = jid.full
local = True elif jid in (None, ''):
local = True
if local: if local:
log.debug("Looking up local disco#info data " + \ log.debug("Looking up local disco#info data " + \
@ -405,7 +406,7 @@ class XEP_0030(BasePlugin):
the XEP-0059 plugin, if the plugin is loaded. the XEP-0059 plugin, if the plugin is loaded.
Otherwise the parameter is ignored. Otherwise the parameter is ignored.
""" """
if local or jid is None: if local or local is None and jid is None:
items = self.api['get_items'](jid, node, items = self.api['get_items'](jid, node,
kwargs.get('ifrom', None), kwargs.get('ifrom', None),
kwargs) kwargs)