Mercurial > libervia-backend
diff sat/plugins/plugin_comp_ap_gateway/__init__.py @ 3824:6329ee6b6df4
component AP: convert AP identity data to XMPP:
metadata are converted to vCard4 (XEP-0292).
Avatar is converted to User Avatar (XEP-0084), it is downloaded, resized, converted and
cached on first request.
If avatar is bigger than 5 Mio, it won't be used.
rel 368
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 29 Jun 2022 12:12:09 +0200 |
parents | 0b1c30ff2cbb |
children | 201a22bfbb74 |
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_ap_gateway/__init__.py Wed Jun 29 12:08:53 2022 +0200 +++ b/sat/plugins/plugin_comp_ap_gateway/__init__.py Wed Jun 29 12:12:09 2022 +0200 @@ -50,6 +50,7 @@ from sat.core.i18n import _ from sat.core.log import getLogger from sat.memory.sqla_mapping import SubscriptionState, History +from sat.memory import persistent from sat.tools import utils from sat.tools.common import data_format, tls, uri from sat.tools.common.async_utils import async_lru @@ -105,21 +106,25 @@ class APGateway: + IMPORT_NAME = IMPORT_NAME def __init__(self, host): self.host = host self.initialised = False self.client = None + self._p = host.plugins["XEP-0060"] + self._a = host.plugins["XEP-0084"] + self._e = host.plugins["XEP-0106"] self._m = host.plugins["XEP-0277"] - self._p = host.plugins["XEP-0060"] - self._e = host.plugins["XEP-0106"] + self._v = host.plugins["XEP-0292"] self._r = host.plugins["XEP-0424"] self._pps = host.plugins["XEP-0465"] self._c = host.plugins["PUBSUB_CACHE"] + self._t = host.plugins["TEXT_SYNTAXES"] + self._i = host.plugins["IDENTITY"] self._p.addManagedNode( "", items_cb=self._itemsReceived ) - self._t = host.plugins["TEXT_SYNTAXES"] self.pubsub_service = APPubsubService(self) host.trigger.add("messageReceived", self._messageReceivedTrigger, priority=-1000) host.trigger.add("XEP-0424_retractReceived", self._onMessageRetract) @@ -230,6 +235,10 @@ async def profileConnecting(self, client): self.client = client client.sendHistory = True + client._ap_storage = persistent.LazyPersistentBinaryDict( + IMPORT_NAME, + client.profile + ) await self.init(client) async def _itemsReceived(