comparison sat_frontends/bridge/pb.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 e347e32aa07f
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2764:92af49cde255 2765:378188abe941
117 def bridgeConnect(self, callback, errback): 117 def bridgeConnect(self, callback, errback):
118 factory = pb.PBClientFactory() 118 factory = pb.PBClientFactory()
119 reactor.connectTCP("localhost", 8789, factory) 119 reactor.connectTCP("localhost", 8789, factory)
120 d = factory.getRootObject() 120 d = factory.getRootObject()
121 d.addCallback(self._set_root) 121 d.addCallback(self._set_root)
122 d.addCallback(lambda dummy: callback()) 122 d.addCallback(lambda __: callback())
123 d.addErrback(errback) 123 d.addErrback(errback)
124 124
125 def register_signal(self, functionName, handler, iface="core"): 125 def register_signal(self, functionName, handler, iface="core"):
126 self.signals_handler.register_signal(functionName, handler, iface) 126 self.signals_handler.register_signal(functionName, handler, iface)
127 127
135 d.addErrback(errback) 135 d.addErrback(errback)
136 136
137 def addContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): 137 def addContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
138 d = self.root.callRemote("addContact", entity_jid, profile_key) 138 d = self.root.callRemote("addContact", entity_jid, profile_key)
139 if callback is not None: 139 if callback is not None:
140 d.addCallback(lambda dummy: callback()) 140 d.addCallback(lambda __: callback())
141 if errback is None: 141 if errback is None:
142 errback = self._generic_errback 142 errback = self._generic_errback
143 d.addErrback(errback) 143 d.addErrback(errback)
144 144
145 def asyncDeleteProfile(self, profile, callback=None, errback=None): 145 def asyncDeleteProfile(self, profile, callback=None, errback=None):
146 d = self.root.callRemote("asyncDeleteProfile", profile) 146 d = self.root.callRemote("asyncDeleteProfile", profile)
147 if callback is not None: 147 if callback is not None:
148 d.addCallback(lambda dummy: callback()) 148 d.addCallback(lambda __: callback())
149 if errback is None: 149 if errback is None:
150 errback = self._generic_errback 150 errback = self._generic_errback
151 d.addErrback(errback) 151 d.addErrback(errback)
152 152
153 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): 153 def asyncGetParamA(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
175 d.addErrback(errback) 175 d.addErrback(errback)
176 176
177 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None): 177 def delContact(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
178 d = self.root.callRemote("delContact", entity_jid, profile_key) 178 d = self.root.callRemote("delContact", entity_jid, profile_key)
179 if callback is not None: 179 if callback is not None:
180 d.addCallback(lambda dummy: callback()) 180 d.addCallback(lambda __: callback())
181 if errback is None: 181 if errback is None:
182 errback = self._generic_errback 182 errback = self._generic_errback
183 d.addErrback(errback) 183 d.addErrback(errback)
184 184
185 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key=u"@DEFAULT@", callback=None, errback=None): 185 def discoFindByFeatures(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key=u"@DEFAULT@", callback=None, errback=None):
207 d.addErrback(errback) 207 d.addErrback(errback)
208 208
209 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None): 209 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
210 d = self.root.callRemote("disconnect", profile_key) 210 d = self.root.callRemote("disconnect", profile_key)
211 if callback is not None: 211 if callback is not None:
212 d.addCallback(lambda dummy: callback()) 212 d.addCallback(lambda __: callback())
213 if errback is None: 213 if errback is None:
214 errback = self._generic_errback 214 errback = self._generic_errback
215 d.addErrback(errback) 215 d.addErrback(errback)
216 216
217 def encryptionNamespaceGet(self, arg_0, callback=None, errback=None): 217 def encryptionNamespaceGet(self, arg_0, callback=None, errback=None):
327 d.addErrback(errback) 327 d.addErrback(errback)
328 328
329 def getReady(self, callback=None, errback=None): 329 def getReady(self, callback=None, errback=None):
330 d = self.root.callRemote("getReady") 330 d = self.root.callRemote("getReady")
331 if callback is not None: 331 if callback is not None:
332 d.addCallback(lambda dummy: callback()) 332 d.addCallback(lambda __: callback())
333 if errback is None: 333 if errback is None:
334 errback = self._generic_errback 334 errback = self._generic_errback
335 d.addErrback(errback) 335 d.addErrback(errback)
336 336
337 def getVersion(self, callback=None, errback=None): 337 def getVersion(self, callback=None, errback=None):
415 d.addErrback(errback) 415 d.addErrback(errback)
416 416
417 def messageEncryptionStart(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None): 417 def messageEncryptionStart(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None):
418 d = self.root.callRemote("messageEncryptionStart", to_jid, namespace, replace, profile_key) 418 d = self.root.callRemote("messageEncryptionStart", to_jid, namespace, replace, profile_key)
419 if callback is not None: 419 if callback is not None:
420 d.addCallback(lambda dummy: callback()) 420 d.addCallback(lambda __: callback())
421 if errback is None: 421 if errback is None:
422 errback = self._generic_errback 422 errback = self._generic_errback
423 d.addErrback(errback) 423 d.addErrback(errback)
424 424
425 def messageEncryptionStop(self, to_jid, profile_key, callback=None, errback=None): 425 def messageEncryptionStop(self, to_jid, profile_key, callback=None, errback=None):
426 d = self.root.callRemote("messageEncryptionStop", to_jid, profile_key) 426 d = self.root.callRemote("messageEncryptionStop", to_jid, profile_key)
427 if callback is not None: 427 if callback is not None:
428 d.addCallback(lambda dummy: callback()) 428 d.addCallback(lambda __: callback())
429 if errback is None: 429 if errback is None:
430 errback = self._generic_errback 430 errback = self._generic_errback
431 d.addErrback(errback) 431 d.addErrback(errback)
432 432
433 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None): 433 def messageSend(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
434 d = self.root.callRemote("messageSend", to_jid, message, subject, mess_type, extra, profile_key) 434 d = self.root.callRemote("messageSend", to_jid, message, subject, mess_type, extra, profile_key)
435 if callback is not None: 435 if callback is not None:
436 d.addCallback(lambda dummy: callback()) 436 d.addCallback(lambda __: callback())
437 if errback is None: 437 if errback is None:
438 errback = self._generic_errback 438 errback = self._generic_errback
439 d.addErrback(errback) 439 d.addErrback(errback)
440 440
441 def namespacesGet(self, callback=None, errback=None): 441 def namespacesGet(self, callback=None, errback=None):
447 d.addErrback(errback) 447 d.addErrback(errback)
448 448
449 def paramsRegisterApp(self, xml, security_limit=-1, app='', callback=None, errback=None): 449 def paramsRegisterApp(self, xml, security_limit=-1, app='', callback=None, errback=None):
450 d = self.root.callRemote("paramsRegisterApp", xml, security_limit, app) 450 d = self.root.callRemote("paramsRegisterApp", xml, security_limit, app)
451 if callback is not None: 451 if callback is not None:
452 d.addCallback(lambda dummy: callback()) 452 d.addCallback(lambda __: callback())
453 if errback is None: 453 if errback is None:
454 errback = self._generic_errback 454 errback = self._generic_errback
455 d.addErrback(errback) 455 d.addErrback(errback)
456 456
457 def profileCreate(self, profile, password='', component='', callback=None, errback=None): 457 def profileCreate(self, profile, password='', component='', callback=None, errback=None):
458 d = self.root.callRemote("profileCreate", profile, password, component) 458 d = self.root.callRemote("profileCreate", profile, password, component)
459 if callback is not None: 459 if callback is not None:
460 d.addCallback(lambda dummy: callback()) 460 d.addCallback(lambda __: callback())
461 if errback is None: 461 if errback is None:
462 errback = self._generic_errback 462 errback = self._generic_errback
463 d.addErrback(errback) 463 d.addErrback(errback)
464 464
465 def profileIsSessionStarted(self, profile_key="@DEFAULT@", callback=None, errback=None): 465 def profileIsSessionStarted(self, profile_key="@DEFAULT@", callback=None, errback=None):
479 d.addErrback(errback) 479 d.addErrback(errback)
480 480
481 def profileSetDefault(self, profile, callback=None, errback=None): 481 def profileSetDefault(self, profile, callback=None, errback=None):
482 d = self.root.callRemote("profileSetDefault", profile) 482 d = self.root.callRemote("profileSetDefault", profile)
483 if callback is not None: 483 if callback is not None:
484 d.addCallback(lambda dummy: callback()) 484 d.addCallback(lambda __: callback())
485 if errback is None: 485 if errback is None:
486 errback = self._generic_errback 486 errback = self._generic_errback
487 d.addErrback(errback) 487 d.addErrback(errback)
488 488
489 def profileStartSession(self, password='', profile_key="@DEFAULT@", callback=None, errback=None): 489 def profileStartSession(self, password='', profile_key="@DEFAULT@", callback=None, errback=None):
543 d.addErrback(errback) 543 d.addErrback(errback)
544 544
545 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None): 545 def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
546 d = self.root.callRemote("setParam", name, value, category, security_limit, profile_key) 546 d = self.root.callRemote("setParam", name, value, category, security_limit, profile_key)
547 if callback is not None: 547 if callback is not None:
548 d.addCallback(lambda dummy: callback()) 548 d.addCallback(lambda __: callback())
549 if errback is None: 549 if errback is None:
550 errback = self._generic_errback 550 errback = self._generic_errback
551 d.addErrback(errback) 551 d.addErrback(errback)
552 552
553 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None): 553 def setPresence(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None):
554 d = self.root.callRemote("setPresence", to_jid, show, statuses, profile_key) 554 d = self.root.callRemote("setPresence", to_jid, show, statuses, profile_key)
555 if callback is not None: 555 if callback is not None:
556 d.addCallback(lambda dummy: callback()) 556 d.addCallback(lambda __: callback())
557 if errback is None: 557 if errback is None:
558 errback = self._generic_errback 558 errback = self._generic_errback
559 d.addErrback(errback) 559 d.addErrback(errback)
560 560
561 def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None): 561 def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None):
562 d = self.root.callRemote("subscription", sub_type, entity, profile_key) 562 d = self.root.callRemote("subscription", sub_type, entity, profile_key)
563 if callback is not None: 563 if callback is not None:
564 d.addCallback(lambda dummy: callback()) 564 d.addCallback(lambda __: callback())
565 if errback is None: 565 if errback is None:
566 errback = self._generic_errback 566 errback = self._generic_errback
567 d.addErrback(errback) 567 d.addErrback(errback)
568 568
569 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None): 569 def updateContact(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None):
570 d = self.root.callRemote("updateContact", entity_jid, name, groups, profile_key) 570 d = self.root.callRemote("updateContact", entity_jid, name, groups, profile_key)
571 if callback is not None: 571 if callback is not None:
572 d.addCallback(lambda dummy: callback()) 572 d.addCallback(lambda __: callback())
573 if errback is None: 573 if errback is None:
574 errback = self._generic_errback 574 errback = self._generic_errback
575 d.addErrback(errback) 575 d.addErrback(errback)