Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0048.py @ 2765:378188abe941
misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 11 Jan 2019 11:13:15 +0100 |
parents | 56f94936df1e |
children | 003b8b4b56a7 |
comparison
equal
deleted
inserted
replaced
2764:92af49cde255 | 2765:378188abe941 |
---|---|
263 def join_eb(failure): | 263 def join_eb(failure): |
264 log.warning(u"Error while trying to join room: {}".format(failure)) | 264 log.warning(u"Error while trying to join room: {}".format(failure)) |
265 # FIXME: failure are badly managed in plugin XEP-0045. Plugin XEP-0045 need to be fixed before managing errors correctly here | 265 # FIXME: failure are badly managed in plugin XEP-0045. Plugin XEP-0045 need to be fixed before managing errors correctly here |
266 return {} | 266 return {} |
267 | 267 |
268 d.addCallbacks(lambda dummy: {}, join_eb) | 268 d.addCallbacks(lambda __: {}, join_eb) |
269 return d | 269 return d |
270 | 270 |
271 def _bookmarksMenu(self, data, profile): | 271 def _bookmarksMenu(self, data, profile): |
272 """ XMLUI activated by menu: return Gateways UI | 272 """ XMLUI activated by menu: return Gateways UI |
273 @param profile: %(doc_profile)s | 273 @param profile: %(doc_profile)s |
323 try: | 323 try: |
324 location = jid.JID(bm_data.pop("jid")) | 324 location = jid.JID(bm_data.pop("jid")) |
325 except KeyError: | 325 except KeyError: |
326 raise exceptions.InternalError("Can't find mandatory key") | 326 raise exceptions.InternalError("Can't find mandatory key") |
327 d = self.addBookmark(XEP_0048.MUC_TYPE, location, bm_data, profile_key=profile) | 327 d = self.addBookmark(XEP_0048.MUC_TYPE, location, bm_data, profile_key=profile) |
328 d.addCallback(lambda dummy: {}) | 328 d.addCallback(lambda __: {}) |
329 return d | 329 return d |
330 | 330 |
331 @defer.inlineCallbacks | 331 @defer.inlineCallbacks |
332 def addBookmark( | 332 def addBookmark( |
333 self, type_, location, data, storage_type="auto", profile_key=C.PROF_KEY_NONE | 333 self, type_, location, data, storage_type="auto", profile_key=C.PROF_KEY_NONE |
429 """ | 429 """ |
430 client = self.host.getClient(profile_key) | 430 client = self.host.getClient(profile_key) |
431 ret = {} | 431 ret = {} |
432 ret_d = defer.succeed(ret) | 432 ret_d = defer.succeed(ret) |
433 | 433 |
434 def fillBookmarks(dummy, _storage_location): | 434 def fillBookmarks(__, _storage_location): |
435 bookmarks_ori = getattr(client, "bookmarks_" + _storage_location) | 435 bookmarks_ori = getattr(client, "bookmarks_" + _storage_location) |
436 if bookmarks_ori is None: | 436 if bookmarks_ori is None: |
437 return ret | 437 return ret |
438 data = bookmarks_ori[type_] | 438 data = bookmarks_ori[type_] |
439 for bookmark in data: | 439 for bookmark in data: |
447 # we update distant bookmarks, just in case an other client added something | 447 # we update distant bookmarks, just in case an other client added something |
448 d = self._getServerBookmarks(_storage_location, client.profile) | 448 d = self._getServerBookmarks(_storage_location, client.profile) |
449 else: | 449 else: |
450 d = defer.succeed(None) | 450 d = defer.succeed(None) |
451 d.addCallback(fillBookmarks, _storage_location) | 451 d.addCallback(fillBookmarks, _storage_location) |
452 ret_d.addCallback(lambda dummy: d) | 452 ret_d.addCallback(lambda __: d) |
453 | 453 |
454 return ret_d | 454 return ret_d |
455 | 455 |
456 def _bookmarksRemove( | 456 def _bookmarksRemove( |
457 self, type_, location, storage_location, profile_key=C.PROF_KEY_NONE | 457 self, type_, location, storage_location, profile_key=C.PROF_KEY_NONE |