better var names

This commit is contained in:
Dimitur Kirov 2006-07-11 18:03:50 +00:00
parent 56cd8ba43b
commit e1ae03d32e
1 changed files with 9 additions and 7 deletions

View File

@ -71,6 +71,7 @@ class Zeroconf:
def check_jid(self, jid): def check_jid(self, jid):
# TODO: at least miranda uses bad service names(only host name), so change them - probabaly not so nice... need to find a better solution # TODO: at least miranda uses bad service names(only host name), so change them - probabaly not so nice... need to find a better solution
# [dkirov] maybe turn it into host+'@'+host, instead ?
if jid.find('@') == -1: if jid.find('@') == -1:
return 'bad-client@' + jid return 'bad-client@' + jid
else: else:
@ -83,14 +84,15 @@ class Zeroconf:
else: else:
return jid return jid
def txt_array_to_dict(self,t): def txt_array_to_dict(self,txt_array):
l = {} items = {}
for s in t: for byte_array in txt_array:
str = avahi.byte_array_to_string(s) # 'str' is used for string type in python
poseq = str.find('=') value = avahi.byte_array_to_string(byte_array)
l[str[:poseq]] = str[poseq+1:] poseq = value.find('=')
return l items[value[:poseq]] = value[poseq+1:]
return items
def service_resolved_callback(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags): def service_resolved_callback(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags):
self.contacts[name] = (name, domain, interface, protocol, host, address, port, txt) self.contacts[name] = (name, domain, interface, protocol, host, address, port, txt)