fro = el.getAttribute("from")
froj = jid.intern(fro)
to = el.getAttribute("to")
+ toj = jid.intern(to)
ID = el.getAttribute("id")
- if(itype != "get" and itype != "error"):
+ if itype != "get" and itype != "error":
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns="vcard-temp", etype="cancel", condition="feature-not-implemented")
return
toGateway = not (to.find('@') > 0)
- if(not toGateway):
- if(not self.pytrans.sessions.has_key(froj.userhost())):
+ if not toGateway:
+ if not self.pytrans.sessions.has_key(froj.userhost()):
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns="vcard-temp", etype="auth", condition="not-authorized")
return
s = self.pytrans.sessions[froj.userhost()]
- if(not s.ready):
+ if not s.ready:
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns="vcard-temp", etype="auth", condition="not-authorized")
return
- c = s.contactList.findContact(to)
- if(not c):
+ c = s.contactList.findContact(toj.userhost())
+ if not c:
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns="vcard-temp", etype="cancel", condition="recipient-unavailable")
return
iq.attributes["type"] = "result"
vCard = iq.addElement("vCard")
vCard.attributes["xmlns"] = "vcard-temp"
- if(toGateway):
+ if toGateway:
FN = vCard.addElement("FN")
- FN.addContent(legacy.name)
+ FN.addContent(config.discoName)
DESC = vCard.addElement("DESC")
- DESC.addContent(legacy.name)
+ DESC.addContent(config.discoName)
URL = vCard.addElement("URL")
URL.addContent(legacy.url)
else:
- if(c.nickname):
+ if c.nickname:
NICKNAME = vCard.addElement("NICKNAME")
NICKNAME.addContent(c.nickname)
- if(c.avatar):
+ if c.avatar:
PHOTO = c.avatar.makePhotoElement()
vCard.addChild(PHOTO)
fro = el.getAttribute("from")
froj = jid.intern(fro)
to = el.getAttribute("to")
+ toj = jid.intern(to)
ID = el.getAttribute("id")
if(itype != "get" and itype != "error"):
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns=disco.IQAVATAR, etype="auth", condition="not-authorized")
return
- c = s.contactList.findContact(to)
+ c = s.contactList.findContact(toj.userhost())
if(not c):
self.pytrans.discovery.sendIqError(to=fro, fro=config.jid, ID=ID, xmlns=disco.IQAVATAR, etype="cancel", condition="recipient-unavailable")
return
query = iq.addElement("query")
query.attributes["xmlns"] = disco.IQVERSION
name = query.addElement("name")
- name.addContent(legacy.name)
+ name.addContent(config.discoName)
version = query.addElement("version")
version.addContent(legacy.version)
os = query.addElement("os")
froj = jid.intern(el.getAttribute("from"))
query = el.query
- if not (query and query.getAttribute("mode") == "tcp"):
+ if not (query and query.getAttribute("mode", "tcp") == "tcp"):
return errOut()
sid = query.getAttribute("sid")
consumer = self.sessions.pop((froj.full(), sid), None)