comment get_real_jid_from_fjid to assure future protection from refactoring and add docstring to get return values without reading the code. Both are importnat for such api funcs

This commit is contained in:
Nikos Kouremenos 2005-11-02 11:06:51 +00:00
parent 467ff43106
commit 6127f23774
1 changed files with 5 additions and 2 deletions

View File

@ -127,14 +127,17 @@ def get_room_and_nick_from_fjid(jid):
return l
def get_real_jid_from_fjid(account, fjid):
'''returns real jid, it returns None
if we don't know the real jid'''
room_jid, nick = get_room_and_nick_from_fjid(fjid)
if not nick: # It's not a fake_jid, so it's not pm
return fjid
if not nick: # It's not a fake_jid, it is a real jid
return fjid # we are mods for example so we know the real jid
real_jid = fjid
gcs = interface.windows[account]['gc']
if gcs.has_key(room_jid):
# It's a pm, so if we have real jid it's in contact.jid
contact = gc_contacts[account][room_jid][nick]
# contact.jid is None when it's not a real jid (we don't know real jid)
real_jid = contact.jid
return real_jid