comparison sat/plugins/plugin_xep_0048.py @ 3040:fee60f17ebac

jp: jp asyncio port: /!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\ This patch implements the port of jp to asyncio, so it is now correctly using the bridge asynchronously, and it can be used with bridges like `pb`. This also simplify the code, notably for things which were previously implemented with many callbacks (like pagination with RSM). During the process, some behaviours have been modified/fixed, in jp and backends, check diff for details.
author Goffi <goffi@goffi.org>
date Wed, 25 Sep 2019 08:56:41 +0200
parents ab2696e34d29
children 9d0df638c8b4
comparison
equal deleted inserted replaced
3039:a1bc34f90fa5 3040:fee60f17ebac
239 try: 239 try:
240 conference_elt.addElement("nick", content=rooms_data[room_jid]["nick"]) 240 conference_elt.addElement("nick", content=rooms_data[room_jid]["nick"])
241 except KeyError: 241 except KeyError:
242 pass 242 pass
243 243
244 for url in urls_data: 244 for url, url_data in urls_data.items():
245 url_elt = storage_elt.addElement("url") 245 url_elt = storage_elt.addElement("url")
246 url_elt[XEP_0048.URL_KEY] = url 246 url_elt[XEP_0048.URL_KEY] = url
247 for attr in XEP_0048.URL_ATTRS: 247 for attr in XEP_0048.URL_ATTRS:
248 try: 248 try:
249 url_elt[attr] = url[attr] 249 url_elt[attr] = url_data[attr]
250 except KeyError: 250 except KeyError:
251 pass 251 pass
252 252
253 return storage_elt 253 return storage_elt
254 254
438 bookmarks_ori = getattr(client, "bookmarks_" + _storage_location) 438 bookmarks_ori = getattr(client, "bookmarks_" + _storage_location)
439 if bookmarks_ori is None: 439 if bookmarks_ori is None:
440 return ret 440 return ret
441 data = bookmarks_ori[type_] 441 data = bookmarks_ori[type_]
442 for bookmark in data: 442 for bookmark in data:
443 ret[_storage_location][bookmark.full()] = data[bookmark].copy() 443 if type_ == XEP_0048.MUC_TYPE:
444 ret[_storage_location][bookmark.full()] = data[bookmark].copy()
445 else:
446 ret[_storage_location][bookmark] = data[bookmark].copy()
444 return ret 447 return ret
445 448
446 for _storage_location in ("local", "private", "pubsub"): 449 for _storage_location in ("local", "private", "pubsub"):
447 if storage_location in ("all", _storage_location): 450 if storage_location in ("all", _storage_location):
448 ret[_storage_location] = {} 451 ret[_storage_location] = {}