comparison sat/plugins/plugin_misc_identity.py @ 3278:27d4b71e264a

plugin identity: fixed update in avatarSetPostTreatment
author Goffi <goffi@goffi.org>
date Tue, 19 May 2020 18:34:05 +0200
parents cf07641b764d
children 9e1ba1e1179f
comparison
equal deleted inserted replaced
3277:cf07641b764d 3278:27d4b71e264a
32 32
33 33
34 log = getLogger(__name__) 34 log = getLogger(__name__)
35 35
36 36
37 IMPORT_NAME = "IDENTITY"
38
39
37 PLUGIN_INFO = { 40 PLUGIN_INFO = {
38 C.PI_NAME: "Identity Plugin", 41 C.PI_NAME: "Identity Plugin",
39 C.PI_IMPORT_NAME: "IDENTITY", 42 C.PI_IMPORT_NAME: IMPORT_NAME,
40 C.PI_TYPE: C.PLUG_TYPE_MISC, 43 C.PI_TYPE: C.PLUG_TYPE_MISC,
41 C.PI_PROTOCOLS: [], 44 C.PI_PROTOCOLS: [],
42 C.PI_DEPENDENCIES: [], 45 C.PI_DEPENDENCIES: [],
43 C.PI_RECOMMENDATIONS: ["XEP-0045"], 46 C.PI_RECOMMENDATIONS: ["XEP-0045"],
44 C.PI_MAIN: "Identity", 47 C.PI_MAIN: "Identity",
470 raise ValueError(f"File at {file_path} doesn't appear to be an image") 473 raise ValueError(f"File at {file_path} doesn't appear to be an image")
471 return avatar_data 474 return avatar_data
472 475
473 async def avatarSetPostTreatment(self, client, entity, avatar_data): 476 async def avatarSetPostTreatment(self, client, entity, avatar_data):
474 """Update our own avatar""" 477 """Update our own avatar"""
475 await self.update(client, "avatar", avatar_data, entity) 478 await self.update(client, IMPORT_NAME, "avatar", avatar_data, entity)
476 479
477 def avatarBuildMetadata(self, path, media_type=None, cache_uid=None): 480 def avatarBuildMetadata(self, path, media_type=None, cache_uid=None):
478 """Helper method to generate avatar metadata 481 """Helper method to generate avatar metadata
479 482
480 @param path(str, Path, None): path to avatar file 483 @param path(str, Path, None): path to avatar file