error.attributes["type"] = etype
error.attributes["code"] = str(utils.errorCodeMap[condition])
desc = error.addElement(condition)
- desc.attributes["xmlns"] = XMPP_STANZAS
+ desc.attributes["xmlns"] = disco.XMPP_STANZAS
text = error.addElement("text")
- text.attributes["xmlns"] = XMPP_STANZAS
+ text.attributes["xmlns"] = disco.XMPP_STANZAS
text.addContent(explanation)
if(body and len(body) > 0):
b = el.addElement("body")
class de: # German - Florian Holzhauer <xmpp:fh@jabber.ccc.de>
registerText = u"Bitte trage Deine MSN-Passport-ID (user@hotmail.com) als User ein, sowie Dein Passwort und Deinen Nickname.\n Mehr Informationen zu diesem Gateway findest Du unter http://msn-transport.jabberstudio.org/docs/users"
- gatewayTranslator = u"Enter the user's MSN account." # FIXMELANG!!
+ gatewayTranslator = u"Enter the user's MSN account."
userMapping = u"The MSN contact %s has a Jabber ID %s. It is recommended to talk to this person through Jabber."
notLoggedIn = u"Fehler. Du musst beim Gateway eingeloggt sein bevor Du Nachrichten schicken kannst."
notRegistered = u"Sorry, Du scheinst Dich bei diesem Gateway noch nicht registriert zu haben. Bitte registriere Dich und versuche es noch einmal. Bei Problemen wendest Du Dich am besten an Deinen Jabber-Administrator"
#stats["FailedAvatarCount"] = msnp2p.MSNP2P_Avatar.ERROR_COUNT
+msn2jid_cache = {}
def msn2jid(msnid, withResource):
""" Converts a MSN passport into a JID representation to be used with the transport """
- return msnid.replace('@', '%') + "@" + config.jid + (withResource and "/msn" or "")
+ global msn2jid_cache
+ global jid2msn_cache
+
+ if msn2jid_cache.has_key(msnid):
+ jid = msn2jid_cache[msnid]
+ if withResource:
+ jid += "/msn"
+ return jid
+ else:
+ if msnid.startswith("tel:+"):
+ msnid = msnid.replace("tel:+", "") + "%tel"
+ jid = msnid.replace('@', '%') + "@" + config.jid + (withResource and "/msn" or "")
+ msn2jid_cache[msnid] = jid
+ jid2msn_cache[jid] = msnid
+ return jid
# Marks this as the function to be used in jabber:iq:gateway (Service ID Translation)
-translateAccount = lambda a: msn2jid(a, False)
+def translateAccount(msnid):
+ return msn2jid(msnid, False)
+jid2msn_cache = {}
def jid2msn(jid):
""" Converts a JID representation of a MSN passport into the original MSN passport """
- return unicode(jid[:jid.find('@')].replace('%', '@')).split("/")[0]
+ global jid2msn_cache
+ global msn2jid_cache
+
+ if jid2msn_cache.has_key(jid):
+ msnid = jid2msn_cache[jid]
+ return msnid
+ else:
+ if jid.index("%tel@") > 0:
+ jid = "tel:+" + jid.replace("%tel@", "@")
+ msnid = unicode(jid[:jid.find('@')].replace('%', '@')).split("/")[0]
+ jid2msn_cache[jid] = msnid
+ msn2jid_cache[msnid] = jid
+ return msnid
def presence2state(show, ptype):
def _getNotificationReferral(self):
def timeout():
+ self.timeout = None
if not d.called:
d.errback()
self.logOut() # Clean up everything
def _gotNotificationReferral(self, (host, port)):
self.timeout.cancel()
+ self.timeout = None
# Create the NotificationClient
self.notificationFactory = msn.NotificationFactory()
self.notificationFactory.userHandle = self.username
del self.remoteUser
self.contactCount = 0
self.msncon.gotGroupchat(self, userHandle)
- if not self.groupchat:
- LogEvent(ERROR, self.ident)
- raise Exception("YouNeedAGroupchat-WeHaveAProblemError") # FIXME
+ assert self.groupchat
def failedMessage(self, text):
self.msncon.failedMessage(self.remoteUser, text)