comparison libervia/frontends/bridge/pb.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 730f542e4ad0
children 4cf98f506269
comparison
equal deleted inserted replaced
4269:64a85ce8be70 4270:0d7bb4df2343
46 self.__getattribute__(method_name) 46 self.__getattribute__(method_name)
47 except AttributeError: 47 except AttributeError:
48 pass 48 pass
49 else: 49 else:
50 raise exceptions.InternalError( 50 raise exceptions.InternalError(
51 "{name} signal handler has been registered twice".format( 51 "{name} signal handler has been registered twice".format(name=method_name)
52 name=method_name
53 )
54 ) 52 )
55 setattr(self, method_name, handler) 53 setattr(self, method_name, handler)
56 54
57 55
58 class bridge(object): 56 class bridge(object):
68 66
69 def _errback(self, failure_, ori_errback): 67 def _errback(self, failure_, ori_errback):
70 """Convert Failure to BridgeException""" 68 """Convert Failure to BridgeException"""
71 ori_errback( 69 ori_errback(
72 BridgeException( 70 BridgeException(
73 name=failure_.type.decode('utf-8'), 71 name=failure_.type.decode("utf-8"), message=str(failure_.value)
74 message=str(failure_.value)
75 ) 72 )
76 ) 73 )
77 74
78 def remote_callback(self, result, callback): 75 def remote_callback(self, result, callback):
79 """call callback with argument or None 76 """call callback with argument or None
162 return d 159 return d
163 160
164 def register_signal(self, functionName, handler, iface="core"): 161 def register_signal(self, functionName, handler, iface="core"):
165 self.signals_handler.register_signal(functionName, handler, iface) 162 self.signals_handler.register_signal(functionName, handler, iface)
166 163
167 164 def action_launch(
168 def action_launch(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None): 165 self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None
166 ):
169 d = self.root.callRemote("action_launch", callback_id, data, profile_key) 167 d = self.root.callRemote("action_launch", callback_id, data, profile_key)
170 if callback is not None: 168 if callback is not None:
171 d.addCallback(callback) 169 d.addCallback(callback)
172 if errback is None: 170 if errback is None:
173 d.addErrback(self._generic_errback) 171 d.addErrback(self._generic_errback)
190 if errback is None: 188 if errback is None:
191 d.addErrback(self._generic_errback) 189 d.addErrback(self._generic_errback)
192 else: 190 else:
193 d.addErrback(self._errback, ori_errback=errback) 191 d.addErrback(self._errback, ori_errback=errback)
194 192
195 def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None): 193 def connect(
194 self,
195 profile_key="@DEFAULT@",
196 password="",
197 options={},
198 callback=None,
199 errback=None,
200 ):
196 d = self.root.callRemote("connect", profile_key, password, options) 201 d = self.root.callRemote("connect", profile_key, password, options)
197 if callback is not None: 202 if callback is not None:
198 d.addCallback(callback) 203 d.addCallback(callback)
199 if errback is None: 204 if errback is None:
200 d.addErrback(self._generic_errback) 205 d.addErrback(self._generic_errback)
201 else: 206 else:
202 d.addErrback(self._errback, ori_errback=errback) 207 d.addErrback(self._errback, ori_errback=errback)
203 208
204 def contact_add(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): 209 def contact_add(
210 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None
211 ):
205 d = self.root.callRemote("contact_add", entity_jid, profile_key) 212 d = self.root.callRemote("contact_add", entity_jid, profile_key)
206 if callback is not None: 213 if callback is not None:
207 d.addCallback(lambda __: callback()) 214 d.addCallback(lambda __: callback())
208 if errback is None: 215 if errback is None:
209 d.addErrback(self._generic_errback) 216 d.addErrback(self._generic_errback)
210 else: 217 else:
211 d.addErrback(self._errback, ori_errback=errback) 218 d.addErrback(self._errback, ori_errback=errback)
212 219
213 def contact_del(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): 220 def contact_del(
221 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None
222 ):
214 d = self.root.callRemote("contact_del", entity_jid, profile_key) 223 d = self.root.callRemote("contact_del", entity_jid, profile_key)
215 if callback is not None: 224 if callback is not None:
216 d.addCallback(lambda __: callback()) 225 d.addCallback(lambda __: callback())
217 if errback is None: 226 if errback is None:
218 d.addErrback(self._generic_errback) 227 d.addErrback(self._generic_errback)
226 if errback is None: 235 if errback is None:
227 d.addErrback(self._generic_errback) 236 d.addErrback(self._generic_errback)
228 else: 237 else:
229 d.addErrback(self._errback, ori_errback=errback) 238 d.addErrback(self._errback, ori_errback=errback)
230 239
231 def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None): 240 def contact_update(
241 self,
242 entity_jid,
243 name,
244 groups,
245 profile_key="@DEFAULT@",
246 callback=None,
247 errback=None,
248 ):
232 d = self.root.callRemote("contact_update", entity_jid, name, groups, profile_key) 249 d = self.root.callRemote("contact_update", entity_jid, name, groups, profile_key)
233 if callback is not None: 250 if callback is not None:
234 d.addCallback(lambda __: callback()) 251 d.addCallback(lambda __: callback())
235 if errback is None: 252 if errback is None:
236 d.addErrback(self._generic_errback) 253 d.addErrback(self._generic_errback)
244 if errback is None: 261 if errback is None:
245 d.addErrback(self._generic_errback) 262 d.addErrback(self._generic_errback)
246 else: 263 else:
247 d.addErrback(self._errback, ori_errback=errback) 264 d.addErrback(self._errback, ori_errback=errback)
248 265
249 def contacts_get_from_group(self, group, profile_key="@DEFAULT@", callback=None, errback=None): 266 def contacts_get_from_group(
267 self, group, profile_key="@DEFAULT@", callback=None, errback=None
268 ):
250 d = self.root.callRemote("contacts_get_from_group", group, profile_key) 269 d = self.root.callRemote("contacts_get_from_group", group, profile_key)
251 if callback is not None: 270 if callback is not None:
252 d.addCallback(callback) 271 d.addCallback(callback)
253 if errback is None: 272 if errback is None:
254 d.addErrback(self._generic_errback) 273 d.addErrback(self._generic_errback)
262 if errback is None: 281 if errback is None:
263 d.addErrback(self._generic_errback) 282 d.addErrback(self._generic_errback)
264 else: 283 else:
265 d.addErrback(self._errback, ori_errback=errback) 284 d.addErrback(self._errback, ori_errback=errback)
266 285
267 def disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@", callback=None, errback=None): 286 def disco_find_by_features(
268 d = self.root.callRemote("disco_find_by_features", namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key) 287 self,
269 if callback is not None: 288 namespaces,
270 d.addCallback(callback) 289 identities,
271 if errback is None: 290 bare_jid=False,
272 d.addErrback(self._generic_errback) 291 service=True,
273 else: 292 roster=True,
274 d.addErrback(self._errback, ori_errback=errback) 293 own_jid=True,
275 294 local_device=False,
276 def disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None): 295 profile_key="@DEFAULT@",
296 callback=None,
297 errback=None,
298 ):
299 d = self.root.callRemote(
300 "disco_find_by_features",
301 namespaces,
302 identities,
303 bare_jid,
304 service,
305 roster,
306 own_jid,
307 local_device,
308 profile_key,
309 )
310 if callback is not None:
311 d.addCallback(callback)
312 if errback is None:
313 d.addErrback(self._generic_errback)
314 else:
315 d.addErrback(self._errback, ori_errback=errback)
316
317 def disco_infos(
318 self,
319 entity_jid,
320 node="",
321 use_cache=True,
322 profile_key="@DEFAULT@",
323 callback=None,
324 errback=None,
325 ):
277 d = self.root.callRemote("disco_infos", entity_jid, node, use_cache, profile_key) 326 d = self.root.callRemote("disco_infos", entity_jid, node, use_cache, profile_key)
278 if callback is not None: 327 if callback is not None:
279 d.addCallback(callback) 328 d.addCallback(callback)
280 if errback is None: 329 if errback is None:
281 d.addErrback(self._generic_errback) 330 d.addErrback(self._generic_errback)
282 else: 331 else:
283 d.addErrback(self._errback, ori_errback=errback) 332 d.addErrback(self._errback, ori_errback=errback)
284 333
285 def disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None): 334 def disco_items(
335 self,
336 entity_jid,
337 node="",
338 use_cache=True,
339 profile_key="@DEFAULT@",
340 callback=None,
341 errback=None,
342 ):
286 d = self.root.callRemote("disco_items", entity_jid, node, use_cache, profile_key) 343 d = self.root.callRemote("disco_items", entity_jid, node, use_cache, profile_key)
287 if callback is not None: 344 if callback is not None:
288 d.addCallback(callback) 345 d.addCallback(callback)
289 if errback is None: 346 if errback is None:
290 d.addErrback(self._generic_errback) 347 d.addErrback(self._generic_errback)
316 if errback is None: 373 if errback is None:
317 d.addErrback(self._generic_errback) 374 d.addErrback(self._generic_errback)
318 else: 375 else:
319 d.addErrback(self._errback, ori_errback=errback) 376 d.addErrback(self._errback, ori_errback=errback)
320 377
321 def encryption_trust_ui_get(self, to_jid, namespace, profile_key, callback=None, errback=None): 378 def encryption_trust_ui_get(
322 d = self.root.callRemote("encryption_trust_ui_get", to_jid, namespace, profile_key) 379 self, to_jid, namespace, profile_key, callback=None, errback=None
380 ):
381 d = self.root.callRemote(
382 "encryption_trust_ui_get", to_jid, namespace, profile_key
383 )
323 if callback is not None: 384 if callback is not None:
324 d.addCallback(callback) 385 d.addCallback(callback)
325 if errback is None: 386 if errback is None:
326 d.addErrback(self._generic_errback) 387 d.addErrback(self._generic_errback)
327 else: 388 else:
352 if errback is None: 413 if errback is None:
353 d.addErrback(self._generic_errback) 414 d.addErrback(self._generic_errback)
354 else: 415 else:
355 d.addErrback(self._errback, ori_errback=errback) 416 d.addErrback(self._errback, ori_errback=errback)
356 417
357 def history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None): 418 def history_get(
358 d = self.root.callRemote("history_get", from_jid, to_jid, limit, between, filters, profile) 419 self,
420 from_jid,
421 to_jid,
422 limit,
423 between=True,
424 filters="",
425 profile="@NONE@",
426 callback=None,
427 errback=None,
428 ):
429 d = self.root.callRemote(
430 "history_get", from_jid, to_jid, limit, between, filters, profile
431 )
359 if callback is not None: 432 if callback is not None:
360 d.addCallback(callback) 433 d.addCallback(callback)
361 if errback is None: 434 if errback is None:
362 d.addErrback(self._generic_errback) 435 d.addErrback(self._generic_errback)
363 else: 436 else:
379 if errback is None: 452 if errback is None:
380 d.addErrback(self._generic_errback) 453 d.addErrback(self._generic_errback)
381 else: 454 else:
382 d.addErrback(self._errback, ori_errback=errback) 455 d.addErrback(self._errback, ori_errback=errback)
383 456
384 def image_generate_preview(self, image_path, profile_key, callback=None, errback=None): 457 def image_generate_preview(
458 self, image_path, profile_key, callback=None, errback=None
459 ):
385 d = self.root.callRemote("image_generate_preview", image_path, profile_key) 460 d = self.root.callRemote("image_generate_preview", image_path, profile_key)
386 if callback is not None: 461 if callback is not None:
387 d.addCallback(callback) 462 d.addCallback(callback)
388 if errback is None: 463 if errback is None:
389 d.addErrback(self._generic_errback) 464 d.addErrback(self._generic_errback)
415 if errback is None: 490 if errback is None:
416 d.addErrback(self._generic_errback) 491 d.addErrback(self._generic_errback)
417 else: 492 else:
418 d.addErrback(self._errback, ori_errback=errback) 493 d.addErrback(self._errback, ori_errback=errback)
419 494
420 def main_resource_get(self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None): 495 def main_resource_get(
496 self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None
497 ):
421 d = self.root.callRemote("main_resource_get", contact_jid, profile_key) 498 d = self.root.callRemote("main_resource_get", contact_jid, profile_key)
422 if callback is not None: 499 if callback is not None:
423 d.addCallback(callback) 500 d.addCallback(callback)
424 if errback is None: 501 if errback is None:
425 d.addErrback(self._generic_errback) 502 d.addErrback(self._generic_errback)
433 if errback is None: 510 if errback is None:
434 d.addErrback(self._generic_errback) 511 d.addErrback(self._generic_errback)
435 else: 512 else:
436 d.addErrback(self._errback, ori_errback=errback) 513 d.addErrback(self._errback, ori_errback=errback)
437 514
438 def menu_launch(self, menu_type, path, data, security_limit, profile_key, callback=None, errback=None): 515 def menu_launch(
439 d = self.root.callRemote("menu_launch", menu_type, path, data, security_limit, profile_key) 516 self,
517 menu_type,
518 path,
519 data,
520 security_limit,
521 profile_key,
522 callback=None,
523 errback=None,
524 ):
525 d = self.root.callRemote(
526 "menu_launch", menu_type, path, data, security_limit, profile_key
527 )
440 if callback is not None: 528 if callback is not None:
441 d.addCallback(callback) 529 d.addCallback(callback)
442 if errback is None: 530 if errback is None:
443 d.addErrback(self._generic_errback) 531 d.addErrback(self._generic_errback)
444 else: 532 else:
460 if errback is None: 548 if errback is None:
461 d.addErrback(self._generic_errback) 549 d.addErrback(self._generic_errback)
462 else: 550 else:
463 d.addErrback(self._errback, ori_errback=errback) 551 d.addErrback(self._errback, ori_errback=errback)
464 552
465 def message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None): 553 def message_encryption_start(
466 d = self.root.callRemote("message_encryption_start", to_jid, namespace, replace, profile_key) 554 self,
555 to_jid,
556 namespace="",
557 replace=False,
558 profile_key="@NONE@",
559 callback=None,
560 errback=None,
561 ):
562 d = self.root.callRemote(
563 "message_encryption_start", to_jid, namespace, replace, profile_key
564 )
467 if callback is not None: 565 if callback is not None:
468 d.addCallback(lambda __: callback()) 566 d.addCallback(lambda __: callback())
469 if errback is None: 567 if errback is None:
470 d.addErrback(self._generic_errback) 568 d.addErrback(self._generic_errback)
471 else: 569 else:
478 if errback is None: 576 if errback is None:
479 d.addErrback(self._generic_errback) 577 d.addErrback(self._generic_errback)
480 else: 578 else:
481 d.addErrback(self._errback, ori_errback=errback) 579 d.addErrback(self._errback, ori_errback=errback)
482 580
483 def message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): 581 def message_send(
484 d = self.root.callRemote("message_send", to_jid, message, subject, mess_type, extra, profile_key) 582 self,
583 to_jid,
584 message,
585 subject={},
586 mess_type="auto",
587 extra={},
588 profile_key="@NONE@",
589 callback=None,
590 errback=None,
591 ):
592 d = self.root.callRemote(
593 "message_send", to_jid, message, subject, mess_type, extra, profile_key
594 )
485 if callback is not None: 595 if callback is not None:
486 d.addCallback(lambda __: callback()) 596 d.addCallback(lambda __: callback())
487 if errback is None: 597 if errback is None:
488 d.addErrback(self._generic_errback) 598 d.addErrback(self._generic_errback)
489 else: 599 else:
496 if errback is None: 606 if errback is None:
497 d.addErrback(self._generic_errback) 607 d.addErrback(self._generic_errback)
498 else: 608 else:
499 d.addErrback(self._errback, ori_errback=errback) 609 d.addErrback(self._errback, ori_errback=errback)
500 610
501 def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, callback=None, errback=None): 611 def notification_add(
502 d = self.root.callRemote("notification_add", type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra) 612 self,
503 if callback is not None: 613 type_,
504 d.addCallback(lambda __: callback()) 614 body_plain,
505 if errback is None: 615 body_rich,
506 d.addErrback(self._generic_errback) 616 title,
507 else: 617 is_global,
508 d.addErrback(self._errback, ori_errback=errback) 618 requires_action,
509 619 arg_6,
510 def notification_delete(self, id_, is_global, profile_key, callback=None, errback=None): 620 priority,
621 expire_at,
622 extra,
623 callback=None,
624 errback=None,
625 ):
626 d = self.root.callRemote(
627 "notification_add",
628 type_,
629 body_plain,
630 body_rich,
631 title,
632 is_global,
633 requires_action,
634 arg_6,
635 priority,
636 expire_at,
637 extra,
638 )
639 if callback is not None:
640 d.addCallback(lambda __: callback())
641 if errback is None:
642 d.addErrback(self._generic_errback)
643 else:
644 d.addErrback(self._errback, ori_errback=errback)
645
646 def notification_delete(
647 self, id_, is_global, profile_key, callback=None, errback=None
648 ):
511 d = self.root.callRemote("notification_delete", id_, is_global, profile_key) 649 d = self.root.callRemote("notification_delete", id_, is_global, profile_key)
512 if callback is not None: 650 if callback is not None:
513 d.addCallback(lambda __: callback()) 651 d.addCallback(lambda __: callback())
514 if errback is None: 652 if errback is None:
515 d.addErrback(self._generic_errback) 653 d.addErrback(self._generic_errback)
516 else: 654 else:
517 d.addErrback(self._errback, ori_errback=errback) 655 d.addErrback(self._errback, ori_errback=errback)
518 656
519 def notifications_expired_clean(self, limit_timestamp, profile_key, callback=None, errback=None): 657 def notifications_expired_clean(
520 d = self.root.callRemote("notifications_expired_clean", limit_timestamp, profile_key) 658 self, limit_timestamp, profile_key, callback=None, errback=None
659 ):
660 d = self.root.callRemote(
661 "notifications_expired_clean", limit_timestamp, profile_key
662 )
521 if callback is not None: 663 if callback is not None:
522 d.addCallback(lambda __: callback()) 664 d.addCallback(lambda __: callback())
523 if errback is None: 665 if errback is None:
524 d.addErrback(self._generic_errback) 666 d.addErrback(self._generic_errback)
525 else: 667 else:
532 if errback is None: 674 if errback is None:
533 d.addErrback(self._generic_errback) 675 d.addErrback(self._generic_errback)
534 else: 676 else:
535 d.addErrback(self._errback, ori_errback=errback) 677 d.addErrback(self._errback, ori_errback=errback)
536 678
537 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None): 679 def param_get_a(
680 self,
681 name,
682 category,
683 attribute="value",
684 profile_key="@DEFAULT@",
685 callback=None,
686 errback=None,
687 ):
538 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key) 688 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key)
539 if callback is not None: 689 if callback is not None:
540 d.addCallback(callback) 690 d.addCallback(callback)
541 if errback is None: 691 if errback is None:
542 d.addErrback(self._generic_errback) 692 d.addErrback(self._generic_errback)
543 else: 693 else:
544 d.addErrback(self._errback, ori_errback=errback) 694 d.addErrback(self._errback, ori_errback=errback)
545 695
546 def param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): 696 def param_get_a_async(
547 d = self.root.callRemote("param_get_a_async", name, category, attribute, security_limit, profile_key) 697 self,
548 if callback is not None: 698 name,
549 d.addCallback(callback) 699 category,
550 if errback is None: 700 attribute="value",
551 d.addErrback(self._generic_errback) 701 security_limit=-1,
552 else: 702 profile_key="@DEFAULT@",
553 d.addErrback(self._errback, ori_errback=errback) 703 callback=None,
554 704 errback=None,
555 def param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): 705 ):
556 d = self.root.callRemote("param_set", name, value, category, security_limit, profile_key) 706 d = self.root.callRemote(
557 if callback is not None: 707 "param_get_a_async", name, category, attribute, security_limit, profile_key
558 d.addCallback(lambda __: callback()) 708 )
559 if errback is None: 709 if callback is not None:
560 d.addErrback(self._generic_errback) 710 d.addCallback(callback)
561 else: 711 if errback is None:
562 d.addErrback(self._errback, ori_errback=errback) 712 d.addErrback(self._generic_errback)
563 713 else:
564 def param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@", callback=None, errback=None): 714 d.addErrback(self._errback, ori_errback=errback)
715
716 def param_set(
717 self,
718 name,
719 value,
720 category,
721 security_limit=-1,
722 profile_key="@DEFAULT@",
723 callback=None,
724 errback=None,
725 ):
726 d = self.root.callRemote(
727 "param_set", name, value, category, security_limit, profile_key
728 )
729 if callback is not None:
730 d.addCallback(lambda __: callback())
731 if errback is None:
732 d.addErrback(self._generic_errback)
733 else:
734 d.addErrback(self._errback, ori_errback=errback)
735
736 def param_ui_get(
737 self,
738 security_limit=-1,
739 app="",
740 extra="",
741 profile_key="@DEFAULT@",
742 callback=None,
743 errback=None,
744 ):
565 d = self.root.callRemote("param_ui_get", security_limit, app, extra, profile_key) 745 d = self.root.callRemote("param_ui_get", security_limit, app, extra, profile_key)
566 if callback is not None: 746 if callback is not None:
567 d.addCallback(callback) 747 d.addCallback(callback)
568 if errback is None: 748 if errback is None:
569 d.addErrback(self._generic_errback) 749 d.addErrback(self._generic_errback)
577 if errback is None: 757 if errback is None:
578 d.addErrback(self._generic_errback) 758 d.addErrback(self._generic_errback)
579 else: 759 else:
580 d.addErrback(self._errback, ori_errback=errback) 760 d.addErrback(self._errback, ori_errback=errback)
581 761
582 def params_register_app(self, xml, security_limit=-1, app='', callback=None, errback=None): 762 def params_register_app(
763 self, xml, security_limit=-1, app="", callback=None, errback=None
764 ):
583 d = self.root.callRemote("params_register_app", xml, security_limit, app) 765 d = self.root.callRemote("params_register_app", xml, security_limit, app)
584 if callback is not None: 766 if callback is not None:
585 d.addCallback(lambda __: callback()) 767 d.addCallback(lambda __: callback())
586 if errback is None: 768 if errback is None:
587 d.addErrback(self._generic_errback) 769 d.addErrback(self._generic_errback)
604 if errback is None: 786 if errback is None:
605 d.addErrback(self._generic_errback) 787 d.addErrback(self._generic_errback)
606 else: 788 else:
607 d.addErrback(self._errback, ori_errback=errback) 789 d.addErrback(self._errback, ori_errback=errback)
608 790
609 def params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@", callback=None, errback=None): 791 def params_values_from_category_get_async(
610 d = self.root.callRemote("params_values_from_category_get_async", category, security_limit, app, extra, profile_key) 792 self,
611 if callback is not None: 793 category,
612 d.addCallback(callback) 794 security_limit=-1,
613 if errback is None: 795 app="",
614 d.addErrback(self._generic_errback) 796 extra="",
615 else: 797 profile_key="@DEFAULT@",
616 d.addErrback(self._errback, ori_errback=errback) 798 callback=None,
617 799 errback=None,
618 def presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None): 800 ):
801 d = self.root.callRemote(
802 "params_values_from_category_get_async",
803 category,
804 security_limit,
805 app,
806 extra,
807 profile_key,
808 )
809 if callback is not None:
810 d.addCallback(callback)
811 if errback is None:
812 d.addErrback(self._generic_errback)
813 else:
814 d.addErrback(self._errback, ori_errback=errback)
815
816 def presence_set(
817 self,
818 to_jid="",
819 show="",
820 statuses={},
821 profile_key="@DEFAULT@",
822 callback=None,
823 errback=None,
824 ):
619 d = self.root.callRemote("presence_set", to_jid, show, statuses, profile_key) 825 d = self.root.callRemote("presence_set", to_jid, show, statuses, profile_key)
620 if callback is not None: 826 if callback is not None:
621 d.addCallback(lambda __: callback()) 827 d.addCallback(lambda __: callback())
622 if errback is None: 828 if errback is None:
623 d.addErrback(self._generic_errback) 829 d.addErrback(self._generic_errback)
649 if errback is None: 855 if errback is None:
650 d.addErrback(self._generic_errback) 856 d.addErrback(self._generic_errback)
651 else: 857 else:
652 d.addErrback(self._errback, ori_errback=errback) 858 d.addErrback(self._errback, ori_errback=errback)
653 859
654 def private_data_set(self, namespace, key, data, profile_key, callback=None, errback=None): 860 def private_data_set(
861 self, namespace, key, data, profile_key, callback=None, errback=None
862 ):
655 d = self.root.callRemote("private_data_set", namespace, key, data, profile_key) 863 d = self.root.callRemote("private_data_set", namespace, key, data, profile_key)
656 if callback is not None: 864 if callback is not None:
657 d.addCallback(lambda __: callback()) 865 d.addCallback(lambda __: callback())
658 if errback is None: 866 if errback is None:
659 d.addErrback(self._generic_errback) 867 d.addErrback(self._generic_errback)
660 else: 868 else:
661 d.addErrback(self._errback, ori_errback=errback) 869 d.addErrback(self._errback, ori_errback=errback)
662 870
663 def profile_create(self, profile, password='', component='', callback=None, errback=None): 871 def profile_create(
872 self, profile, password="", component="", callback=None, errback=None
873 ):
664 d = self.root.callRemote("profile_create", profile, password, component) 874 d = self.root.callRemote("profile_create", profile, password, component)
665 if callback is not None: 875 if callback is not None:
666 d.addCallback(lambda __: callback()) 876 d.addCallback(lambda __: callback())
667 if errback is None: 877 if errback is None:
668 d.addErrback(self._generic_errback) 878 d.addErrback(self._generic_errback)
676 if errback is None: 886 if errback is None:
677 d.addErrback(self._generic_errback) 887 d.addErrback(self._generic_errback)
678 else: 888 else:
679 d.addErrback(self._errback, ori_errback=errback) 889 d.addErrback(self._errback, ori_errback=errback)
680 890
681 def profile_is_session_started(self, profile_key="@DEFAULT@", callback=None, errback=None): 891 def profile_is_session_started(
892 self, profile_key="@DEFAULT@", callback=None, errback=None
893 ):
682 d = self.root.callRemote("profile_is_session_started", profile_key) 894 d = self.root.callRemote("profile_is_session_started", profile_key)
683 if callback is not None: 895 if callback is not None:
684 d.addCallback(callback) 896 d.addCallback(callback)
685 if errback is None: 897 if errback is None:
686 d.addErrback(self._generic_errback) 898 d.addErrback(self._generic_errback)
703 if errback is None: 915 if errback is None:
704 d.addErrback(self._generic_errback) 916 d.addErrback(self._generic_errback)
705 else: 917 else:
706 d.addErrback(self._errback, ori_errback=errback) 918 d.addErrback(self._errback, ori_errback=errback)
707 919
708 def profile_start_session(self, password='', profile_key="@DEFAULT@", callback=None, errback=None): 920 def profile_start_session(
921 self, password="", profile_key="@DEFAULT@", callback=None, errback=None
922 ):
709 d = self.root.callRemote("profile_start_session", password, profile_key) 923 d = self.root.callRemote("profile_start_session", password, profile_key)
710 if callback is not None: 924 if callback is not None:
711 d.addCallback(callback) 925 d.addCallback(callback)
712 if errback is None: 926 if errback is None:
713 d.addErrback(self._generic_errback) 927 d.addErrback(self._generic_errback)
714 else: 928 else:
715 d.addErrback(self._errback, ori_errback=errback) 929 d.addErrback(self._errback, ori_errback=errback)
716 930
717 def profiles_list_get(self, clients=True, components=False, callback=None, errback=None): 931 def profiles_list_get(
932 self, clients=True, components=False, callback=None, errback=None
933 ):
718 d = self.root.callRemote("profiles_list_get", clients, components) 934 d = self.root.callRemote("profiles_list_get", clients, components)
719 if callback is not None: 935 if callback is not None:
720 d.addCallback(callback) 936 d.addCallback(callback)
721 if errback is None: 937 if errback is None:
722 d.addErrback(self._generic_errback) 938 d.addErrback(self._generic_errback)
784 if errback is None: 1000 if errback is None:
785 d.addErrback(self._generic_errback) 1001 d.addErrback(self._generic_errback)
786 else: 1002 else:
787 d.addErrback(self._errback, ori_errback=errback) 1003 d.addErrback(self._errback, ori_errback=errback)
788 1004
789 def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None): 1005 def subscription(
1006 self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None
1007 ):
790 d = self.root.callRemote("subscription", sub_type, entity, profile_key) 1008 d = self.root.callRemote("subscription", sub_type, entity, profile_key)
791 if callback is not None: 1009 if callback is not None:
792 d.addCallback(lambda __: callback()) 1010 d.addCallback(lambda __: callback())
793 if errback is None: 1011 if errback is None:
794 d.addErrback(self._generic_errback) 1012 d.addErrback(self._generic_errback)
807 1025
808 class AIOSignalsHandler(SignalsHandler): 1026 class AIOSignalsHandler(SignalsHandler):
809 1027
810 def register_signal(self, name, handler, iface="core"): 1028 def register_signal(self, name, handler, iface="core"):
811 async_handler = lambda *args, **kwargs: defer.Deferred.fromFuture( 1029 async_handler = lambda *args, **kwargs: defer.Deferred.fromFuture(
812 asyncio.ensure_future(handler(*args, **kwargs))) 1030 asyncio.ensure_future(handler(*args, **kwargs))
1031 )
813 return super().register_signal(name, async_handler, iface) 1032 return super().register_signal(name, async_handler, iface)
814 1033
815 1034
816 class AIOBridge(bridge): 1035 class AIOBridge(bridge):
817 1036
819 self.signals_handler = AIOSignalsHandler() 1038 self.signals_handler = AIOSignalsHandler()
820 1039
821 def _errback(self, failure_): 1040 def _errback(self, failure_):
822 """Convert Failure to BridgeException""" 1041 """Convert Failure to BridgeException"""
823 raise BridgeException( 1042 raise BridgeException(
824 name=failure_.type.decode('utf-8'), 1043 name=failure_.type.decode("utf-8"), message=str(failure_.value)
825 message=str(failure_.value) 1044 )
826 )
827 1045
828 def call(self, name, *args, **kwargs): 1046 def call(self, name, *args, **kwargs):
829 d = self.root.callRemote(name, *args, *kwargs) 1047 d = self.root.callRemote(name, *args, *kwargs)
830 d.addErrback(self._errback) 1048 d.addErrback(self._errback)
831 return d.asFuture(asyncio.get_event_loop()) 1049 return d.asFuture(asyncio.get_event_loop())
847 def config_get(self, section, name): 1065 def config_get(self, section, name):
848 d = self.root.callRemote("config_get", section, name) 1066 d = self.root.callRemote("config_get", section, name)
849 d.addErrback(self._errback) 1067 d.addErrback(self._errback)
850 return d.asFuture(asyncio.get_event_loop()) 1068 return d.asFuture(asyncio.get_event_loop())
851 1069
852 def connect(self, profile_key="@DEFAULT@", password='', options={}): 1070 def connect(self, profile_key="@DEFAULT@", password="", options={}):
853 d = self.root.callRemote("connect", profile_key, password, options) 1071 d = self.root.callRemote("connect", profile_key, password, options)
854 d.addErrback(self._errback) 1072 d.addErrback(self._errback)
855 return d.asFuture(asyncio.get_event_loop()) 1073 return d.asFuture(asyncio.get_event_loop())
856 1074
857 def contact_add(self, entity_jid, profile_key="@DEFAULT@"): 1075 def contact_add(self, entity_jid, profile_key="@DEFAULT@"):
887 def devices_infos_get(self, bare_jid, profile_key): 1105 def devices_infos_get(self, bare_jid, profile_key):
888 d = self.root.callRemote("devices_infos_get", bare_jid, profile_key) 1106 d = self.root.callRemote("devices_infos_get", bare_jid, profile_key)
889 d.addErrback(self._errback) 1107 d.addErrback(self._errback)
890 return d.asFuture(asyncio.get_event_loop()) 1108 return d.asFuture(asyncio.get_event_loop())
891 1109
892 def disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"): 1110 def disco_find_by_features(
893 d = self.root.callRemote("disco_find_by_features", namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key) 1111 self,
894 d.addErrback(self._errback) 1112 namespaces,
895 return d.asFuture(asyncio.get_event_loop()) 1113 identities,
896 1114 bare_jid=False,
897 def disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): 1115 service=True,
1116 roster=True,
1117 own_jid=True,
1118 local_device=False,
1119 profile_key="@DEFAULT@",
1120 ):
1121 d = self.root.callRemote(
1122 "disco_find_by_features",
1123 namespaces,
1124 identities,
1125 bare_jid,
1126 service,
1127 roster,
1128 own_jid,
1129 local_device,
1130 profile_key,
1131 )
1132 d.addErrback(self._errback)
1133 return d.asFuture(asyncio.get_event_loop())
1134
1135 def disco_infos(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"):
898 d = self.root.callRemote("disco_infos", entity_jid, node, use_cache, profile_key) 1136 d = self.root.callRemote("disco_infos", entity_jid, node, use_cache, profile_key)
899 d.addErrback(self._errback) 1137 d.addErrback(self._errback)
900 return d.asFuture(asyncio.get_event_loop()) 1138 return d.asFuture(asyncio.get_event_loop())
901 1139
902 def disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"): 1140 def disco_items(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"):
903 d = self.root.callRemote("disco_items", entity_jid, node, use_cache, profile_key) 1141 d = self.root.callRemote("disco_items", entity_jid, node, use_cache, profile_key)
904 d.addErrback(self._errback) 1142 d.addErrback(self._errback)
905 return d.asFuture(asyncio.get_event_loop()) 1143 return d.asFuture(asyncio.get_event_loop())
906 1144
907 def disconnect(self, profile_key="@DEFAULT@"): 1145 def disconnect(self, profile_key="@DEFAULT@"):
918 d = self.root.callRemote("encryption_plugins_get") 1156 d = self.root.callRemote("encryption_plugins_get")
919 d.addErrback(self._errback) 1157 d.addErrback(self._errback)
920 return d.asFuture(asyncio.get_event_loop()) 1158 return d.asFuture(asyncio.get_event_loop())
921 1159
922 def encryption_trust_ui_get(self, to_jid, namespace, profile_key): 1160 def encryption_trust_ui_get(self, to_jid, namespace, profile_key):
923 d = self.root.callRemote("encryption_trust_ui_get", to_jid, namespace, profile_key) 1161 d = self.root.callRemote(
1162 "encryption_trust_ui_get", to_jid, namespace, profile_key
1163 )
924 d.addErrback(self._errback) 1164 d.addErrback(self._errback)
925 return d.asFuture(asyncio.get_event_loop()) 1165 return d.asFuture(asyncio.get_event_loop())
926 1166
927 def entities_data_get(self, jids, keys, profile): 1167 def entities_data_get(self, jids, keys, profile):
928 d = self.root.callRemote("entities_data_get", jids, keys, profile) 1168 d = self.root.callRemote("entities_data_get", jids, keys, profile)
937 def features_get(self, profile_key): 1177 def features_get(self, profile_key):
938 d = self.root.callRemote("features_get", profile_key) 1178 d = self.root.callRemote("features_get", profile_key)
939 d.addErrback(self._errback) 1179 d.addErrback(self._errback)
940 return d.asFuture(asyncio.get_event_loop()) 1180 return d.asFuture(asyncio.get_event_loop())
941 1181
942 def history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"): 1182 def history_get(
943 d = self.root.callRemote("history_get", from_jid, to_jid, limit, between, filters, profile) 1183 self, from_jid, to_jid, limit, between=True, filters="", profile="@NONE@"
1184 ):
1185 d = self.root.callRemote(
1186 "history_get", from_jid, to_jid, limit, between, filters, profile
1187 )
944 d.addErrback(self._errback) 1188 d.addErrback(self._errback)
945 return d.asFuture(asyncio.get_event_loop()) 1189 return d.asFuture(asyncio.get_event_loop())
946 1190
947 def image_check(self, arg_0): 1191 def image_check(self, arg_0):
948 d = self.root.callRemote("image_check", arg_0) 1192 d = self.root.callRemote("image_check", arg_0)
983 d = self.root.callRemote("menu_help_get", menu_id, language) 1227 d = self.root.callRemote("menu_help_get", menu_id, language)
984 d.addErrback(self._errback) 1228 d.addErrback(self._errback)
985 return d.asFuture(asyncio.get_event_loop()) 1229 return d.asFuture(asyncio.get_event_loop())
986 1230
987 def menu_launch(self, menu_type, path, data, security_limit, profile_key): 1231 def menu_launch(self, menu_type, path, data, security_limit, profile_key):
988 d = self.root.callRemote("menu_launch", menu_type, path, data, security_limit, profile_key) 1232 d = self.root.callRemote(
1233 "menu_launch", menu_type, path, data, security_limit, profile_key
1234 )
989 d.addErrback(self._errback) 1235 d.addErrback(self._errback)
990 return d.asFuture(asyncio.get_event_loop()) 1236 return d.asFuture(asyncio.get_event_loop())
991 1237
992 def menus_get(self, language, security_limit): 1238 def menus_get(self, language, security_limit):
993 d = self.root.callRemote("menus_get", language, security_limit) 1239 d = self.root.callRemote("menus_get", language, security_limit)
997 def message_encryption_get(self, to_jid, profile_key): 1243 def message_encryption_get(self, to_jid, profile_key):
998 d = self.root.callRemote("message_encryption_get", to_jid, profile_key) 1244 d = self.root.callRemote("message_encryption_get", to_jid, profile_key)
999 d.addErrback(self._errback) 1245 d.addErrback(self._errback)
1000 return d.asFuture(asyncio.get_event_loop()) 1246 return d.asFuture(asyncio.get_event_loop())
1001 1247
1002 def message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@"): 1248 def message_encryption_start(
1003 d = self.root.callRemote("message_encryption_start", to_jid, namespace, replace, profile_key) 1249 self, to_jid, namespace="", replace=False, profile_key="@NONE@"
1250 ):
1251 d = self.root.callRemote(
1252 "message_encryption_start", to_jid, namespace, replace, profile_key
1253 )
1004 d.addErrback(self._errback) 1254 d.addErrback(self._errback)
1005 return d.asFuture(asyncio.get_event_loop()) 1255 return d.asFuture(asyncio.get_event_loop())
1006 1256
1007 def message_encryption_stop(self, to_jid, profile_key): 1257 def message_encryption_stop(self, to_jid, profile_key):
1008 d = self.root.callRemote("message_encryption_stop", to_jid, profile_key) 1258 d = self.root.callRemote("message_encryption_stop", to_jid, profile_key)
1009 d.addErrback(self._errback) 1259 d.addErrback(self._errback)
1010 return d.asFuture(asyncio.get_event_loop()) 1260 return d.asFuture(asyncio.get_event_loop())
1011 1261
1012 def message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"): 1262 def message_send(
1013 d = self.root.callRemote("message_send", to_jid, message, subject, mess_type, extra, profile_key) 1263 self,
1264 to_jid,
1265 message,
1266 subject={},
1267 mess_type="auto",
1268 extra={},
1269 profile_key="@NONE@",
1270 ):
1271 d = self.root.callRemote(
1272 "message_send", to_jid, message, subject, mess_type, extra, profile_key
1273 )
1014 d.addErrback(self._errback) 1274 d.addErrback(self._errback)
1015 return d.asFuture(asyncio.get_event_loop()) 1275 return d.asFuture(asyncio.get_event_loop())
1016 1276
1017 def namespaces_get(self): 1277 def namespaces_get(self):
1018 d = self.root.callRemote("namespaces_get") 1278 d = self.root.callRemote("namespaces_get")
1019 d.addErrback(self._errback) 1279 d.addErrback(self._errback)
1020 return d.asFuture(asyncio.get_event_loop()) 1280 return d.asFuture(asyncio.get_event_loop())
1021 1281
1022 def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra): 1282 def notification_add(
1023 d = self.root.callRemote("notification_add", type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra) 1283 self,
1284 type_,
1285 body_plain,
1286 body_rich,
1287 title,
1288 is_global,
1289 requires_action,
1290 arg_6,
1291 priority,
1292 expire_at,
1293 extra,
1294 ):
1295 d = self.root.callRemote(
1296 "notification_add",
1297 type_,
1298 body_plain,
1299 body_rich,
1300 title,
1301 is_global,
1302 requires_action,
1303 arg_6,
1304 priority,
1305 expire_at,
1306 extra,
1307 )
1024 d.addErrback(self._errback) 1308 d.addErrback(self._errback)
1025 return d.asFuture(asyncio.get_event_loop()) 1309 return d.asFuture(asyncio.get_event_loop())
1026 1310
1027 def notification_delete(self, id_, is_global, profile_key): 1311 def notification_delete(self, id_, is_global, profile_key):
1028 d = self.root.callRemote("notification_delete", id_, is_global, profile_key) 1312 d = self.root.callRemote("notification_delete", id_, is_global, profile_key)
1029 d.addErrback(self._errback) 1313 d.addErrback(self._errback)
1030 return d.asFuture(asyncio.get_event_loop()) 1314 return d.asFuture(asyncio.get_event_loop())
1031 1315
1032 def notifications_expired_clean(self, limit_timestamp, profile_key): 1316 def notifications_expired_clean(self, limit_timestamp, profile_key):
1033 d = self.root.callRemote("notifications_expired_clean", limit_timestamp, profile_key) 1317 d = self.root.callRemote(
1318 "notifications_expired_clean", limit_timestamp, profile_key
1319 )
1034 d.addErrback(self._errback) 1320 d.addErrback(self._errback)
1035 return d.asFuture(asyncio.get_event_loop()) 1321 return d.asFuture(asyncio.get_event_loop())
1036 1322
1037 def notifications_get(self, filters, profile_key): 1323 def notifications_get(self, filters, profile_key):
1038 d = self.root.callRemote("notifications_get", filters, profile_key) 1324 d = self.root.callRemote("notifications_get", filters, profile_key)
1042 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): 1328 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"):
1043 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key) 1329 d = self.root.callRemote("param_get_a", name, category, attribute, profile_key)
1044 d.addErrback(self._errback) 1330 d.addErrback(self._errback)
1045 return d.asFuture(asyncio.get_event_loop()) 1331 return d.asFuture(asyncio.get_event_loop())
1046 1332
1047 def param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"): 1333 def param_get_a_async(
1048 d = self.root.callRemote("param_get_a_async", name, category, attribute, security_limit, profile_key) 1334 self,
1049 d.addErrback(self._errback) 1335 name,
1050 return d.asFuture(asyncio.get_event_loop()) 1336 category,
1051 1337 attribute="value",
1052 def param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"): 1338 security_limit=-1,
1053 d = self.root.callRemote("param_set", name, value, category, security_limit, profile_key) 1339 profile_key="@DEFAULT@",
1054 d.addErrback(self._errback) 1340 ):
1055 return d.asFuture(asyncio.get_event_loop()) 1341 d = self.root.callRemote(
1056 1342 "param_get_a_async", name, category, attribute, security_limit, profile_key
1057 def param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"): 1343 )
1344 d.addErrback(self._errback)
1345 return d.asFuture(asyncio.get_event_loop())
1346
1347 def param_set(
1348 self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"
1349 ):
1350 d = self.root.callRemote(
1351 "param_set", name, value, category, security_limit, profile_key
1352 )
1353 d.addErrback(self._errback)
1354 return d.asFuture(asyncio.get_event_loop())
1355
1356 def param_ui_get(self, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"):
1058 d = self.root.callRemote("param_ui_get", security_limit, app, extra, profile_key) 1357 d = self.root.callRemote("param_ui_get", security_limit, app, extra, profile_key)
1059 d.addErrback(self._errback) 1358 d.addErrback(self._errback)
1060 return d.asFuture(asyncio.get_event_loop()) 1359 return d.asFuture(asyncio.get_event_loop())
1061 1360
1062 def params_categories_get(self): 1361 def params_categories_get(self):
1063 d = self.root.callRemote("params_categories_get") 1362 d = self.root.callRemote("params_categories_get")
1064 d.addErrback(self._errback) 1363 d.addErrback(self._errback)
1065 return d.asFuture(asyncio.get_event_loop()) 1364 return d.asFuture(asyncio.get_event_loop())
1066 1365
1067 def params_register_app(self, xml, security_limit=-1, app=''): 1366 def params_register_app(self, xml, security_limit=-1, app=""):
1068 d = self.root.callRemote("params_register_app", xml, security_limit, app) 1367 d = self.root.callRemote("params_register_app", xml, security_limit, app)
1069 d.addErrback(self._errback) 1368 d.addErrback(self._errback)
1070 return d.asFuture(asyncio.get_event_loop()) 1369 return d.asFuture(asyncio.get_event_loop())
1071 1370
1072 def params_template_load(self, filename): 1371 def params_template_load(self, filename):
1077 def params_template_save(self, filename): 1376 def params_template_save(self, filename):
1078 d = self.root.callRemote("params_template_save", filename) 1377 d = self.root.callRemote("params_template_save", filename)
1079 d.addErrback(self._errback) 1378 d.addErrback(self._errback)
1080 return d.asFuture(asyncio.get_event_loop()) 1379 return d.asFuture(asyncio.get_event_loop())
1081 1380
1082 def params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"): 1381 def params_values_from_category_get_async(
1083 d = self.root.callRemote("params_values_from_category_get_async", category, security_limit, app, extra, profile_key) 1382 self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"
1084 d.addErrback(self._errback) 1383 ):
1085 return d.asFuture(asyncio.get_event_loop()) 1384 d = self.root.callRemote(
1086 1385 "params_values_from_category_get_async",
1087 def presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"): 1386 category,
1387 security_limit,
1388 app,
1389 extra,
1390 profile_key,
1391 )
1392 d.addErrback(self._errback)
1393 return d.asFuture(asyncio.get_event_loop())
1394
1395 def presence_set(self, to_jid="", show="", statuses={}, profile_key="@DEFAULT@"):
1088 d = self.root.callRemote("presence_set", to_jid, show, statuses, profile_key) 1396 d = self.root.callRemote("presence_set", to_jid, show, statuses, profile_key)
1089 d.addErrback(self._errback) 1397 d.addErrback(self._errback)
1090 return d.asFuture(asyncio.get_event_loop()) 1398 return d.asFuture(asyncio.get_event_loop())
1091 1399
1092 def presence_statuses_get(self, profile_key="@DEFAULT@"): 1400 def presence_statuses_get(self, profile_key="@DEFAULT@"):
1107 def private_data_set(self, namespace, key, data, profile_key): 1415 def private_data_set(self, namespace, key, data, profile_key):
1108 d = self.root.callRemote("private_data_set", namespace, key, data, profile_key) 1416 d = self.root.callRemote("private_data_set", namespace, key, data, profile_key)
1109 d.addErrback(self._errback) 1417 d.addErrback(self._errback)
1110 return d.asFuture(asyncio.get_event_loop()) 1418 return d.asFuture(asyncio.get_event_loop())
1111 1419
1112 def profile_create(self, profile, password='', component=''): 1420 def profile_create(self, profile, password="", component=""):
1113 d = self.root.callRemote("profile_create", profile, password, component) 1421 d = self.root.callRemote("profile_create", profile, password, component)
1114 d.addErrback(self._errback) 1422 d.addErrback(self._errback)
1115 return d.asFuture(asyncio.get_event_loop()) 1423 return d.asFuture(asyncio.get_event_loop())
1116 1424
1117 def profile_delete_async(self, profile): 1425 def profile_delete_async(self, profile):
1132 def profile_set_default(self, profile): 1440 def profile_set_default(self, profile):
1133 d = self.root.callRemote("profile_set_default", profile) 1441 d = self.root.callRemote("profile_set_default", profile)
1134 d.addErrback(self._errback) 1442 d.addErrback(self._errback)
1135 return d.asFuture(asyncio.get_event_loop()) 1443 return d.asFuture(asyncio.get_event_loop())
1136 1444
1137 def profile_start_session(self, password='', profile_key="@DEFAULT@"): 1445 def profile_start_session(self, password="", profile_key="@DEFAULT@"):
1138 d = self.root.callRemote("profile_start_session", password, profile_key) 1446 d = self.root.callRemote("profile_start_session", password, profile_key)
1139 d.addErrback(self._errback) 1447 d.addErrback(self._errback)
1140 return d.asFuture(asyncio.get_event_loop()) 1448 return d.asFuture(asyncio.get_event_loop())
1141 1449
1142 def profiles_list_get(self, clients=True, components=False): 1450 def profiles_list_get(self, clients=True, components=False):