comparison src/memory/memory.py @ 1682:61391d863709

plugin XEP-0054: fixed vcard-update callback which was updating avatar when hash was empty, resulting in a really slow start
author Goffi <goffi@goffi.org>
date Wed, 25 Nov 2015 20:01:39 +0100
parents fd7f41d8cbdf
children 373ce871b0f3
comparison
equal deleted inserted replaced
1681:c6c835046681 1682:61391d863709
451 """ 451 """
452 if not name: 452 if not name:
453 raise ValueError("Empty profile name") 453 raise ValueError("Empty profile name")
454 if name[0] == '@': 454 if name[0] == '@':
455 raise ValueError("A profile name can't start with a '@'") 455 raise ValueError("A profile name can't start with a '@'")
456 456
457 d = self.params.asyncCreateProfile(name) 457 d = self.params.asyncCreateProfile(name)
458 458
459 def initPersonalKey(dummy): 459 def initPersonalKey(dummy):
460 # be sure to call this after checking that the profile doesn't exist yet 460 # be sure to call this after checking that the profile doesn't exist yet
461 personal_key = BlockCipher.getRandomKey(base64=True) # generated once for all and saved in a PersistentDict 461 personal_key = BlockCipher.getRandomKey(base64=True) # generated once for all and saved in a PersistentDict
462 self.auth_sessions.newSession({C.MEMORY_CRYPTO_KEY: personal_key}, profile=name) # will be encrypted by setParam 462 self.auth_sessions.newSession({C.MEMORY_CRYPTO_KEY: personal_key}, profile=name) # will be encrypted by setParam
463 463
689 If key was registered with setSignalOnUpdate, a signal will be sent to frontends 689 If key was registered with setSignalOnUpdate, a signal will be sent to frontends
690 @param entity_jid: JID of the entity, C.ENTITY_ALL_RESOURCES for all resources of all entities, 690 @param entity_jid: JID of the entity, C.ENTITY_ALL_RESOURCES for all resources of all entities,
691 C.ENTITY_ALL for all entities (all resources + bare jids) 691 C.ENTITY_ALL for all entities (all resources + bare jids)
692 @param key: key to set (eg: "type") 692 @param key: key to set (eg: "type")
693 @param value: value for this key (eg: "chatroom") 693 @param value: value for this key (eg: "chatroom")
694 @param silent(bool): if True, doesn't send signal to frontend, even there is a signal flag (see setSignalOnUpdate) 694 @param silent(bool): if True, doesn't send signal to frontend, even if there is a signal flag (see setSignalOnUpdate)
695 @param profile_key: %(doc_profile_key)s 695 @param profile_key: %(doc_profile_key)s
696 """ 696 """
697 profile_cache = self._getProfileCache(profile_key) 697 profile_cache = self._getProfileCache(profile_key)
698 if entity_jid in (C.ENTITY_ALL_RESOURCES, C.ENTITY_ALL): 698 if entity_jid in (C.ENTITY_ALL_RESOURCES, C.ENTITY_ALL):
699 entities = self.getAllEntitiesIter(entity_jid==C.ENTITY_ALL, profile_key) 699 entities = self.getAllEntitiesIter(entity_jid==C.ENTITY_ALL, profile_key)