- return msnid.replace('@', '%') + "@" + config.jid
-
-translateAccount = msn2jid # Marks this as the function to be used in jabber:iq:gateway (Service ID Translation)
-
+ 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
+ msn2jid_cache[msnid] = jid
+ jid2msn_cache[jid] = msnid
+ return msn2jid(msnid, withResource)
+
+# Marks this as the function to be used in jabber:iq:gateway (Service ID Translation)
+def translateAccount(msnid):
+ return msn2jid(msnid, False)
+
+jid2msn_cache = {}