def sendContactHashSingle(self): self.send(NUM_CONTACTS_REPLY_HASH_SINGLE_START) contacts = self.contactDict() keys = contacts.keys() keys.sort() for key in keys: hash = unicode() for _type, location, value in contacts[key]: hash += _type + INFO_SEP + location + INFO_SEP + value hash += FIELD_SEP hash = hash.encode("utf8") hash = md5.md5(hash).hexdigest() self.send(NUM_CONTACTS_REPLY_HASH_SINGLE_LINE, key, hash) self.send(NUM_CONTACTS_REPLY_HASH_SINGLE_END)
def sendContactHash(self): contacts = self.contactDict() keys = contacts.keys() keys.sort() hash = unicode() for key in keys: hash += str(key) hash += FIELD_SEP for _type, location, value in contacts[key]: hash += _type + INFO_SEP + location + INFO_SEP + value hash += FIELD_SEP hash += CONTACT_SEP hash = hash.encode("utf8") hash = md5.md5(hash).hexdigest() self.send(NUM_CONTACTS_REPLY_HASH_ALL, hash)