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:
parent
467ff43106
commit
6127f23774
1 changed files with 5 additions and 2 deletions
|
@ -127,14 +127,17 @@ def get_room_and_nick_from_fjid(jid):
|
||||||
return l
|
return l
|
||||||
|
|
||||||
def get_real_jid_from_fjid(account, fjid):
|
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)
|
room_jid, nick = get_room_and_nick_from_fjid(fjid)
|
||||||
if not nick: # It's not a fake_jid, so it's not pm
|
if not nick: # It's not a fake_jid, it is a real jid
|
||||||
return fjid
|
return fjid # we are mods for example so we know the real jid
|
||||||
real_jid = fjid
|
real_jid = fjid
|
||||||
gcs = interface.windows[account]['gc']
|
gcs = interface.windows[account]['gc']
|
||||||
if gcs.has_key(room_jid):
|
if gcs.has_key(room_jid):
|
||||||
# It's a pm, so if we have real jid it's in contact.jid
|
# It's a pm, so if we have real jid it's in contact.jid
|
||||||
contact = gc_contacts[account][room_jid][nick]
|
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
|
real_jid = contact.jid
|
||||||
return real_jid
|
return real_jid
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue