plugin XEP-0054: renamed isInRoom to isRoom as the method only tell if the entity belong to a MUC

This commit is contained in:
Goffi 2016-09-09 23:54:33 +02:00
commit b97038f281

View file

@ -109,10 +109,10 @@ class XEP_0054(object):
return True
def isInRoom(self, client, entity_jid):
"""Tell if an full jid is a member of a room
def isRoom(self, client, entity_jid):
"""Tell if a jid is a MUC one
@param entity_jid(jid.JID): full jid of the entity
@param entity_jid(jid.JID): full or bare jid of the entity check
@return (bool): True if the bare jid of the entity is a room jid
"""
try:
@ -154,7 +154,7 @@ class XEP_0054(object):
@param value(unicode): new value of the item
"""
if jid_.resource:
if not self.isInRoom(client, jid_):
if not self.isRoom(client, jid_):
# VCard are retrieved with bare jid
# but MUC room is a special case
jid_ = jid.userhostJID()
@ -172,7 +172,7 @@ class XEP_0054(object):
@param name: name of the value ('nick' or 'avatar')
@return: wanted value or None"""
if entity_jid.resource:
if not self.isInRoom(client, entity_jid):
if not self.isRoom(client, entity_jid):
# VCard are retrieved with bare jid
# but MUC room is a special case
entity_jid = jid.userhostJID()
@ -377,7 +377,7 @@ class XEP_0054_handler(XMPPHandler):
@param presend(domish.Element): <presence/> stanza
"""
from_jid = jid.JID(presence['from'])
if from_jid.resource and not self.plugin_parent.isInRoom(self.parent, from_jid):
if from_jid.resource and not self.plugin_parent.isRoom(self.parent, from_jid):
from_jid = from_jid.userhostJID()
#FIXME: wokkel's data_form should be used here
try: