comparison libervia/frontends/bridge/dbus_bridge.py @ 4280:4cf98f506269

bridge(constructor): fix template parsing, which was broken following `black` reformating.
author Goffi <goffi@goffi.org>
date Fri, 12 Jul 2024 17:58:06 +0200
parents 0d7bb4df2343
children 3a550e9a2b55
comparison
equal deleted inserted replaced
4279:6276242736c3 4280:4cf98f506269
171 return self.db_plugin_iface.get_dbus_method(name)(*args, **kwargs) 171 return self.db_plugin_iface.get_dbus_method(name)(*args, **kwargs)
172 raise e 172 raise e
173 173
174 return get_plugin_method 174 return get_plugin_method
175 175
176 def action_launch( 176
177 self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None 177 def action_launch(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None):
178 ): 178 if callback is None:
179 if callback is None: 179 error_handler = None
180 error_handler = None 180 else:
181 else: 181 if errback is None:
182 if errback is None: 182 errback = log.error
183 errback = log.error 183 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
184 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 184 return str(self.db_core_iface.action_launch(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
185 return str(
186 self.db_core_iface.action_launch(
187 callback_id,
188 data,
189 profile_key,
190 timeout=const_TIMEOUT,
191 reply_handler=callback,
192 error_handler=error_handler,
193 )
194 )
195 185
196 def actions_get(self, profile_key="@DEFAULT@", callback=None, errback=None): 186 def actions_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
197 if callback is None: 187 if callback is None:
198 error_handler = None 188 error_handler = None
199 else: 189 else:
200 if errback is None: 190 if errback is None:
201 errback = log.error 191 errback = log.error
202 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 192 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
203 kwargs = {} 193 kwargs={}
204 if callback is not None: 194 if callback is not None:
205 kwargs["timeout"] = const_TIMEOUT 195 kwargs['timeout'] = const_TIMEOUT
206 kwargs["reply_handler"] = callback 196 kwargs['reply_handler'] = callback
207 kwargs["error_handler"] = error_handler 197 kwargs['error_handler'] = error_handler
208 return self.db_core_iface.actions_get(profile_key, **kwargs) 198 return self.db_core_iface.actions_get(profile_key, **kwargs)
209 199
210 def config_get(self, section, name, callback=None, errback=None): 200 def config_get(self, section, name, callback=None, errback=None):
211 if callback is None: 201 if callback is None:
212 error_handler = None 202 error_handler = None
213 else: 203 else:
214 if errback is None: 204 if errback is None:
215 errback = log.error 205 errback = log.error
216 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 206 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
217 kwargs = {} 207 kwargs={}
218 if callback is not None: 208 if callback is not None:
219 kwargs["timeout"] = const_TIMEOUT 209 kwargs['timeout'] = const_TIMEOUT
220 kwargs["reply_handler"] = callback 210 kwargs['reply_handler'] = callback
221 kwargs["error_handler"] = error_handler 211 kwargs['error_handler'] = error_handler
222 return str(self.db_core_iface.config_get(section, name, **kwargs)) 212 return str(self.db_core_iface.config_get(section, name, **kwargs))
223 213
224 def connect( 214 def connect(self, profile_key="@DEFAULT@", password='', options={}, callback=None, errback=None):
225 self, 215 if callback is None:
226 profile_key="@DEFAULT@", 216 error_handler = None
227 password="", 217 else:
228 options={}, 218 if errback is None:
229 callback=None, 219 errback = log.error
230 errback=None, 220 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
231 ): 221 return self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
232 if callback is None: 222
233 error_handler = None 223 def contact_add(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
234 else: 224 if callback is None:
235 if errback is None: 225 error_handler = None
236 errback = log.error 226 else:
237 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 227 if errback is None:
238 return self.db_core_iface.connect( 228 errback = log.error
239 profile_key, 229 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
240 password, 230 kwargs={}
241 options, 231 if callback is not None:
242 timeout=const_TIMEOUT, 232 kwargs['timeout'] = const_TIMEOUT
243 reply_handler=callback, 233 kwargs['reply_handler'] = callback
244 error_handler=error_handler, 234 kwargs['error_handler'] = error_handler
245 )
246
247 def contact_add(
248 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None
249 ):
250 if callback is None:
251 error_handler = None
252 else:
253 if errback is None:
254 errback = log.error
255 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
256 kwargs = {}
257 if callback is not None:
258 kwargs["timeout"] = const_TIMEOUT
259 kwargs["reply_handler"] = callback
260 kwargs["error_handler"] = error_handler
261 return self.db_core_iface.contact_add(entity_jid, profile_key, **kwargs) 235 return self.db_core_iface.contact_add(entity_jid, profile_key, **kwargs)
262 236
263 def contact_del( 237 def contact_del(self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None):
264 self, entity_jid, profile_key="@DEFAULT@", callback=None, errback=None 238 if callback is None:
265 ): 239 error_handler = None
266 if callback is None: 240 else:
267 error_handler = None 241 if errback is None:
268 else: 242 errback = log.error
269 if errback is None: 243 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
270 errback = log.error 244 return self.db_core_iface.contact_del(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
271 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
272 return self.db_core_iface.contact_del(
273 entity_jid,
274 profile_key,
275 timeout=const_TIMEOUT,
276 reply_handler=callback,
277 error_handler=error_handler,
278 )
279 245
280 def contact_get(self, arg_0, profile_key="@DEFAULT@", callback=None, errback=None): 246 def contact_get(self, arg_0, profile_key="@DEFAULT@", callback=None, errback=None):
281 if callback is None: 247 if callback is None:
282 error_handler = None 248 error_handler = None
283 else: 249 else:
284 if errback is None: 250 if errback is None:
285 errback = log.error 251 errback = log.error
286 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 252 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
287 return self.db_core_iface.contact_get( 253 return self.db_core_iface.contact_get(arg_0, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
288 arg_0, 254
289 profile_key, 255 def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@", callback=None, errback=None):
290 timeout=const_TIMEOUT, 256 if callback is None:
291 reply_handler=callback, 257 error_handler = None
292 error_handler=error_handler, 258 else:
293 ) 259 if errback is None:
294 260 errback = log.error
295 def contact_update( 261 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
296 self, 262 kwargs={}
297 entity_jid, 263 if callback is not None:
298 name, 264 kwargs['timeout'] = const_TIMEOUT
299 groups, 265 kwargs['reply_handler'] = callback
300 profile_key="@DEFAULT@", 266 kwargs['error_handler'] = error_handler
301 callback=None, 267 return self.db_core_iface.contact_update(entity_jid, name, groups, profile_key, **kwargs)
302 errback=None,
303 ):
304 if callback is None:
305 error_handler = None
306 else:
307 if errback is None:
308 errback = log.error
309 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
310 kwargs = {}
311 if callback is not None:
312 kwargs["timeout"] = const_TIMEOUT
313 kwargs["reply_handler"] = callback
314 kwargs["error_handler"] = error_handler
315 return self.db_core_iface.contact_update(
316 entity_jid, name, groups, profile_key, **kwargs
317 )
318 268
319 def contacts_get(self, profile_key="@DEFAULT@", callback=None, errback=None): 269 def contacts_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
320 if callback is None: 270 if callback is None:
321 error_handler = None 271 error_handler = None
322 else: 272 else:
323 if errback is None: 273 if errback is None:
324 errback = log.error 274 errback = log.error
325 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 275 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
326 return self.db_core_iface.contacts_get( 276 return self.db_core_iface.contacts_get(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
327 profile_key, 277
328 timeout=const_TIMEOUT, 278 def contacts_get_from_group(self, group, profile_key="@DEFAULT@", callback=None, errback=None):
329 reply_handler=callback, 279 if callback is None:
330 error_handler=error_handler, 280 error_handler = None
331 ) 281 else:
332 282 if errback is None:
333 def contacts_get_from_group( 283 errback = log.error
334 self, group, profile_key="@DEFAULT@", callback=None, errback=None 284 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
335 ): 285 kwargs={}
336 if callback is None: 286 if callback is not None:
337 error_handler = None 287 kwargs['timeout'] = const_TIMEOUT
338 else: 288 kwargs['reply_handler'] = callback
339 if errback is None: 289 kwargs['error_handler'] = error_handler
340 errback = log.error
341 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
342 kwargs = {}
343 if callback is not None:
344 kwargs["timeout"] = const_TIMEOUT
345 kwargs["reply_handler"] = callback
346 kwargs["error_handler"] = error_handler
347 return self.db_core_iface.contacts_get_from_group(group, profile_key, **kwargs) 290 return self.db_core_iface.contacts_get_from_group(group, profile_key, **kwargs)
348 291
349 def devices_infos_get(self, bare_jid, profile_key, callback=None, errback=None): 292 def devices_infos_get(self, bare_jid, profile_key, callback=None, errback=None):
350 if callback is None: 293 if callback is None:
351 error_handler = None 294 error_handler = None
352 else: 295 else:
353 if errback is None: 296 if errback is None:
354 errback = log.error 297 errback = log.error
355 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 298 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
356 return str( 299 return str(self.db_core_iface.devices_infos_get(bare_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
357 self.db_core_iface.devices_infos_get( 300
358 bare_jid, 301 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):
359 profile_key, 302 if callback is None:
360 timeout=const_TIMEOUT, 303 error_handler = None
361 reply_handler=callback, 304 else:
362 error_handler=error_handler, 305 if errback is None:
363 ) 306 errback = log.error
364 ) 307 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
365 308 return self.db_core_iface.disco_find_by_features(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
366 def disco_find_by_features( 309
367 self, 310 def disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
368 namespaces, 311 if callback is None:
369 identities, 312 error_handler = None
370 bare_jid=False, 313 else:
371 service=True, 314 if errback is None:
372 roster=True, 315 errback = log.error
373 own_jid=True, 316 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
374 local_device=False, 317 return self.db_core_iface.disco_infos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
375 profile_key="@DEFAULT@", 318
376 callback=None, 319 def disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@", callback=None, errback=None):
377 errback=None, 320 if callback is None:
378 ): 321 error_handler = None
379 if callback is None: 322 else:
380 error_handler = None 323 if errback is None:
381 else: 324 errback = log.error
382 if errback is None: 325 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
383 errback = log.error 326 return self.db_core_iface.disco_items(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
384 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
385 return self.db_core_iface.disco_find_by_features(
386 namespaces,
387 identities,
388 bare_jid,
389 service,
390 roster,
391 own_jid,
392 local_device,
393 profile_key,
394 timeout=const_TIMEOUT,
395 reply_handler=callback,
396 error_handler=error_handler,
397 )
398
399 def disco_infos(
400 self,
401 entity_jid,
402 node="",
403 use_cache=True,
404 profile_key="@DEFAULT@",
405 callback=None,
406 errback=None,
407 ):
408 if callback is None:
409 error_handler = None
410 else:
411 if errback is None:
412 errback = log.error
413 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
414 return self.db_core_iface.disco_infos(
415 entity_jid,
416 node,
417 use_cache,
418 profile_key,
419 timeout=const_TIMEOUT,
420 reply_handler=callback,
421 error_handler=error_handler,
422 )
423
424 def disco_items(
425 self,
426 entity_jid,
427 node="",
428 use_cache=True,
429 profile_key="@DEFAULT@",
430 callback=None,
431 errback=None,
432 ):
433 if callback is None:
434 error_handler = None
435 else:
436 if errback is None:
437 errback = log.error
438 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
439 return self.db_core_iface.disco_items(
440 entity_jid,
441 node,
442 use_cache,
443 profile_key,
444 timeout=const_TIMEOUT,
445 reply_handler=callback,
446 error_handler=error_handler,
447 )
448 327
449 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None): 328 def disconnect(self, profile_key="@DEFAULT@", callback=None, errback=None):
450 if callback is None: 329 if callback is None:
451 error_handler = None 330 error_handler = None
452 else: 331 else:
453 if errback is None: 332 if errback is None:
454 errback = log.error 333 errback = log.error
455 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 334 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
456 return self.db_core_iface.disconnect( 335 return self.db_core_iface.disconnect(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
457 profile_key,
458 timeout=const_TIMEOUT,
459 reply_handler=callback,
460 error_handler=error_handler,
461 )
462 336
463 def encryption_namespace_get(self, arg_0, callback=None, errback=None): 337 def encryption_namespace_get(self, arg_0, callback=None, errback=None):
464 if callback is None: 338 if callback is None:
465 error_handler = None 339 error_handler = None
466 else: 340 else:
467 if errback is None: 341 if errback is None:
468 errback = log.error 342 errback = log.error
469 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 343 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
470 kwargs = {} 344 kwargs={}
471 if callback is not None: 345 if callback is not None:
472 kwargs["timeout"] = const_TIMEOUT 346 kwargs['timeout'] = const_TIMEOUT
473 kwargs["reply_handler"] = callback 347 kwargs['reply_handler'] = callback
474 kwargs["error_handler"] = error_handler 348 kwargs['error_handler'] = error_handler
475 return str(self.db_core_iface.encryption_namespace_get(arg_0, **kwargs)) 349 return str(self.db_core_iface.encryption_namespace_get(arg_0, **kwargs))
476 350
477 def encryption_plugins_get(self, callback=None, errback=None): 351 def encryption_plugins_get(self, callback=None, errback=None):
478 if callback is None: 352 if callback is None:
479 error_handler = None 353 error_handler = None
480 else: 354 else:
481 if errback is None: 355 if errback is None:
482 errback = log.error 356 errback = log.error
483 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 357 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
484 kwargs = {} 358 kwargs={}
485 if callback is not None: 359 if callback is not None:
486 kwargs["timeout"] = const_TIMEOUT 360 kwargs['timeout'] = const_TIMEOUT
487 kwargs["reply_handler"] = callback 361 kwargs['reply_handler'] = callback
488 kwargs["error_handler"] = error_handler 362 kwargs['error_handler'] = error_handler
489 return str(self.db_core_iface.encryption_plugins_get(**kwargs)) 363 return str(self.db_core_iface.encryption_plugins_get(**kwargs))
490 364
491 def encryption_trust_ui_get( 365 def encryption_trust_ui_get(self, to_jid, namespace, profile_key, callback=None, errback=None):
492 self, to_jid, namespace, profile_key, callback=None, errback=None 366 if callback is None:
493 ): 367 error_handler = None
494 if callback is None: 368 else:
495 error_handler = None 369 if errback is None:
496 else: 370 errback = log.error
497 if errback is None: 371 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
498 errback = log.error 372 return str(self.db_core_iface.encryption_trust_ui_get(to_jid, namespace, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
499 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
500 return str(
501 self.db_core_iface.encryption_trust_ui_get(
502 to_jid,
503 namespace,
504 profile_key,
505 timeout=const_TIMEOUT,
506 reply_handler=callback,
507 error_handler=error_handler,
508 )
509 )
510 373
511 def entities_data_get(self, jids, keys, profile, callback=None, errback=None): 374 def entities_data_get(self, jids, keys, profile, callback=None, errback=None):
512 if callback is None: 375 if callback is None:
513 error_handler = None 376 error_handler = None
514 else: 377 else:
515 if errback is None: 378 if errback is None:
516 errback = log.error 379 errback = log.error
517 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 380 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
518 kwargs = {} 381 kwargs={}
519 if callback is not None: 382 if callback is not None:
520 kwargs["timeout"] = const_TIMEOUT 383 kwargs['timeout'] = const_TIMEOUT
521 kwargs["reply_handler"] = callback 384 kwargs['reply_handler'] = callback
522 kwargs["error_handler"] = error_handler 385 kwargs['error_handler'] = error_handler
523 return self.db_core_iface.entities_data_get(jids, keys, profile, **kwargs) 386 return self.db_core_iface.entities_data_get(jids, keys, profile, **kwargs)
524 387
525 def entity_data_get(self, jid, keys, profile, callback=None, errback=None): 388 def entity_data_get(self, jid, keys, profile, callback=None, errback=None):
526 if callback is None: 389 if callback is None:
527 error_handler = None 390 error_handler = None
528 else: 391 else:
529 if errback is None: 392 if errback is None:
530 errback = log.error 393 errback = log.error
531 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 394 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
532 kwargs = {} 395 kwargs={}
533 if callback is not None: 396 if callback is not None:
534 kwargs["timeout"] = const_TIMEOUT 397 kwargs['timeout'] = const_TIMEOUT
535 kwargs["reply_handler"] = callback 398 kwargs['reply_handler'] = callback
536 kwargs["error_handler"] = error_handler 399 kwargs['error_handler'] = error_handler
537 return self.db_core_iface.entity_data_get(jid, keys, profile, **kwargs) 400 return self.db_core_iface.entity_data_get(jid, keys, profile, **kwargs)
538 401
539 def features_get(self, profile_key, callback=None, errback=None): 402 def features_get(self, profile_key, callback=None, errback=None):
540 if callback is None: 403 if callback is None:
541 error_handler = None 404 error_handler = None
542 else: 405 else:
543 if errback is None: 406 if errback is None:
544 errback = log.error 407 errback = log.error
545 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 408 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
546 return self.db_core_iface.features_get( 409 return self.db_core_iface.features_get(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
547 profile_key, 410
548 timeout=const_TIMEOUT, 411 def history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@", callback=None, errback=None):
549 reply_handler=callback, 412 if callback is None:
550 error_handler=error_handler, 413 error_handler = None
551 ) 414 else:
552 415 if errback is None:
553 def history_get( 416 errback = log.error
554 self, 417 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
555 from_jid, 418 return self.db_core_iface.history_get(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
556 to_jid,
557 limit,
558 between=True,
559 filters="",
560 profile="@NONE@",
561 callback=None,
562 errback=None,
563 ):
564 if callback is None:
565 error_handler = None
566 else:
567 if errback is None:
568 errback = log.error
569 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
570 return self.db_core_iface.history_get(
571 from_jid,
572 to_jid,
573 limit,
574 between,
575 filters,
576 profile,
577 timeout=const_TIMEOUT,
578 reply_handler=callback,
579 error_handler=error_handler,
580 )
581 419
582 def image_check(self, arg_0, callback=None, errback=None): 420 def image_check(self, arg_0, callback=None, errback=None):
583 if callback is None: 421 if callback is None:
584 error_handler = None 422 error_handler = None
585 else: 423 else:
586 if errback is None: 424 if errback is None:
587 errback = log.error 425 errback = log.error
588 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 426 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
589 kwargs = {} 427 kwargs={}
590 if callback is not None: 428 if callback is not None:
591 kwargs["timeout"] = const_TIMEOUT 429 kwargs['timeout'] = const_TIMEOUT
592 kwargs["reply_handler"] = callback 430 kwargs['reply_handler'] = callback
593 kwargs["error_handler"] = error_handler 431 kwargs['error_handler'] = error_handler
594 return str(self.db_core_iface.image_check(arg_0, **kwargs)) 432 return str(self.db_core_iface.image_check(arg_0, **kwargs))
595 433
596 def image_convert(self, source, dest, arg_2, extra, callback=None, errback=None): 434 def image_convert(self, source, dest, arg_2, extra, callback=None, errback=None):
597 if callback is None: 435 if callback is None:
598 error_handler = None 436 error_handler = None
599 else: 437 else:
600 if errback is None: 438 if errback is None:
601 errback = log.error 439 errback = log.error
602 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 440 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
603 return str( 441 return str(self.db_core_iface.image_convert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
604 self.db_core_iface.image_convert( 442
605 source, 443 def image_generate_preview(self, image_path, profile_key, callback=None, errback=None):
606 dest, 444 if callback is None:
607 arg_2, 445 error_handler = None
608 extra, 446 else:
609 timeout=const_TIMEOUT, 447 if errback is None:
610 reply_handler=callback, 448 errback = log.error
611 error_handler=error_handler, 449 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
612 ) 450 return str(self.db_core_iface.image_generate_preview(image_path, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
613 )
614
615 def image_generate_preview(
616 self, image_path, profile_key, callback=None, errback=None
617 ):
618 if callback is None:
619 error_handler = None
620 else:
621 if errback is None:
622 errback = log.error
623 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
624 return str(
625 self.db_core_iface.image_generate_preview(
626 image_path,
627 profile_key,
628 timeout=const_TIMEOUT,
629 reply_handler=callback,
630 error_handler=error_handler,
631 )
632 )
633 451
634 def image_resize(self, image_path, width, height, callback=None, errback=None): 452 def image_resize(self, image_path, width, height, callback=None, errback=None):
635 if callback is None: 453 if callback is None:
636 error_handler = None 454 error_handler = None
637 else: 455 else:
638 if errback is None: 456 if errback is None:
639 errback = log.error 457 errback = log.error
640 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 458 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
641 return str( 459 return str(self.db_core_iface.image_resize(image_path, width, height, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
642 self.db_core_iface.image_resize(
643 image_path,
644 width,
645 height,
646 timeout=const_TIMEOUT,
647 reply_handler=callback,
648 error_handler=error_handler,
649 )
650 )
651 460
652 def init_pre_script(self, callback=None, errback=None): 461 def init_pre_script(self, callback=None, errback=None):
653 if callback is None: 462 if callback is None:
654 error_handler = None 463 error_handler = None
655 else: 464 else:
656 if errback is None: 465 if errback is None:
657 errback = log.error 466 errback = log.error
658 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 467 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
659 return self.db_core_iface.init_pre_script( 468 return self.db_core_iface.init_pre_script(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
660 timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler
661 )
662 469
663 def is_connected(self, profile_key="@DEFAULT@", callback=None, errback=None): 470 def is_connected(self, profile_key="@DEFAULT@", callback=None, errback=None):
664 if callback is None: 471 if callback is None:
665 error_handler = None 472 error_handler = None
666 else: 473 else:
667 if errback is None: 474 if errback is None:
668 errback = log.error 475 errback = log.error
669 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 476 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
670 kwargs = {} 477 kwargs={}
671 if callback is not None: 478 if callback is not None:
672 kwargs["timeout"] = const_TIMEOUT 479 kwargs['timeout'] = const_TIMEOUT
673 kwargs["reply_handler"] = callback 480 kwargs['reply_handler'] = callback
674 kwargs["error_handler"] = error_handler 481 kwargs['error_handler'] = error_handler
675 return self.db_core_iface.is_connected(profile_key, **kwargs) 482 return self.db_core_iface.is_connected(profile_key, **kwargs)
676 483
677 def main_resource_get( 484 def main_resource_get(self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None):
678 self, contact_jid, profile_key="@DEFAULT@", callback=None, errback=None 485 if callback is None:
679 ): 486 error_handler = None
680 if callback is None: 487 else:
681 error_handler = None 488 if errback is None:
682 else: 489 errback = log.error
683 if errback is None: 490 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
684 errback = log.error 491 kwargs={}
685 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 492 if callback is not None:
686 kwargs = {} 493 kwargs['timeout'] = const_TIMEOUT
687 if callback is not None: 494 kwargs['reply_handler'] = callback
688 kwargs["timeout"] = const_TIMEOUT 495 kwargs['error_handler'] = error_handler
689 kwargs["reply_handler"] = callback 496 return str(self.db_core_iface.main_resource_get(contact_jid, profile_key, **kwargs))
690 kwargs["error_handler"] = error_handler
691 return str(
692 self.db_core_iface.main_resource_get(contact_jid, profile_key, **kwargs)
693 )
694 497
695 def menu_help_get(self, menu_id, language, callback=None, errback=None): 498 def menu_help_get(self, menu_id, language, callback=None, errback=None):
696 if callback is None: 499 if callback is None:
697 error_handler = None 500 error_handler = None
698 else: 501 else:
699 if errback is None: 502 if errback is None:
700 errback = log.error 503 errback = log.error
701 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 504 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
702 kwargs = {} 505 kwargs={}
703 if callback is not None: 506 if callback is not None:
704 kwargs["timeout"] = const_TIMEOUT 507 kwargs['timeout'] = const_TIMEOUT
705 kwargs["reply_handler"] = callback 508 kwargs['reply_handler'] = callback
706 kwargs["error_handler"] = error_handler 509 kwargs['error_handler'] = error_handler
707 return str(self.db_core_iface.menu_help_get(menu_id, language, **kwargs)) 510 return str(self.db_core_iface.menu_help_get(menu_id, language, **kwargs))
708 511
709 def menu_launch( 512 def menu_launch(self, menu_type, path, data, security_limit, profile_key, callback=None, errback=None):
710 self, 513 if callback is None:
711 menu_type, 514 error_handler = None
712 path, 515 else:
713 data, 516 if errback is None:
714 security_limit, 517 errback = log.error
715 profile_key, 518 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
716 callback=None, 519 return self.db_core_iface.menu_launch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
717 errback=None,
718 ):
719 if callback is None:
720 error_handler = None
721 else:
722 if errback is None:
723 errback = log.error
724 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
725 return self.db_core_iface.menu_launch(
726 menu_type,
727 path,
728 data,
729 security_limit,
730 profile_key,
731 timeout=const_TIMEOUT,
732 reply_handler=callback,
733 error_handler=error_handler,
734 )
735 520
736 def menus_get(self, language, security_limit, callback=None, errback=None): 521 def menus_get(self, language, security_limit, callback=None, errback=None):
737 if callback is None: 522 if callback is None:
738 error_handler = None 523 error_handler = None
739 else: 524 else:
740 if errback is None: 525 if errback is None:
741 errback = log.error 526 errback = log.error
742 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 527 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
743 kwargs = {} 528 kwargs={}
744 if callback is not None: 529 if callback is not None:
745 kwargs["timeout"] = const_TIMEOUT 530 kwargs['timeout'] = const_TIMEOUT
746 kwargs["reply_handler"] = callback 531 kwargs['reply_handler'] = callback
747 kwargs["error_handler"] = error_handler 532 kwargs['error_handler'] = error_handler
748 return self.db_core_iface.menus_get(language, security_limit, **kwargs) 533 return self.db_core_iface.menus_get(language, security_limit, **kwargs)
749 534
750 def message_encryption_get(self, to_jid, profile_key, callback=None, errback=None): 535 def message_encryption_get(self, to_jid, profile_key, callback=None, errback=None):
751 if callback is None: 536 if callback is None:
752 error_handler = None 537 error_handler = None
753 else: 538 else:
754 if errback is None: 539 if errback is None:
755 errback = log.error 540 errback = log.error
756 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 541 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
757 kwargs = {} 542 kwargs={}
758 if callback is not None: 543 if callback is not None:
759 kwargs["timeout"] = const_TIMEOUT 544 kwargs['timeout'] = const_TIMEOUT
760 kwargs["reply_handler"] = callback 545 kwargs['reply_handler'] = callback
761 kwargs["error_handler"] = error_handler 546 kwargs['error_handler'] = error_handler
762 return str( 547 return str(self.db_core_iface.message_encryption_get(to_jid, profile_key, **kwargs))
763 self.db_core_iface.message_encryption_get(to_jid, profile_key, **kwargs) 548
764 ) 549 def message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@", callback=None, errback=None):
765 550 if callback is None:
766 def message_encryption_start( 551 error_handler = None
767 self, 552 else:
768 to_jid, 553 if errback is None:
769 namespace="", 554 errback = log.error
770 replace=False, 555 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
771 profile_key="@NONE@", 556 return self.db_core_iface.message_encryption_start(to_jid, namespace, replace, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
772 callback=None,
773 errback=None,
774 ):
775 if callback is None:
776 error_handler = None
777 else:
778 if errback is None:
779 errback = log.error
780 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
781 return self.db_core_iface.message_encryption_start(
782 to_jid,
783 namespace,
784 replace,
785 profile_key,
786 timeout=const_TIMEOUT,
787 reply_handler=callback,
788 error_handler=error_handler,
789 )
790 557
791 def message_encryption_stop(self, to_jid, profile_key, callback=None, errback=None): 558 def message_encryption_stop(self, to_jid, profile_key, callback=None, errback=None):
792 if callback is None: 559 if callback is None:
793 error_handler = None 560 error_handler = None
794 else: 561 else:
795 if errback is None: 562 if errback is None:
796 errback = log.error 563 errback = log.error
797 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 564 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
798 return self.db_core_iface.message_encryption_stop( 565 return self.db_core_iface.message_encryption_stop(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
799 to_jid, 566
800 profile_key, 567 def message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@", callback=None, errback=None):
801 timeout=const_TIMEOUT, 568 if callback is None:
802 reply_handler=callback, 569 error_handler = None
803 error_handler=error_handler, 570 else:
804 ) 571 if errback is None:
805 572 errback = log.error
806 def message_send( 573 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
807 self, 574 return self.db_core_iface.message_send(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
808 to_jid,
809 message,
810 subject={},
811 mess_type="auto",
812 extra={},
813 profile_key="@NONE@",
814 callback=None,
815 errback=None,
816 ):
817 if callback is None:
818 error_handler = None
819 else:
820 if errback is None:
821 errback = log.error
822 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
823 return self.db_core_iface.message_send(
824 to_jid,
825 message,
826 subject,
827 mess_type,
828 extra,
829 profile_key,
830 timeout=const_TIMEOUT,
831 reply_handler=callback,
832 error_handler=error_handler,
833 )
834 575
835 def namespaces_get(self, callback=None, errback=None): 576 def namespaces_get(self, callback=None, errback=None):
836 if callback is None: 577 if callback is None:
837 error_handler = None 578 error_handler = None
838 else: 579 else:
839 if errback is None: 580 if errback is None:
840 errback = log.error 581 errback = log.error
841 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 582 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
842 kwargs = {} 583 kwargs={}
843 if callback is not None: 584 if callback is not None:
844 kwargs["timeout"] = const_TIMEOUT 585 kwargs['timeout'] = const_TIMEOUT
845 kwargs["reply_handler"] = callback 586 kwargs['reply_handler'] = callback
846 kwargs["error_handler"] = error_handler 587 kwargs['error_handler'] = error_handler
847 return self.db_core_iface.namespaces_get(**kwargs) 588 return self.db_core_iface.namespaces_get(**kwargs)
848 589
849 def notification_add( 590 def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, callback=None, errback=None):
850 self, 591 if callback is None:
851 type_, 592 error_handler = None
852 body_plain, 593 else:
853 body_rich, 594 if errback is None:
854 title, 595 errback = log.error
855 is_global, 596 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
856 requires_action, 597 kwargs={}
857 arg_6, 598 if callback is not None:
858 priority, 599 kwargs['timeout'] = const_TIMEOUT
859 expire_at, 600 kwargs['reply_handler'] = callback
860 extra, 601 kwargs['error_handler'] = error_handler
861 callback=None, 602 return self.db_core_iface.notification_add(type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, **kwargs)
862 errback=None, 603
863 ): 604 def notification_delete(self, id_, is_global, profile_key, callback=None, errback=None):
864 if callback is None: 605 if callback is None:
865 error_handler = None 606 error_handler = None
866 else: 607 else:
867 if errback is None: 608 if errback is None:
868 errback = log.error 609 errback = log.error
869 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 610 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
870 kwargs = {} 611 kwargs={}
871 if callback is not None: 612 if callback is not None:
872 kwargs["timeout"] = const_TIMEOUT 613 kwargs['timeout'] = const_TIMEOUT
873 kwargs["reply_handler"] = callback 614 kwargs['reply_handler'] = callback
874 kwargs["error_handler"] = error_handler 615 kwargs['error_handler'] = error_handler
875 return self.db_core_iface.notification_add( 616 return self.db_core_iface.notification_delete(id_, is_global, profile_key, **kwargs)
876 type_, 617
877 body_plain, 618 def notifications_expired_clean(self, limit_timestamp, profile_key, callback=None, errback=None):
878 body_rich, 619 if callback is None:
879 title, 620 error_handler = None
880 is_global, 621 else:
881 requires_action, 622 if errback is None:
882 arg_6, 623 errback = log.error
883 priority, 624 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
884 expire_at, 625 kwargs={}
885 extra, 626 if callback is not None:
886 **kwargs, 627 kwargs['timeout'] = const_TIMEOUT
887 ) 628 kwargs['reply_handler'] = callback
888 629 kwargs['error_handler'] = error_handler
889 def notification_delete( 630 return self.db_core_iface.notifications_expired_clean(limit_timestamp, profile_key, **kwargs)
890 self, id_, is_global, profile_key, callback=None, errback=None
891 ):
892 if callback is None:
893 error_handler = None
894 else:
895 if errback is None:
896 errback = log.error
897 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
898 kwargs = {}
899 if callback is not None:
900 kwargs["timeout"] = const_TIMEOUT
901 kwargs["reply_handler"] = callback
902 kwargs["error_handler"] = error_handler
903 return self.db_core_iface.notification_delete(
904 id_, is_global, profile_key, **kwargs
905 )
906
907 def notifications_expired_clean(
908 self, limit_timestamp, profile_key, callback=None, errback=None
909 ):
910 if callback is None:
911 error_handler = None
912 else:
913 if errback is None:
914 errback = log.error
915 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
916 kwargs = {}
917 if callback is not None:
918 kwargs["timeout"] = const_TIMEOUT
919 kwargs["reply_handler"] = callback
920 kwargs["error_handler"] = error_handler
921 return self.db_core_iface.notifications_expired_clean(
922 limit_timestamp, profile_key, **kwargs
923 )
924 631
925 def notifications_get(self, filters, profile_key, callback=None, errback=None): 632 def notifications_get(self, filters, profile_key, callback=None, errback=None):
926 if callback is None: 633 if callback is None:
927 error_handler = None 634 error_handler = None
928 else: 635 else:
929 if errback is None: 636 if errback is None:
930 errback = log.error 637 errback = log.error
931 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 638 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
932 kwargs = {} 639 kwargs={}
933 if callback is not None: 640 if callback is not None:
934 kwargs["timeout"] = const_TIMEOUT 641 kwargs['timeout'] = const_TIMEOUT
935 kwargs["reply_handler"] = callback 642 kwargs['reply_handler'] = callback
936 kwargs["error_handler"] = error_handler 643 kwargs['error_handler'] = error_handler
937 return str(self.db_core_iface.notifications_get(filters, profile_key, **kwargs)) 644 return str(self.db_core_iface.notifications_get(filters, profile_key, **kwargs))
938 645
939 def param_get_a( 646 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@", callback=None, errback=None):
940 self, 647 if callback is None:
941 name, 648 error_handler = None
942 category, 649 else:
943 attribute="value", 650 if errback is None:
944 profile_key="@DEFAULT@", 651 errback = log.error
945 callback=None, 652 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
946 errback=None, 653 kwargs={}
947 ): 654 if callback is not None:
948 if callback is None: 655 kwargs['timeout'] = const_TIMEOUT
949 error_handler = None 656 kwargs['reply_handler'] = callback
950 else: 657 kwargs['error_handler'] = error_handler
951 if errback is None: 658 return str(self.db_core_iface.param_get_a(name, category, attribute, profile_key, **kwargs))
952 errback = log.error 659
953 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 660 def param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
954 kwargs = {} 661 if callback is None:
955 if callback is not None: 662 error_handler = None
956 kwargs["timeout"] = const_TIMEOUT 663 else:
957 kwargs["reply_handler"] = callback 664 if errback is None:
958 kwargs["error_handler"] = error_handler 665 errback = log.error
959 return str( 666 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
960 self.db_core_iface.param_get_a( 667 return str(self.db_core_iface.param_get_a_async(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
961 name, category, attribute, profile_key, **kwargs 668
962 ) 669 def param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
963 ) 670 if callback is None:
964 671 error_handler = None
965 def param_get_a_async( 672 else:
966 self, 673 if errback is None:
967 name, 674 errback = log.error
968 category, 675 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
969 attribute="value", 676 kwargs={}
970 security_limit=-1, 677 if callback is not None:
971 profile_key="@DEFAULT@", 678 kwargs['timeout'] = const_TIMEOUT
972 callback=None, 679 kwargs['reply_handler'] = callback
973 errback=None, 680 kwargs['error_handler'] = error_handler
974 ): 681 return self.db_core_iface.param_set(name, value, category, security_limit, profile_key, **kwargs)
975 if callback is None: 682
976 error_handler = None 683 def param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@", callback=None, errback=None):
977 else: 684 if callback is None:
978 if errback is None: 685 error_handler = None
979 errback = log.error 686 else:
980 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 687 if errback is None:
981 return str( 688 errback = log.error
982 self.db_core_iface.param_get_a_async( 689 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
983 name, 690 return str(self.db_core_iface.param_ui_get(security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
984 category,
985 attribute,
986 security_limit,
987 profile_key,
988 timeout=const_TIMEOUT,
989 reply_handler=callback,
990 error_handler=error_handler,
991 )
992 )
993
994 def param_set(
995 self,
996 name,
997 value,
998 category,
999 security_limit=-1,
1000 profile_key="@DEFAULT@",
1001 callback=None,
1002 errback=None,
1003 ):
1004 if callback is None:
1005 error_handler = None
1006 else:
1007 if errback is None:
1008 errback = log.error
1009 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1010 kwargs = {}
1011 if callback is not None:
1012 kwargs["timeout"] = const_TIMEOUT
1013 kwargs["reply_handler"] = callback
1014 kwargs["error_handler"] = error_handler
1015 return self.db_core_iface.param_set(
1016 name, value, category, security_limit, profile_key, **kwargs
1017 )
1018
1019 def param_ui_get(
1020 self,
1021 security_limit=-1,
1022 app="",
1023 extra="",
1024 profile_key="@DEFAULT@",
1025 callback=None,
1026 errback=None,
1027 ):
1028 if callback is None:
1029 error_handler = None
1030 else:
1031 if errback is None:
1032 errback = log.error
1033 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1034 return str(
1035 self.db_core_iface.param_ui_get(
1036 security_limit,
1037 app,
1038 extra,
1039 profile_key,
1040 timeout=const_TIMEOUT,
1041 reply_handler=callback,
1042 error_handler=error_handler,
1043 )
1044 )
1045 691
1046 def params_categories_get(self, callback=None, errback=None): 692 def params_categories_get(self, callback=None, errback=None):
1047 if callback is None: 693 if callback is None:
1048 error_handler = None 694 error_handler = None
1049 else: 695 else:
1050 if errback is None: 696 if errback is None:
1051 errback = log.error 697 errback = log.error
1052 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 698 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1053 kwargs = {} 699 kwargs={}
1054 if callback is not None: 700 if callback is not None:
1055 kwargs["timeout"] = const_TIMEOUT 701 kwargs['timeout'] = const_TIMEOUT
1056 kwargs["reply_handler"] = callback 702 kwargs['reply_handler'] = callback
1057 kwargs["error_handler"] = error_handler 703 kwargs['error_handler'] = error_handler
1058 return self.db_core_iface.params_categories_get(**kwargs) 704 return self.db_core_iface.params_categories_get(**kwargs)
1059 705
1060 def params_register_app( 706 def params_register_app(self, xml, security_limit=-1, app='', callback=None, errback=None):
1061 self, xml, security_limit=-1, app="", callback=None, errback=None 707 if callback is None:
1062 ): 708 error_handler = None
1063 if callback is None: 709 else:
1064 error_handler = None 710 if errback is None:
1065 else: 711 errback = log.error
1066 if errback is None: 712 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1067 errback = log.error 713 kwargs={}
1068 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 714 if callback is not None:
1069 kwargs = {} 715 kwargs['timeout'] = const_TIMEOUT
1070 if callback is not None: 716 kwargs['reply_handler'] = callback
1071 kwargs["timeout"] = const_TIMEOUT 717 kwargs['error_handler'] = error_handler
1072 kwargs["reply_handler"] = callback
1073 kwargs["error_handler"] = error_handler
1074 return self.db_core_iface.params_register_app(xml, security_limit, app, **kwargs) 718 return self.db_core_iface.params_register_app(xml, security_limit, app, **kwargs)
1075 719
1076 def params_template_load(self, filename, callback=None, errback=None): 720 def params_template_load(self, filename, callback=None, errback=None):
1077 if callback is None: 721 if callback is None:
1078 error_handler = None 722 error_handler = None
1079 else: 723 else:
1080 if errback is None: 724 if errback is None:
1081 errback = log.error 725 errback = log.error
1082 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 726 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1083 kwargs = {} 727 kwargs={}
1084 if callback is not None: 728 if callback is not None:
1085 kwargs["timeout"] = const_TIMEOUT 729 kwargs['timeout'] = const_TIMEOUT
1086 kwargs["reply_handler"] = callback 730 kwargs['reply_handler'] = callback
1087 kwargs["error_handler"] = error_handler 731 kwargs['error_handler'] = error_handler
1088 return self.db_core_iface.params_template_load(filename, **kwargs) 732 return self.db_core_iface.params_template_load(filename, **kwargs)
1089 733
1090 def params_template_save(self, filename, callback=None, errback=None): 734 def params_template_save(self, filename, callback=None, errback=None):
1091 if callback is None: 735 if callback is None:
1092 error_handler = None 736 error_handler = None
1093 else: 737 else:
1094 if errback is None: 738 if errback is None:
1095 errback = log.error 739 errback = log.error
1096 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 740 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1097 kwargs = {} 741 kwargs={}
1098 if callback is not None: 742 if callback is not None:
1099 kwargs["timeout"] = const_TIMEOUT 743 kwargs['timeout'] = const_TIMEOUT
1100 kwargs["reply_handler"] = callback 744 kwargs['reply_handler'] = callback
1101 kwargs["error_handler"] = error_handler 745 kwargs['error_handler'] = error_handler
1102 return self.db_core_iface.params_template_save(filename, **kwargs) 746 return self.db_core_iface.params_template_save(filename, **kwargs)
1103 747
1104 def params_values_from_category_get_async( 748 def params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@", callback=None, errback=None):
1105 self, 749 if callback is None:
1106 category, 750 error_handler = None
1107 security_limit=-1, 751 else:
1108 app="", 752 if errback is None:
1109 extra="", 753 errback = log.error
1110 profile_key="@DEFAULT@", 754 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1111 callback=None, 755 return self.db_core_iface.params_values_from_category_get_async(category, security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1112 errback=None, 756
1113 ): 757 def presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@", callback=None, errback=None):
1114 if callback is None: 758 if callback is None:
1115 error_handler = None 759 error_handler = None
1116 else: 760 else:
1117 if errback is None: 761 if errback is None:
1118 errback = log.error 762 errback = log.error
1119 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 763 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1120 return self.db_core_iface.params_values_from_category_get_async( 764 kwargs={}
1121 category, 765 if callback is not None:
1122 security_limit, 766 kwargs['timeout'] = const_TIMEOUT
1123 app, 767 kwargs['reply_handler'] = callback
1124 extra, 768 kwargs['error_handler'] = error_handler
1125 profile_key, 769 return self.db_core_iface.presence_set(to_jid, show, statuses, profile_key, **kwargs)
1126 timeout=const_TIMEOUT,
1127 reply_handler=callback,
1128 error_handler=error_handler,
1129 )
1130
1131 def presence_set(
1132 self,
1133 to_jid="",
1134 show="",
1135 statuses={},
1136 profile_key="@DEFAULT@",
1137 callback=None,
1138 errback=None,
1139 ):
1140 if callback is None:
1141 error_handler = None
1142 else:
1143 if errback is None:
1144 errback = log.error
1145 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1146 kwargs = {}
1147 if callback is not None:
1148 kwargs["timeout"] = const_TIMEOUT
1149 kwargs["reply_handler"] = callback
1150 kwargs["error_handler"] = error_handler
1151 return self.db_core_iface.presence_set(
1152 to_jid, show, statuses, profile_key, **kwargs
1153 )
1154 770
1155 def presence_statuses_get(self, profile_key="@DEFAULT@", callback=None, errback=None): 771 def presence_statuses_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
1156 if callback is None: 772 if callback is None:
1157 error_handler = None 773 error_handler = None
1158 else: 774 else:
1159 if errback is None: 775 if errback is None:
1160 errback = log.error 776 errback = log.error
1161 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 777 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1162 kwargs = {} 778 kwargs={}
1163 if callback is not None: 779 if callback is not None:
1164 kwargs["timeout"] = const_TIMEOUT 780 kwargs['timeout'] = const_TIMEOUT
1165 kwargs["reply_handler"] = callback 781 kwargs['reply_handler'] = callback
1166 kwargs["error_handler"] = error_handler 782 kwargs['error_handler'] = error_handler
1167 return self.db_core_iface.presence_statuses_get(profile_key, **kwargs) 783 return self.db_core_iface.presence_statuses_get(profile_key, **kwargs)
1168 784
1169 def private_data_delete(self, namespace, key, arg_2, callback=None, errback=None): 785 def private_data_delete(self, namespace, key, arg_2, callback=None, errback=None):
1170 if callback is None: 786 if callback is None:
1171 error_handler = None 787 error_handler = None
1172 else: 788 else:
1173 if errback is None: 789 if errback is None:
1174 errback = log.error 790 errback = log.error
1175 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 791 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1176 return self.db_core_iface.private_data_delete( 792 return self.db_core_iface.private_data_delete(namespace, key, arg_2, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1177 namespace,
1178 key,
1179 arg_2,
1180 timeout=const_TIMEOUT,
1181 reply_handler=callback,
1182 error_handler=error_handler,
1183 )
1184 793
1185 def private_data_get(self, namespace, key, profile_key, callback=None, errback=None): 794 def private_data_get(self, namespace, key, profile_key, callback=None, errback=None):
1186 if callback is None: 795 if callback is None:
1187 error_handler = None 796 error_handler = None
1188 else: 797 else:
1189 if errback is None: 798 if errback is None:
1190 errback = log.error 799 errback = log.error
1191 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 800 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1192 return str( 801 return str(self.db_core_iface.private_data_get(namespace, key, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler))
1193 self.db_core_iface.private_data_get( 802
1194 namespace, 803 def private_data_set(self, namespace, key, data, profile_key, callback=None, errback=None):
1195 key, 804 if callback is None:
1196 profile_key, 805 error_handler = None
1197 timeout=const_TIMEOUT, 806 else:
1198 reply_handler=callback, 807 if errback is None:
1199 error_handler=error_handler, 808 errback = log.error
1200 ) 809 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1201 ) 810 return self.db_core_iface.private_data_set(namespace, key, data, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1202 811
1203 def private_data_set( 812 def profile_create(self, profile, password='', component='', callback=None, errback=None):
1204 self, namespace, key, data, profile_key, callback=None, errback=None 813 if callback is None:
1205 ): 814 error_handler = None
1206 if callback is None: 815 else:
1207 error_handler = None 816 if errback is None:
1208 else: 817 errback = log.error
1209 if errback is None: 818 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1210 errback = log.error 819 return self.db_core_iface.profile_create(profile, password, component, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1211 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1212 return self.db_core_iface.private_data_set(
1213 namespace,
1214 key,
1215 data,
1216 profile_key,
1217 timeout=const_TIMEOUT,
1218 reply_handler=callback,
1219 error_handler=error_handler,
1220 )
1221
1222 def profile_create(
1223 self, profile, password="", component="", callback=None, errback=None
1224 ):
1225 if callback is None:
1226 error_handler = None
1227 else:
1228 if errback is None:
1229 errback = log.error
1230 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1231 return self.db_core_iface.profile_create(
1232 profile,
1233 password,
1234 component,
1235 timeout=const_TIMEOUT,
1236 reply_handler=callback,
1237 error_handler=error_handler,
1238 )
1239 820
1240 def profile_delete_async(self, profile, callback=None, errback=None): 821 def profile_delete_async(self, profile, callback=None, errback=None):
1241 if callback is None: 822 if callback is None:
1242 error_handler = None 823 error_handler = None
1243 else: 824 else:
1244 if errback is None: 825 if errback is None:
1245 errback = log.error 826 errback = log.error
1246 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 827 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1247 return self.db_core_iface.profile_delete_async( 828 return self.db_core_iface.profile_delete_async(profile, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1248 profile, 829
1249 timeout=const_TIMEOUT, 830 def profile_is_session_started(self, profile_key="@DEFAULT@", callback=None, errback=None):
1250 reply_handler=callback, 831 if callback is None:
1251 error_handler=error_handler, 832 error_handler = None
1252 ) 833 else:
1253 834 if errback is None:
1254 def profile_is_session_started( 835 errback = log.error
1255 self, profile_key="@DEFAULT@", callback=None, errback=None 836 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1256 ): 837 kwargs={}
1257 if callback is None: 838 if callback is not None:
1258 error_handler = None 839 kwargs['timeout'] = const_TIMEOUT
1259 else: 840 kwargs['reply_handler'] = callback
1260 if errback is None: 841 kwargs['error_handler'] = error_handler
1261 errback = log.error
1262 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1263 kwargs = {}
1264 if callback is not None:
1265 kwargs["timeout"] = const_TIMEOUT
1266 kwargs["reply_handler"] = callback
1267 kwargs["error_handler"] = error_handler
1268 return self.db_core_iface.profile_is_session_started(profile_key, **kwargs) 842 return self.db_core_iface.profile_is_session_started(profile_key, **kwargs)
1269 843
1270 def profile_name_get(self, profile_key="@DEFAULT@", callback=None, errback=None): 844 def profile_name_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
1271 if callback is None: 845 if callback is None:
1272 error_handler = None 846 error_handler = None
1273 else: 847 else:
1274 if errback is None: 848 if errback is None:
1275 errback = log.error 849 errback = log.error
1276 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 850 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1277 kwargs = {} 851 kwargs={}
1278 if callback is not None: 852 if callback is not None:
1279 kwargs["timeout"] = const_TIMEOUT 853 kwargs['timeout'] = const_TIMEOUT
1280 kwargs["reply_handler"] = callback 854 kwargs['reply_handler'] = callback
1281 kwargs["error_handler"] = error_handler 855 kwargs['error_handler'] = error_handler
1282 return str(self.db_core_iface.profile_name_get(profile_key, **kwargs)) 856 return str(self.db_core_iface.profile_name_get(profile_key, **kwargs))
1283 857
1284 def profile_set_default(self, profile, callback=None, errback=None): 858 def profile_set_default(self, profile, callback=None, errback=None):
1285 if callback is None: 859 if callback is None:
1286 error_handler = None 860 error_handler = None
1287 else: 861 else:
1288 if errback is None: 862 if errback is None:
1289 errback = log.error 863 errback = log.error
1290 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 864 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1291 kwargs = {} 865 kwargs={}
1292 if callback is not None: 866 if callback is not None:
1293 kwargs["timeout"] = const_TIMEOUT 867 kwargs['timeout'] = const_TIMEOUT
1294 kwargs["reply_handler"] = callback 868 kwargs['reply_handler'] = callback
1295 kwargs["error_handler"] = error_handler 869 kwargs['error_handler'] = error_handler
1296 return self.db_core_iface.profile_set_default(profile, **kwargs) 870 return self.db_core_iface.profile_set_default(profile, **kwargs)
1297 871
1298 def profile_start_session( 872 def profile_start_session(self, password='', profile_key="@DEFAULT@", callback=None, errback=None):
1299 self, password="", profile_key="@DEFAULT@", callback=None, errback=None 873 if callback is None:
1300 ): 874 error_handler = None
1301 if callback is None: 875 else:
1302 error_handler = None 876 if errback is None:
1303 else: 877 errback = log.error
1304 if errback is None: 878 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1305 errback = log.error 879 return self.db_core_iface.profile_start_session(password, profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1306 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 880
1307 return self.db_core_iface.profile_start_session( 881 def profiles_list_get(self, clients=True, components=False, callback=None, errback=None):
1308 password, 882 if callback is None:
1309 profile_key, 883 error_handler = None
1310 timeout=const_TIMEOUT, 884 else:
1311 reply_handler=callback, 885 if errback is None:
1312 error_handler=error_handler, 886 errback = log.error
1313 ) 887 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1314 888 kwargs={}
1315 def profiles_list_get( 889 if callback is not None:
1316 self, clients=True, components=False, callback=None, errback=None 890 kwargs['timeout'] = const_TIMEOUT
1317 ): 891 kwargs['reply_handler'] = callback
1318 if callback is None: 892 kwargs['error_handler'] = error_handler
1319 error_handler = None
1320 else:
1321 if errback is None:
1322 errback = log.error
1323 error_handler = lambda err: errback(dbus_to_bridge_exception(err))
1324 kwargs = {}
1325 if callback is not None:
1326 kwargs["timeout"] = const_TIMEOUT
1327 kwargs["reply_handler"] = callback
1328 kwargs["error_handler"] = error_handler
1329 return self.db_core_iface.profiles_list_get(clients, components, **kwargs) 893 return self.db_core_iface.profiles_list_get(clients, components, **kwargs)
1330 894
1331 def progress_get(self, id, profile, callback=None, errback=None): 895 def progress_get(self, id, profile, callback=None, errback=None):
1332 if callback is None: 896 if callback is None:
1333 error_handler = None 897 error_handler = None
1334 else: 898 else:
1335 if errback is None: 899 if errback is None:
1336 errback = log.error 900 errback = log.error
1337 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 901 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1338 kwargs = {} 902 kwargs={}
1339 if callback is not None: 903 if callback is not None:
1340 kwargs["timeout"] = const_TIMEOUT 904 kwargs['timeout'] = const_TIMEOUT
1341 kwargs["reply_handler"] = callback 905 kwargs['reply_handler'] = callback
1342 kwargs["error_handler"] = error_handler 906 kwargs['error_handler'] = error_handler
1343 return self.db_core_iface.progress_get(id, profile, **kwargs) 907 return self.db_core_iface.progress_get(id, profile, **kwargs)
1344 908
1345 def progress_get_all(self, profile, callback=None, errback=None): 909 def progress_get_all(self, profile, callback=None, errback=None):
1346 if callback is None: 910 if callback is None:
1347 error_handler = None 911 error_handler = None
1348 else: 912 else:
1349 if errback is None: 913 if errback is None:
1350 errback = log.error 914 errback = log.error
1351 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 915 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1352 kwargs = {} 916 kwargs={}
1353 if callback is not None: 917 if callback is not None:
1354 kwargs["timeout"] = const_TIMEOUT 918 kwargs['timeout'] = const_TIMEOUT
1355 kwargs["reply_handler"] = callback 919 kwargs['reply_handler'] = callback
1356 kwargs["error_handler"] = error_handler 920 kwargs['error_handler'] = error_handler
1357 return self.db_core_iface.progress_get_all(profile, **kwargs) 921 return self.db_core_iface.progress_get_all(profile, **kwargs)
1358 922
1359 def progress_get_all_metadata(self, profile, callback=None, errback=None): 923 def progress_get_all_metadata(self, profile, callback=None, errback=None):
1360 if callback is None: 924 if callback is None:
1361 error_handler = None 925 error_handler = None
1362 else: 926 else:
1363 if errback is None: 927 if errback is None:
1364 errback = log.error 928 errback = log.error
1365 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 929 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1366 kwargs = {} 930 kwargs={}
1367 if callback is not None: 931 if callback is not None:
1368 kwargs["timeout"] = const_TIMEOUT 932 kwargs['timeout'] = const_TIMEOUT
1369 kwargs["reply_handler"] = callback 933 kwargs['reply_handler'] = callback
1370 kwargs["error_handler"] = error_handler 934 kwargs['error_handler'] = error_handler
1371 return self.db_core_iface.progress_get_all_metadata(profile, **kwargs) 935 return self.db_core_iface.progress_get_all_metadata(profile, **kwargs)
1372 936
1373 def ready_get(self, callback=None, errback=None): 937 def ready_get(self, callback=None, errback=None):
1374 if callback is None: 938 if callback is None:
1375 error_handler = None 939 error_handler = None
1376 else: 940 else:
1377 if errback is None: 941 if errback is None:
1378 errback = log.error 942 errback = log.error
1379 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 943 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1380 return self.db_core_iface.ready_get( 944 return self.db_core_iface.ready_get(timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1381 timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler
1382 )
1383 945
1384 def roster_resync(self, profile_key="@DEFAULT@", callback=None, errback=None): 946 def roster_resync(self, profile_key="@DEFAULT@", callback=None, errback=None):
1385 if callback is None: 947 if callback is None:
1386 error_handler = None 948 error_handler = None
1387 else: 949 else:
1388 if errback is None: 950 if errback is None:
1389 errback = log.error 951 errback = log.error
1390 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 952 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1391 return self.db_core_iface.roster_resync( 953 return self.db_core_iface.roster_resync(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1392 profile_key,
1393 timeout=const_TIMEOUT,
1394 reply_handler=callback,
1395 error_handler=error_handler,
1396 )
1397 954
1398 def session_infos_get(self, profile_key, callback=None, errback=None): 955 def session_infos_get(self, profile_key, callback=None, errback=None):
1399 if callback is None: 956 if callback is None:
1400 error_handler = None 957 error_handler = None
1401 else: 958 else:
1402 if errback is None: 959 if errback is None:
1403 errback = log.error 960 errback = log.error
1404 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 961 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1405 return self.db_core_iface.session_infos_get( 962 return self.db_core_iface.session_infos_get(profile_key, timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler)
1406 profile_key,
1407 timeout=const_TIMEOUT,
1408 reply_handler=callback,
1409 error_handler=error_handler,
1410 )
1411 963
1412 def sub_waiting_get(self, profile_key="@DEFAULT@", callback=None, errback=None): 964 def sub_waiting_get(self, profile_key="@DEFAULT@", callback=None, errback=None):
1413 if callback is None: 965 if callback is None:
1414 error_handler = None 966 error_handler = None
1415 else: 967 else:
1416 if errback is None: 968 if errback is None:
1417 errback = log.error 969 errback = log.error
1418 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 970 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1419 kwargs = {} 971 kwargs={}
1420 if callback is not None: 972 if callback is not None:
1421 kwargs["timeout"] = const_TIMEOUT 973 kwargs['timeout'] = const_TIMEOUT
1422 kwargs["reply_handler"] = callback 974 kwargs['reply_handler'] = callback
1423 kwargs["error_handler"] = error_handler 975 kwargs['error_handler'] = error_handler
1424 return self.db_core_iface.sub_waiting_get(profile_key, **kwargs) 976 return self.db_core_iface.sub_waiting_get(profile_key, **kwargs)
1425 977
1426 def subscription( 978 def subscription(self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None):
1427 self, sub_type, entity, profile_key="@DEFAULT@", callback=None, errback=None 979 if callback is None:
1428 ): 980 error_handler = None
1429 if callback is None: 981 else:
1430 error_handler = None 982 if errback is None:
1431 else: 983 errback = log.error
1432 if errback is None: 984 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1433 errback = log.error 985 kwargs={}
1434 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 986 if callback is not None:
1435 kwargs = {} 987 kwargs['timeout'] = const_TIMEOUT
1436 if callback is not None: 988 kwargs['reply_handler'] = callback
1437 kwargs["timeout"] = const_TIMEOUT 989 kwargs['error_handler'] = error_handler
1438 kwargs["reply_handler"] = callback
1439 kwargs["error_handler"] = error_handler
1440 return self.db_core_iface.subscription(sub_type, entity, profile_key, **kwargs) 990 return self.db_core_iface.subscription(sub_type, entity, profile_key, **kwargs)
1441 991
1442 def version_get(self, callback=None, errback=None): 992 def version_get(self, callback=None, errback=None):
1443 if callback is None: 993 if callback is None:
1444 error_handler = None 994 error_handler = None
1445 else: 995 else:
1446 if errback is None: 996 if errback is None:
1447 errback = log.error 997 errback = log.error
1448 error_handler = lambda err: errback(dbus_to_bridge_exception(err)) 998 error_handler = lambda err:errback(dbus_to_bridge_exception(err))
1449 kwargs = {} 999 kwargs={}
1450 if callback is not None: 1000 if callback is not None:
1451 kwargs["timeout"] = const_TIMEOUT 1001 kwargs['timeout'] = const_TIMEOUT
1452 kwargs["reply_handler"] = callback 1002 kwargs['reply_handler'] = callback
1453 kwargs["error_handler"] = error_handler 1003 kwargs['error_handler'] = error_handler
1454 return str(self.db_core_iface.version_get(**kwargs)) 1004 return str(self.db_core_iface.version_get(**kwargs))
1005
1455 1006
1456 1007
1457 class AIOBridge(bridge): 1008 class AIOBridge(bridge):
1458 1009
1459 def register_signal(self, functionName, handler, iface="core"): 1010 def register_signal(self, functionName, handler, iface="core"):
1516 callback=lambda: loop.call_soon_threadsafe(fut.set_result, None), 1067 callback=lambda: loop.call_soon_threadsafe(fut.set_result, None),
1517 errback=lambda e: loop.call_soon_threadsafe(fut.set_exception, e), 1068 errback=lambda e: loop.call_soon_threadsafe(fut.set_exception, e),
1518 ) 1069 )
1519 return fut 1070 return fut
1520 1071
1072
1521 def action_launch(self, callback_id, data, profile_key="@DEFAULT@"): 1073 def action_launch(self, callback_id, data, profile_key="@DEFAULT@"):
1522 loop = asyncio.get_running_loop() 1074 loop = asyncio.get_running_loop()
1523 fut = loop.create_future() 1075 fut = loop.create_future()
1524 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1076 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1525 error_handler = lambda err: loop.call_soon_threadsafe( 1077 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1526 fut.set_exception, dbus_to_bridge_exception(err) 1078 self.db_core_iface.action_launch(callback_id, data, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1527 )
1528 self.db_core_iface.action_launch(
1529 callback_id,
1530 data,
1531 profile_key,
1532 timeout=const_TIMEOUT,
1533 reply_handler=reply_handler,
1534 error_handler=error_handler,
1535 )
1536 return fut 1079 return fut
1537 1080
1538 def actions_get(self, profile_key="@DEFAULT@"): 1081 def actions_get(self, profile_key="@DEFAULT@"):
1539 loop = asyncio.get_running_loop() 1082 loop = asyncio.get_running_loop()
1540 fut = loop.create_future() 1083 fut = loop.create_future()
1541 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1084 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1542 error_handler = lambda err: loop.call_soon_threadsafe( 1085 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1543 fut.set_exception, dbus_to_bridge_exception(err) 1086 self.db_core_iface.actions_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1544 )
1545 self.db_core_iface.actions_get(
1546 profile_key,
1547 timeout=const_TIMEOUT,
1548 reply_handler=reply_handler,
1549 error_handler=error_handler,
1550 )
1551 return fut 1087 return fut
1552 1088
1553 def config_get(self, section, name): 1089 def config_get(self, section, name):
1554 loop = asyncio.get_running_loop() 1090 loop = asyncio.get_running_loop()
1555 fut = loop.create_future() 1091 fut = loop.create_future()
1556 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1092 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1557 error_handler = lambda err: loop.call_soon_threadsafe( 1093 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1558 fut.set_exception, dbus_to_bridge_exception(err) 1094 self.db_core_iface.config_get(section, name, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1559 ) 1095 return fut
1560 self.db_core_iface.config_get( 1096
1561 section, 1097 def connect(self, profile_key="@DEFAULT@", password='', options={}):
1562 name, 1098 loop = asyncio.get_running_loop()
1563 timeout=const_TIMEOUT, 1099 fut = loop.create_future()
1564 reply_handler=reply_handler, 1100 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1565 error_handler=error_handler, 1101 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1566 ) 1102 self.db_core_iface.connect(profile_key, password, options, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1567 return fut
1568
1569 def connect(self, profile_key="@DEFAULT@", password="", options={}):
1570 loop = asyncio.get_running_loop()
1571 fut = loop.create_future()
1572 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1573 error_handler = lambda err: loop.call_soon_threadsafe(
1574 fut.set_exception, dbus_to_bridge_exception(err)
1575 )
1576 self.db_core_iface.connect(
1577 profile_key,
1578 password,
1579 options,
1580 timeout=const_TIMEOUT,
1581 reply_handler=reply_handler,
1582 error_handler=error_handler,
1583 )
1584 return fut 1103 return fut
1585 1104
1586 def contact_add(self, entity_jid, profile_key="@DEFAULT@"): 1105 def contact_add(self, entity_jid, profile_key="@DEFAULT@"):
1587 loop = asyncio.get_running_loop() 1106 loop = asyncio.get_running_loop()
1588 fut = loop.create_future() 1107 fut = loop.create_future()
1589 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1108 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1590 error_handler = lambda err: loop.call_soon_threadsafe( 1109 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1591 fut.set_exception, dbus_to_bridge_exception(err) 1110 self.db_core_iface.contact_add(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1592 )
1593 self.db_core_iface.contact_add(
1594 entity_jid,
1595 profile_key,
1596 timeout=const_TIMEOUT,
1597 reply_handler=reply_handler,
1598 error_handler=error_handler,
1599 )
1600 return fut 1111 return fut
1601 1112
1602 def contact_del(self, entity_jid, profile_key="@DEFAULT@"): 1113 def contact_del(self, entity_jid, profile_key="@DEFAULT@"):
1603 loop = asyncio.get_running_loop() 1114 loop = asyncio.get_running_loop()
1604 fut = loop.create_future() 1115 fut = loop.create_future()
1605 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1116 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1606 error_handler = lambda err: loop.call_soon_threadsafe( 1117 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1607 fut.set_exception, dbus_to_bridge_exception(err) 1118 self.db_core_iface.contact_del(entity_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1608 )
1609 self.db_core_iface.contact_del(
1610 entity_jid,
1611 profile_key,
1612 timeout=const_TIMEOUT,
1613 reply_handler=reply_handler,
1614 error_handler=error_handler,
1615 )
1616 return fut 1119 return fut
1617 1120
1618 def contact_get(self, arg_0, profile_key="@DEFAULT@"): 1121 def contact_get(self, arg_0, profile_key="@DEFAULT@"):
1619 loop = asyncio.get_running_loop() 1122 loop = asyncio.get_running_loop()
1620 fut = loop.create_future() 1123 fut = loop.create_future()
1621 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1124 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1622 error_handler = lambda err: loop.call_soon_threadsafe( 1125 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1623 fut.set_exception, dbus_to_bridge_exception(err) 1126 self.db_core_iface.contact_get(arg_0, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1624 )
1625 self.db_core_iface.contact_get(
1626 arg_0,
1627 profile_key,
1628 timeout=const_TIMEOUT,
1629 reply_handler=reply_handler,
1630 error_handler=error_handler,
1631 )
1632 return fut 1127 return fut
1633 1128
1634 def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@"): 1129 def contact_update(self, entity_jid, name, groups, profile_key="@DEFAULT@"):
1635 loop = asyncio.get_running_loop() 1130 loop = asyncio.get_running_loop()
1636 fut = loop.create_future() 1131 fut = loop.create_future()
1637 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1132 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1638 error_handler = lambda err: loop.call_soon_threadsafe( 1133 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1639 fut.set_exception, dbus_to_bridge_exception(err) 1134 self.db_core_iface.contact_update(entity_jid, name, groups, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1640 )
1641 self.db_core_iface.contact_update(
1642 entity_jid,
1643 name,
1644 groups,
1645 profile_key,
1646 timeout=const_TIMEOUT,
1647 reply_handler=reply_handler,
1648 error_handler=error_handler,
1649 )
1650 return fut 1135 return fut
1651 1136
1652 def contacts_get(self, profile_key="@DEFAULT@"): 1137 def contacts_get(self, profile_key="@DEFAULT@"):
1653 loop = asyncio.get_running_loop() 1138 loop = asyncio.get_running_loop()
1654 fut = loop.create_future() 1139 fut = loop.create_future()
1655 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1140 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1656 error_handler = lambda err: loop.call_soon_threadsafe( 1141 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1657 fut.set_exception, dbus_to_bridge_exception(err) 1142 self.db_core_iface.contacts_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1658 )
1659 self.db_core_iface.contacts_get(
1660 profile_key,
1661 timeout=const_TIMEOUT,
1662 reply_handler=reply_handler,
1663 error_handler=error_handler,
1664 )
1665 return fut 1143 return fut
1666 1144
1667 def contacts_get_from_group(self, group, profile_key="@DEFAULT@"): 1145 def contacts_get_from_group(self, group, profile_key="@DEFAULT@"):
1668 loop = asyncio.get_running_loop() 1146 loop = asyncio.get_running_loop()
1669 fut = loop.create_future() 1147 fut = loop.create_future()
1670 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1148 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1671 error_handler = lambda err: loop.call_soon_threadsafe( 1149 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1672 fut.set_exception, dbus_to_bridge_exception(err) 1150 self.db_core_iface.contacts_get_from_group(group, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1673 )
1674 self.db_core_iface.contacts_get_from_group(
1675 group,
1676 profile_key,
1677 timeout=const_TIMEOUT,
1678 reply_handler=reply_handler,
1679 error_handler=error_handler,
1680 )
1681 return fut 1151 return fut
1682 1152
1683 def devices_infos_get(self, bare_jid, profile_key): 1153 def devices_infos_get(self, bare_jid, profile_key):
1684 loop = asyncio.get_running_loop() 1154 loop = asyncio.get_running_loop()
1685 fut = loop.create_future() 1155 fut = loop.create_future()
1686 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1156 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1687 error_handler = lambda err: loop.call_soon_threadsafe( 1157 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1688 fut.set_exception, dbus_to_bridge_exception(err) 1158 self.db_core_iface.devices_infos_get(bare_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1689 ) 1159 return fut
1690 self.db_core_iface.devices_infos_get( 1160
1691 bare_jid, 1161 def disco_find_by_features(self, namespaces, identities, bare_jid=False, service=True, roster=True, own_jid=True, local_device=False, profile_key="@DEFAULT@"):
1692 profile_key, 1162 loop = asyncio.get_running_loop()
1693 timeout=const_TIMEOUT, 1163 fut = loop.create_future()
1694 reply_handler=reply_handler, 1164 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1695 error_handler=error_handler, 1165 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1696 ) 1166 self.db_core_iface.disco_find_by_features(namespaces, identities, bare_jid, service, roster, own_jid, local_device, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1697 return fut 1167 return fut
1698 1168
1699 def disco_find_by_features( 1169 def disco_infos(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"):
1700 self, 1170 loop = asyncio.get_running_loop()
1701 namespaces, 1171 fut = loop.create_future()
1702 identities, 1172 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1703 bare_jid=False, 1173 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1704 service=True, 1174 self.db_core_iface.disco_infos(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1705 roster=True, 1175 return fut
1706 own_jid=True, 1176
1707 local_device=False, 1177 def disco_items(self, entity_jid, node=u'', use_cache=True, profile_key="@DEFAULT@"):
1708 profile_key="@DEFAULT@", 1178 loop = asyncio.get_running_loop()
1709 ): 1179 fut = loop.create_future()
1710 loop = asyncio.get_running_loop() 1180 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1711 fut = loop.create_future() 1181 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1712 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1182 self.db_core_iface.disco_items(entity_jid, node, use_cache, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1713 error_handler = lambda err: loop.call_soon_threadsafe(
1714 fut.set_exception, dbus_to_bridge_exception(err)
1715 )
1716 self.db_core_iface.disco_find_by_features(
1717 namespaces,
1718 identities,
1719 bare_jid,
1720 service,
1721 roster,
1722 own_jid,
1723 local_device,
1724 profile_key,
1725 timeout=const_TIMEOUT,
1726 reply_handler=reply_handler,
1727 error_handler=error_handler,
1728 )
1729 return fut
1730
1731 def disco_infos(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"):
1732 loop = asyncio.get_running_loop()
1733 fut = loop.create_future()
1734 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1735 error_handler = lambda err: loop.call_soon_threadsafe(
1736 fut.set_exception, dbus_to_bridge_exception(err)
1737 )
1738 self.db_core_iface.disco_infos(
1739 entity_jid,
1740 node,
1741 use_cache,
1742 profile_key,
1743 timeout=const_TIMEOUT,
1744 reply_handler=reply_handler,
1745 error_handler=error_handler,
1746 )
1747 return fut
1748
1749 def disco_items(self, entity_jid, node="", use_cache=True, profile_key="@DEFAULT@"):
1750 loop = asyncio.get_running_loop()
1751 fut = loop.create_future()
1752 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1753 error_handler = lambda err: loop.call_soon_threadsafe(
1754 fut.set_exception, dbus_to_bridge_exception(err)
1755 )
1756 self.db_core_iface.disco_items(
1757 entity_jid,
1758 node,
1759 use_cache,
1760 profile_key,
1761 timeout=const_TIMEOUT,
1762 reply_handler=reply_handler,
1763 error_handler=error_handler,
1764 )
1765 return fut 1183 return fut
1766 1184
1767 def disconnect(self, profile_key="@DEFAULT@"): 1185 def disconnect(self, profile_key="@DEFAULT@"):
1768 loop = asyncio.get_running_loop() 1186 loop = asyncio.get_running_loop()
1769 fut = loop.create_future() 1187 fut = loop.create_future()
1770 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1188 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1771 error_handler = lambda err: loop.call_soon_threadsafe( 1189 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1772 fut.set_exception, dbus_to_bridge_exception(err) 1190 self.db_core_iface.disconnect(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1773 )
1774 self.db_core_iface.disconnect(
1775 profile_key,
1776 timeout=const_TIMEOUT,
1777 reply_handler=reply_handler,
1778 error_handler=error_handler,
1779 )
1780 return fut 1191 return fut
1781 1192
1782 def encryption_namespace_get(self, arg_0): 1193 def encryption_namespace_get(self, arg_0):
1783 loop = asyncio.get_running_loop() 1194 loop = asyncio.get_running_loop()
1784 fut = loop.create_future() 1195 fut = loop.create_future()
1785 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1196 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1786 error_handler = lambda err: loop.call_soon_threadsafe( 1197 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1787 fut.set_exception, dbus_to_bridge_exception(err) 1198 self.db_core_iface.encryption_namespace_get(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1788 )
1789 self.db_core_iface.encryption_namespace_get(
1790 arg_0,
1791 timeout=const_TIMEOUT,
1792 reply_handler=reply_handler,
1793 error_handler=error_handler,
1794 )
1795 return fut 1199 return fut
1796 1200
1797 def encryption_plugins_get(self): 1201 def encryption_plugins_get(self):
1798 loop = asyncio.get_running_loop() 1202 loop = asyncio.get_running_loop()
1799 fut = loop.create_future() 1203 fut = loop.create_future()
1800 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1204 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1801 error_handler = lambda err: loop.call_soon_threadsafe( 1205 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1802 fut.set_exception, dbus_to_bridge_exception(err) 1206 self.db_core_iface.encryption_plugins_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1803 )
1804 self.db_core_iface.encryption_plugins_get(
1805 timeout=const_TIMEOUT,
1806 reply_handler=reply_handler,
1807 error_handler=error_handler,
1808 )
1809 return fut 1207 return fut
1810 1208
1811 def encryption_trust_ui_get(self, to_jid, namespace, profile_key): 1209 def encryption_trust_ui_get(self, to_jid, namespace, profile_key):
1812 loop = asyncio.get_running_loop() 1210 loop = asyncio.get_running_loop()
1813 fut = loop.create_future() 1211 fut = loop.create_future()
1814 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1212 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1815 error_handler = lambda err: loop.call_soon_threadsafe( 1213 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1816 fut.set_exception, dbus_to_bridge_exception(err) 1214 self.db_core_iface.encryption_trust_ui_get(to_jid, namespace, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1817 )
1818 self.db_core_iface.encryption_trust_ui_get(
1819 to_jid,
1820 namespace,
1821 profile_key,
1822 timeout=const_TIMEOUT,
1823 reply_handler=reply_handler,
1824 error_handler=error_handler,
1825 )
1826 return fut 1215 return fut
1827 1216
1828 def entities_data_get(self, jids, keys, profile): 1217 def entities_data_get(self, jids, keys, profile):
1829 loop = asyncio.get_running_loop() 1218 loop = asyncio.get_running_loop()
1830 fut = loop.create_future() 1219 fut = loop.create_future()
1831 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1220 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1832 error_handler = lambda err: loop.call_soon_threadsafe( 1221 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1833 fut.set_exception, dbus_to_bridge_exception(err) 1222 self.db_core_iface.entities_data_get(jids, keys, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1834 )
1835 self.db_core_iface.entities_data_get(
1836 jids,
1837 keys,
1838 profile,
1839 timeout=const_TIMEOUT,
1840 reply_handler=reply_handler,
1841 error_handler=error_handler,
1842 )
1843 return fut 1223 return fut
1844 1224
1845 def entity_data_get(self, jid, keys, profile): 1225 def entity_data_get(self, jid, keys, profile):
1846 loop = asyncio.get_running_loop() 1226 loop = asyncio.get_running_loop()
1847 fut = loop.create_future() 1227 fut = loop.create_future()
1848 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1228 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1849 error_handler = lambda err: loop.call_soon_threadsafe( 1229 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1850 fut.set_exception, dbus_to_bridge_exception(err) 1230 self.db_core_iface.entity_data_get(jid, keys, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1851 )
1852 self.db_core_iface.entity_data_get(
1853 jid,
1854 keys,
1855 profile,
1856 timeout=const_TIMEOUT,
1857 reply_handler=reply_handler,
1858 error_handler=error_handler,
1859 )
1860 return fut 1231 return fut
1861 1232
1862 def features_get(self, profile_key): 1233 def features_get(self, profile_key):
1863 loop = asyncio.get_running_loop() 1234 loop = asyncio.get_running_loop()
1864 fut = loop.create_future() 1235 fut = loop.create_future()
1865 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1236 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1866 error_handler = lambda err: loop.call_soon_threadsafe( 1237 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1867 fut.set_exception, dbus_to_bridge_exception(err) 1238 self.db_core_iface.features_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1868 ) 1239 return fut
1869 self.db_core_iface.features_get( 1240
1870 profile_key, 1241 def history_get(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"):
1871 timeout=const_TIMEOUT, 1242 loop = asyncio.get_running_loop()
1872 reply_handler=reply_handler, 1243 fut = loop.create_future()
1873 error_handler=error_handler, 1244 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1874 ) 1245 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1875 return fut 1246 self.db_core_iface.history_get(from_jid, to_jid, limit, between, filters, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1876
1877 def history_get(
1878 self, from_jid, to_jid, limit, between=True, filters="", profile="@NONE@"
1879 ):
1880 loop = asyncio.get_running_loop()
1881 fut = loop.create_future()
1882 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1883 error_handler = lambda err: loop.call_soon_threadsafe(
1884 fut.set_exception, dbus_to_bridge_exception(err)
1885 )
1886 self.db_core_iface.history_get(
1887 from_jid,
1888 to_jid,
1889 limit,
1890 between,
1891 filters,
1892 profile,
1893 timeout=const_TIMEOUT,
1894 reply_handler=reply_handler,
1895 error_handler=error_handler,
1896 )
1897 return fut 1247 return fut
1898 1248
1899 def image_check(self, arg_0): 1249 def image_check(self, arg_0):
1900 loop = asyncio.get_running_loop() 1250 loop = asyncio.get_running_loop()
1901 fut = loop.create_future() 1251 fut = loop.create_future()
1902 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1252 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1903 error_handler = lambda err: loop.call_soon_threadsafe( 1253 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1904 fut.set_exception, dbus_to_bridge_exception(err) 1254 self.db_core_iface.image_check(arg_0, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1905 )
1906 self.db_core_iface.image_check(
1907 arg_0,
1908 timeout=const_TIMEOUT,
1909 reply_handler=reply_handler,
1910 error_handler=error_handler,
1911 )
1912 return fut 1255 return fut
1913 1256
1914 def image_convert(self, source, dest, arg_2, extra): 1257 def image_convert(self, source, dest, arg_2, extra):
1915 loop = asyncio.get_running_loop() 1258 loop = asyncio.get_running_loop()
1916 fut = loop.create_future() 1259 fut = loop.create_future()
1917 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1260 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1918 error_handler = lambda err: loop.call_soon_threadsafe( 1261 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1919 fut.set_exception, dbus_to_bridge_exception(err) 1262 self.db_core_iface.image_convert(source, dest, arg_2, extra, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1920 )
1921 self.db_core_iface.image_convert(
1922 source,
1923 dest,
1924 arg_2,
1925 extra,
1926 timeout=const_TIMEOUT,
1927 reply_handler=reply_handler,
1928 error_handler=error_handler,
1929 )
1930 return fut 1263 return fut
1931 1264
1932 def image_generate_preview(self, image_path, profile_key): 1265 def image_generate_preview(self, image_path, profile_key):
1933 loop = asyncio.get_running_loop() 1266 loop = asyncio.get_running_loop()
1934 fut = loop.create_future() 1267 fut = loop.create_future()
1935 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1268 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1936 error_handler = lambda err: loop.call_soon_threadsafe( 1269 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1937 fut.set_exception, dbus_to_bridge_exception(err) 1270 self.db_core_iface.image_generate_preview(image_path, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1938 )
1939 self.db_core_iface.image_generate_preview(
1940 image_path,
1941 profile_key,
1942 timeout=const_TIMEOUT,
1943 reply_handler=reply_handler,
1944 error_handler=error_handler,
1945 )
1946 return fut 1271 return fut
1947 1272
1948 def image_resize(self, image_path, width, height): 1273 def image_resize(self, image_path, width, height):
1949 loop = asyncio.get_running_loop() 1274 loop = asyncio.get_running_loop()
1950 fut = loop.create_future() 1275 fut = loop.create_future()
1951 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1276 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1952 error_handler = lambda err: loop.call_soon_threadsafe( 1277 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1953 fut.set_exception, dbus_to_bridge_exception(err) 1278 self.db_core_iface.image_resize(image_path, width, height, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1954 )
1955 self.db_core_iface.image_resize(
1956 image_path,
1957 width,
1958 height,
1959 timeout=const_TIMEOUT,
1960 reply_handler=reply_handler,
1961 error_handler=error_handler,
1962 )
1963 return fut 1279 return fut
1964 1280
1965 def init_pre_script(self): 1281 def init_pre_script(self):
1966 loop = asyncio.get_running_loop() 1282 loop = asyncio.get_running_loop()
1967 fut = loop.create_future() 1283 fut = loop.create_future()
1968 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1284 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1969 error_handler = lambda err: loop.call_soon_threadsafe( 1285 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1970 fut.set_exception, dbus_to_bridge_exception(err) 1286 self.db_core_iface.init_pre_script(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1971 )
1972 self.db_core_iface.init_pre_script(
1973 timeout=const_TIMEOUT,
1974 reply_handler=reply_handler,
1975 error_handler=error_handler,
1976 )
1977 return fut 1287 return fut
1978 1288
1979 def is_connected(self, profile_key="@DEFAULT@"): 1289 def is_connected(self, profile_key="@DEFAULT@"):
1980 loop = asyncio.get_running_loop() 1290 loop = asyncio.get_running_loop()
1981 fut = loop.create_future() 1291 fut = loop.create_future()
1982 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1292 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1983 error_handler = lambda err: loop.call_soon_threadsafe( 1293 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1984 fut.set_exception, dbus_to_bridge_exception(err) 1294 self.db_core_iface.is_connected(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
1985 )
1986 self.db_core_iface.is_connected(
1987 profile_key,
1988 timeout=const_TIMEOUT,
1989 reply_handler=reply_handler,
1990 error_handler=error_handler,
1991 )
1992 return fut 1295 return fut
1993 1296
1994 def main_resource_get(self, contact_jid, profile_key="@DEFAULT@"): 1297 def main_resource_get(self, contact_jid, profile_key="@DEFAULT@"):
1995 loop = asyncio.get_running_loop() 1298 loop = asyncio.get_running_loop()
1996 fut = loop.create_future() 1299 fut = loop.create_future()
1997 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1300 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
1998 error_handler = lambda err: loop.call_soon_threadsafe( 1301 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
1999 fut.set_exception, dbus_to_bridge_exception(err) 1302 self.db_core_iface.main_resource_get(contact_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2000 )
2001 self.db_core_iface.main_resource_get(
2002 contact_jid,
2003 profile_key,
2004 timeout=const_TIMEOUT,
2005 reply_handler=reply_handler,
2006 error_handler=error_handler,
2007 )
2008 return fut 1303 return fut
2009 1304
2010 def menu_help_get(self, menu_id, language): 1305 def menu_help_get(self, menu_id, language):
2011 loop = asyncio.get_running_loop() 1306 loop = asyncio.get_running_loop()
2012 fut = loop.create_future() 1307 fut = loop.create_future()
2013 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1308 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2014 error_handler = lambda err: loop.call_soon_threadsafe( 1309 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2015 fut.set_exception, dbus_to_bridge_exception(err) 1310 self.db_core_iface.menu_help_get(menu_id, language, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2016 )
2017 self.db_core_iface.menu_help_get(
2018 menu_id,
2019 language,
2020 timeout=const_TIMEOUT,
2021 reply_handler=reply_handler,
2022 error_handler=error_handler,
2023 )
2024 return fut 1311 return fut
2025 1312
2026 def menu_launch(self, menu_type, path, data, security_limit, profile_key): 1313 def menu_launch(self, menu_type, path, data, security_limit, profile_key):
2027 loop = asyncio.get_running_loop() 1314 loop = asyncio.get_running_loop()
2028 fut = loop.create_future() 1315 fut = loop.create_future()
2029 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1316 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2030 error_handler = lambda err: loop.call_soon_threadsafe( 1317 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2031 fut.set_exception, dbus_to_bridge_exception(err) 1318 self.db_core_iface.menu_launch(menu_type, path, data, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2032 )
2033 self.db_core_iface.menu_launch(
2034 menu_type,
2035 path,
2036 data,
2037 security_limit,
2038 profile_key,
2039 timeout=const_TIMEOUT,
2040 reply_handler=reply_handler,
2041 error_handler=error_handler,
2042 )
2043 return fut 1319 return fut
2044 1320
2045 def menus_get(self, language, security_limit): 1321 def menus_get(self, language, security_limit):
2046 loop = asyncio.get_running_loop() 1322 loop = asyncio.get_running_loop()
2047 fut = loop.create_future() 1323 fut = loop.create_future()
2048 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1324 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2049 error_handler = lambda err: loop.call_soon_threadsafe( 1325 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2050 fut.set_exception, dbus_to_bridge_exception(err) 1326 self.db_core_iface.menus_get(language, security_limit, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2051 )
2052 self.db_core_iface.menus_get(
2053 language,
2054 security_limit,
2055 timeout=const_TIMEOUT,
2056 reply_handler=reply_handler,
2057 error_handler=error_handler,
2058 )
2059 return fut 1327 return fut
2060 1328
2061 def message_encryption_get(self, to_jid, profile_key): 1329 def message_encryption_get(self, to_jid, profile_key):
2062 loop = asyncio.get_running_loop() 1330 loop = asyncio.get_running_loop()
2063 fut = loop.create_future() 1331 fut = loop.create_future()
2064 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1332 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2065 error_handler = lambda err: loop.call_soon_threadsafe( 1333 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2066 fut.set_exception, dbus_to_bridge_exception(err) 1334 self.db_core_iface.message_encryption_get(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2067 ) 1335 return fut
2068 self.db_core_iface.message_encryption_get( 1336
2069 to_jid, 1337 def message_encryption_start(self, to_jid, namespace='', replace=False, profile_key="@NONE@"):
2070 profile_key, 1338 loop = asyncio.get_running_loop()
2071 timeout=const_TIMEOUT, 1339 fut = loop.create_future()
2072 reply_handler=reply_handler, 1340 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2073 error_handler=error_handler, 1341 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2074 ) 1342 self.db_core_iface.message_encryption_start(to_jid, namespace, replace, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2075 return fut
2076
2077 def message_encryption_start(
2078 self, to_jid, namespace="", replace=False, profile_key="@NONE@"
2079 ):
2080 loop = asyncio.get_running_loop()
2081 fut = loop.create_future()
2082 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2083 error_handler = lambda err: loop.call_soon_threadsafe(
2084 fut.set_exception, dbus_to_bridge_exception(err)
2085 )
2086 self.db_core_iface.message_encryption_start(
2087 to_jid,
2088 namespace,
2089 replace,
2090 profile_key,
2091 timeout=const_TIMEOUT,
2092 reply_handler=reply_handler,
2093 error_handler=error_handler,
2094 )
2095 return fut 1343 return fut
2096 1344
2097 def message_encryption_stop(self, to_jid, profile_key): 1345 def message_encryption_stop(self, to_jid, profile_key):
2098 loop = asyncio.get_running_loop() 1346 loop = asyncio.get_running_loop()
2099 fut = loop.create_future() 1347 fut = loop.create_future()
2100 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1348 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2101 error_handler = lambda err: loop.call_soon_threadsafe( 1349 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2102 fut.set_exception, dbus_to_bridge_exception(err) 1350 self.db_core_iface.message_encryption_stop(to_jid, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2103 ) 1351 return fut
2104 self.db_core_iface.message_encryption_stop( 1352
2105 to_jid, 1353 def message_send(self, to_jid, message, subject={}, mess_type="auto", extra={}, profile_key="@NONE@"):
2106 profile_key, 1354 loop = asyncio.get_running_loop()
2107 timeout=const_TIMEOUT, 1355 fut = loop.create_future()
2108 reply_handler=reply_handler, 1356 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2109 error_handler=error_handler, 1357 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2110 ) 1358 self.db_core_iface.message_send(to_jid, message, subject, mess_type, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2111 return fut
2112
2113 def message_send(
2114 self,
2115 to_jid,
2116 message,
2117 subject={},
2118 mess_type="auto",
2119 extra={},
2120 profile_key="@NONE@",
2121 ):
2122 loop = asyncio.get_running_loop()
2123 fut = loop.create_future()
2124 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2125 error_handler = lambda err: loop.call_soon_threadsafe(
2126 fut.set_exception, dbus_to_bridge_exception(err)
2127 )
2128 self.db_core_iface.message_send(
2129 to_jid,
2130 message,
2131 subject,
2132 mess_type,
2133 extra,
2134 profile_key,
2135 timeout=const_TIMEOUT,
2136 reply_handler=reply_handler,
2137 error_handler=error_handler,
2138 )
2139 return fut 1359 return fut
2140 1360
2141 def namespaces_get(self): 1361 def namespaces_get(self):
2142 loop = asyncio.get_running_loop() 1362 loop = asyncio.get_running_loop()
2143 fut = loop.create_future() 1363 fut = loop.create_future()
2144 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1364 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2145 error_handler = lambda err: loop.call_soon_threadsafe( 1365 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2146 fut.set_exception, dbus_to_bridge_exception(err) 1366 self.db_core_iface.namespaces_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2147 ) 1367 return fut
2148 self.db_core_iface.namespaces_get( 1368
2149 timeout=const_TIMEOUT, 1369 def notification_add(self, type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra):
2150 reply_handler=reply_handler, 1370 loop = asyncio.get_running_loop()
2151 error_handler=error_handler, 1371 fut = loop.create_future()
2152 ) 1372 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2153 return fut 1373 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2154 1374 self.db_core_iface.notification_add(type_, body_plain, body_rich, title, is_global, requires_action, arg_6, priority, expire_at, extra, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2155 def notification_add(
2156 self,
2157 type_,
2158 body_plain,
2159 body_rich,
2160 title,
2161 is_global,
2162 requires_action,
2163 arg_6,
2164 priority,
2165 expire_at,
2166 extra,
2167 ):
2168 loop = asyncio.get_running_loop()
2169 fut = loop.create_future()
2170 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2171 error_handler = lambda err: loop.call_soon_threadsafe(
2172 fut.set_exception, dbus_to_bridge_exception(err)
2173 )
2174 self.db_core_iface.notification_add(
2175 type_,
2176 body_plain,
2177 body_rich,
2178 title,
2179 is_global,
2180 requires_action,
2181 arg_6,
2182 priority,
2183 expire_at,
2184 extra,
2185 timeout=const_TIMEOUT,
2186 reply_handler=reply_handler,
2187 error_handler=error_handler,
2188 )
2189 return fut 1375 return fut
2190 1376
2191 def notification_delete(self, id_, is_global, profile_key): 1377 def notification_delete(self, id_, is_global, profile_key):
2192 loop = asyncio.get_running_loop() 1378 loop = asyncio.get_running_loop()
2193 fut = loop.create_future() 1379 fut = loop.create_future()
2194 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1380 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2195 error_handler = lambda err: loop.call_soon_threadsafe( 1381 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2196 fut.set_exception, dbus_to_bridge_exception(err) 1382 self.db_core_iface.notification_delete(id_, is_global, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2197 )
2198 self.db_core_iface.notification_delete(
2199 id_,
2200 is_global,
2201 profile_key,
2202 timeout=const_TIMEOUT,
2203 reply_handler=reply_handler,
2204 error_handler=error_handler,
2205 )
2206 return fut 1383 return fut
2207 1384
2208 def notifications_expired_clean(self, limit_timestamp, profile_key): 1385 def notifications_expired_clean(self, limit_timestamp, profile_key):
2209 loop = asyncio.get_running_loop() 1386 loop = asyncio.get_running_loop()
2210 fut = loop.create_future() 1387 fut = loop.create_future()
2211 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1388 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2212 error_handler = lambda err: loop.call_soon_threadsafe( 1389 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2213 fut.set_exception, dbus_to_bridge_exception(err) 1390 self.db_core_iface.notifications_expired_clean(limit_timestamp, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2214 )
2215 self.db_core_iface.notifications_expired_clean(
2216 limit_timestamp,
2217 profile_key,
2218 timeout=const_TIMEOUT,
2219 reply_handler=reply_handler,
2220 error_handler=error_handler,
2221 )
2222 return fut 1391 return fut
2223 1392
2224 def notifications_get(self, filters, profile_key): 1393 def notifications_get(self, filters, profile_key):
2225 loop = asyncio.get_running_loop() 1394 loop = asyncio.get_running_loop()
2226 fut = loop.create_future() 1395 fut = loop.create_future()
2227 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1396 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2228 error_handler = lambda err: loop.call_soon_threadsafe( 1397 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2229 fut.set_exception, dbus_to_bridge_exception(err) 1398 self.db_core_iface.notifications_get(filters, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2230 )
2231 self.db_core_iface.notifications_get(
2232 filters,
2233 profile_key,
2234 timeout=const_TIMEOUT,
2235 reply_handler=reply_handler,
2236 error_handler=error_handler,
2237 )
2238 return fut 1399 return fut
2239 1400
2240 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"): 1401 def param_get_a(self, name, category, attribute="value", profile_key="@DEFAULT@"):
2241 loop = asyncio.get_running_loop() 1402 loop = asyncio.get_running_loop()
2242 fut = loop.create_future() 1403 fut = loop.create_future()
2243 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1404 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2244 error_handler = lambda err: loop.call_soon_threadsafe( 1405 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2245 fut.set_exception, dbus_to_bridge_exception(err) 1406 self.db_core_iface.param_get_a(name, category, attribute, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2246 ) 1407 return fut
2247 self.db_core_iface.param_get_a( 1408
2248 name, 1409 def param_get_a_async(self, name, category, attribute="value", security_limit=-1, profile_key="@DEFAULT@"):
2249 category, 1410 loop = asyncio.get_running_loop()
2250 attribute, 1411 fut = loop.create_future()
2251 profile_key, 1412 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2252 timeout=const_TIMEOUT, 1413 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2253 reply_handler=reply_handler, 1414 self.db_core_iface.param_get_a_async(name, category, attribute, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2254 error_handler=error_handler, 1415 return fut
2255 ) 1416
2256 return fut 1417 def param_set(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"):
2257 1418 loop = asyncio.get_running_loop()
2258 def param_get_a_async( 1419 fut = loop.create_future()
2259 self, 1420 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2260 name, 1421 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2261 category, 1422 self.db_core_iface.param_set(name, value, category, security_limit, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2262 attribute="value", 1423 return fut
2263 security_limit=-1, 1424
2264 profile_key="@DEFAULT@", 1425 def param_ui_get(self, security_limit=-1, app='', extra='', profile_key="@DEFAULT@"):
2265 ): 1426 loop = asyncio.get_running_loop()
2266 loop = asyncio.get_running_loop() 1427 fut = loop.create_future()
2267 fut = loop.create_future() 1428 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2268 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1429 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2269 error_handler = lambda err: loop.call_soon_threadsafe( 1430 self.db_core_iface.param_ui_get(security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2270 fut.set_exception, dbus_to_bridge_exception(err)
2271 )
2272 self.db_core_iface.param_get_a_async(
2273 name,
2274 category,
2275 attribute,
2276 security_limit,
2277 profile_key,
2278 timeout=const_TIMEOUT,
2279 reply_handler=reply_handler,
2280 error_handler=error_handler,
2281 )
2282 return fut
2283
2284 def param_set(
2285 self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"
2286 ):
2287 loop = asyncio.get_running_loop()
2288 fut = loop.create_future()
2289 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2290 error_handler = lambda err: loop.call_soon_threadsafe(
2291 fut.set_exception, dbus_to_bridge_exception(err)
2292 )
2293 self.db_core_iface.param_set(
2294 name,
2295 value,
2296 category,
2297 security_limit,
2298 profile_key,
2299 timeout=const_TIMEOUT,
2300 reply_handler=reply_handler,
2301 error_handler=error_handler,
2302 )
2303 return fut
2304
2305 def param_ui_get(self, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"):
2306 loop = asyncio.get_running_loop()
2307 fut = loop.create_future()
2308 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2309 error_handler = lambda err: loop.call_soon_threadsafe(
2310 fut.set_exception, dbus_to_bridge_exception(err)
2311 )
2312 self.db_core_iface.param_ui_get(
2313 security_limit,
2314 app,
2315 extra,
2316 profile_key,
2317 timeout=const_TIMEOUT,
2318 reply_handler=reply_handler,
2319 error_handler=error_handler,
2320 )
2321 return fut 1431 return fut
2322 1432
2323 def params_categories_get(self): 1433 def params_categories_get(self):
2324 loop = asyncio.get_running_loop() 1434 loop = asyncio.get_running_loop()
2325 fut = loop.create_future() 1435 fut = loop.create_future()
2326 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1436 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2327 error_handler = lambda err: loop.call_soon_threadsafe( 1437 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2328 fut.set_exception, dbus_to_bridge_exception(err) 1438 self.db_core_iface.params_categories_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2329 ) 1439 return fut
2330 self.db_core_iface.params_categories_get( 1440
2331 timeout=const_TIMEOUT, 1441 def params_register_app(self, xml, security_limit=-1, app=''):
2332 reply_handler=reply_handler, 1442 loop = asyncio.get_running_loop()
2333 error_handler=error_handler, 1443 fut = loop.create_future()
2334 ) 1444 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2335 return fut 1445 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2336 1446 self.db_core_iface.params_register_app(xml, security_limit, app, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2337 def params_register_app(self, xml, security_limit=-1, app=""):
2338 loop = asyncio.get_running_loop()
2339 fut = loop.create_future()
2340 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2341 error_handler = lambda err: loop.call_soon_threadsafe(
2342 fut.set_exception, dbus_to_bridge_exception(err)
2343 )
2344 self.db_core_iface.params_register_app(
2345 xml,
2346 security_limit,
2347 app,
2348 timeout=const_TIMEOUT,
2349 reply_handler=reply_handler,
2350 error_handler=error_handler,
2351 )
2352 return fut 1447 return fut
2353 1448
2354 def params_template_load(self, filename): 1449 def params_template_load(self, filename):
2355 loop = asyncio.get_running_loop() 1450 loop = asyncio.get_running_loop()
2356 fut = loop.create_future() 1451 fut = loop.create_future()
2357 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1452 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2358 error_handler = lambda err: loop.call_soon_threadsafe( 1453 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2359 fut.set_exception, dbus_to_bridge_exception(err) 1454 self.db_core_iface.params_template_load(filename, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2360 )
2361 self.db_core_iface.params_template_load(
2362 filename,
2363 timeout=const_TIMEOUT,
2364 reply_handler=reply_handler,
2365 error_handler=error_handler,
2366 )
2367 return fut 1455 return fut
2368 1456
2369 def params_template_save(self, filename): 1457 def params_template_save(self, filename):
2370 loop = asyncio.get_running_loop() 1458 loop = asyncio.get_running_loop()
2371 fut = loop.create_future() 1459 fut = loop.create_future()
2372 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1460 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2373 error_handler = lambda err: loop.call_soon_threadsafe( 1461 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2374 fut.set_exception, dbus_to_bridge_exception(err) 1462 self.db_core_iface.params_template_save(filename, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2375 ) 1463 return fut
2376 self.db_core_iface.params_template_save( 1464
2377 filename, 1465 def params_values_from_category_get_async(self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@"):
2378 timeout=const_TIMEOUT, 1466 loop = asyncio.get_running_loop()
2379 reply_handler=reply_handler, 1467 fut = loop.create_future()
2380 error_handler=error_handler, 1468 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2381 ) 1469 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2382 return fut 1470 self.db_core_iface.params_values_from_category_get_async(category, security_limit, app, extra, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2383 1471 return fut
2384 def params_values_from_category_get_async( 1472
2385 self, category, security_limit=-1, app="", extra="", profile_key="@DEFAULT@" 1473 def presence_set(self, to_jid='', show='', statuses={}, profile_key="@DEFAULT@"):
2386 ): 1474 loop = asyncio.get_running_loop()
2387 loop = asyncio.get_running_loop() 1475 fut = loop.create_future()
2388 fut = loop.create_future() 1476 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2389 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1477 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2390 error_handler = lambda err: loop.call_soon_threadsafe( 1478 self.db_core_iface.presence_set(to_jid, show, statuses, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2391 fut.set_exception, dbus_to_bridge_exception(err)
2392 )
2393 self.db_core_iface.params_values_from_category_get_async(
2394 category,
2395 security_limit,
2396 app,
2397 extra,
2398 profile_key,
2399 timeout=const_TIMEOUT,
2400 reply_handler=reply_handler,
2401 error_handler=error_handler,
2402 )
2403 return fut
2404
2405 def presence_set(self, to_jid="", show="", statuses={}, profile_key="@DEFAULT@"):
2406 loop = asyncio.get_running_loop()
2407 fut = loop.create_future()
2408 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2409 error_handler = lambda err: loop.call_soon_threadsafe(
2410 fut.set_exception, dbus_to_bridge_exception(err)
2411 )
2412 self.db_core_iface.presence_set(
2413 to_jid,
2414 show,
2415 statuses,
2416 profile_key,
2417 timeout=const_TIMEOUT,
2418 reply_handler=reply_handler,
2419 error_handler=error_handler,
2420 )
2421 return fut 1479 return fut
2422 1480
2423 def presence_statuses_get(self, profile_key="@DEFAULT@"): 1481 def presence_statuses_get(self, profile_key="@DEFAULT@"):
2424 loop = asyncio.get_running_loop() 1482 loop = asyncio.get_running_loop()
2425 fut = loop.create_future() 1483 fut = loop.create_future()
2426 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1484 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2427 error_handler = lambda err: loop.call_soon_threadsafe( 1485 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2428 fut.set_exception, dbus_to_bridge_exception(err) 1486 self.db_core_iface.presence_statuses_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2429 )
2430 self.db_core_iface.presence_statuses_get(
2431 profile_key,
2432 timeout=const_TIMEOUT,
2433 reply_handler=reply_handler,
2434 error_handler=error_handler,
2435 )
2436 return fut 1487 return fut
2437 1488
2438 def private_data_delete(self, namespace, key, arg_2): 1489 def private_data_delete(self, namespace, key, arg_2):
2439 loop = asyncio.get_running_loop() 1490 loop = asyncio.get_running_loop()
2440 fut = loop.create_future() 1491 fut = loop.create_future()
2441 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1492 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2442 error_handler = lambda err: loop.call_soon_threadsafe( 1493 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2443 fut.set_exception, dbus_to_bridge_exception(err) 1494 self.db_core_iface.private_data_delete(namespace, key, arg_2, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2444 )
2445 self.db_core_iface.private_data_delete(
2446 namespace,
2447 key,
2448 arg_2,
2449 timeout=const_TIMEOUT,
2450 reply_handler=reply_handler,
2451 error_handler=error_handler,
2452 )
2453 return fut 1495 return fut
2454 1496
2455 def private_data_get(self, namespace, key, profile_key): 1497 def private_data_get(self, namespace, key, profile_key):
2456 loop = asyncio.get_running_loop() 1498 loop = asyncio.get_running_loop()
2457 fut = loop.create_future() 1499 fut = loop.create_future()
2458 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1500 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2459 error_handler = lambda err: loop.call_soon_threadsafe( 1501 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2460 fut.set_exception, dbus_to_bridge_exception(err) 1502 self.db_core_iface.private_data_get(namespace, key, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2461 )
2462 self.db_core_iface.private_data_get(
2463 namespace,
2464 key,
2465 profile_key,
2466 timeout=const_TIMEOUT,
2467 reply_handler=reply_handler,
2468 error_handler=error_handler,
2469 )
2470 return fut 1503 return fut
2471 1504
2472 def private_data_set(self, namespace, key, data, profile_key): 1505 def private_data_set(self, namespace, key, data, profile_key):
2473 loop = asyncio.get_running_loop() 1506 loop = asyncio.get_running_loop()
2474 fut = loop.create_future() 1507 fut = loop.create_future()
2475 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1508 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2476 error_handler = lambda err: loop.call_soon_threadsafe( 1509 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2477 fut.set_exception, dbus_to_bridge_exception(err) 1510 self.db_core_iface.private_data_set(namespace, key, data, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2478 ) 1511 return fut
2479 self.db_core_iface.private_data_set( 1512
2480 namespace, 1513 def profile_create(self, profile, password='', component=''):
2481 key, 1514 loop = asyncio.get_running_loop()
2482 data, 1515 fut = loop.create_future()
2483 profile_key, 1516 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2484 timeout=const_TIMEOUT, 1517 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2485 reply_handler=reply_handler, 1518 self.db_core_iface.profile_create(profile, password, component, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2486 error_handler=error_handler,
2487 )
2488 return fut
2489
2490 def profile_create(self, profile, password="", component=""):
2491 loop = asyncio.get_running_loop()
2492 fut = loop.create_future()
2493 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2494 error_handler = lambda err: loop.call_soon_threadsafe(
2495 fut.set_exception, dbus_to_bridge_exception(err)
2496 )
2497 self.db_core_iface.profile_create(
2498 profile,
2499 password,
2500 component,
2501 timeout=const_TIMEOUT,
2502 reply_handler=reply_handler,
2503 error_handler=error_handler,
2504 )
2505 return fut 1519 return fut
2506 1520
2507 def profile_delete_async(self, profile): 1521 def profile_delete_async(self, profile):
2508 loop = asyncio.get_running_loop() 1522 loop = asyncio.get_running_loop()
2509 fut = loop.create_future() 1523 fut = loop.create_future()
2510 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1524 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2511 error_handler = lambda err: loop.call_soon_threadsafe( 1525 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2512 fut.set_exception, dbus_to_bridge_exception(err) 1526 self.db_core_iface.profile_delete_async(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2513 )
2514 self.db_core_iface.profile_delete_async(
2515 profile,
2516 timeout=const_TIMEOUT,
2517 reply_handler=reply_handler,
2518 error_handler=error_handler,
2519 )
2520 return fut 1527 return fut
2521 1528
2522 def profile_is_session_started(self, profile_key="@DEFAULT@"): 1529 def profile_is_session_started(self, profile_key="@DEFAULT@"):
2523 loop = asyncio.get_running_loop() 1530 loop = asyncio.get_running_loop()
2524 fut = loop.create_future() 1531 fut = loop.create_future()
2525 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1532 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2526 error_handler = lambda err: loop.call_soon_threadsafe( 1533 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2527 fut.set_exception, dbus_to_bridge_exception(err) 1534 self.db_core_iface.profile_is_session_started(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2528 )
2529 self.db_core_iface.profile_is_session_started(
2530 profile_key,
2531 timeout=const_TIMEOUT,
2532 reply_handler=reply_handler,
2533 error_handler=error_handler,
2534 )
2535 return fut 1535 return fut
2536 1536
2537 def profile_name_get(self, profile_key="@DEFAULT@"): 1537 def profile_name_get(self, profile_key="@DEFAULT@"):
2538 loop = asyncio.get_running_loop() 1538 loop = asyncio.get_running_loop()
2539 fut = loop.create_future() 1539 fut = loop.create_future()
2540 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1540 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2541 error_handler = lambda err: loop.call_soon_threadsafe( 1541 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2542 fut.set_exception, dbus_to_bridge_exception(err) 1542 self.db_core_iface.profile_name_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2543 )
2544 self.db_core_iface.profile_name_get(
2545 profile_key,
2546 timeout=const_TIMEOUT,
2547 reply_handler=reply_handler,
2548 error_handler=error_handler,
2549 )
2550 return fut 1543 return fut
2551 1544
2552 def profile_set_default(self, profile): 1545 def profile_set_default(self, profile):
2553 loop = asyncio.get_running_loop() 1546 loop = asyncio.get_running_loop()
2554 fut = loop.create_future() 1547 fut = loop.create_future()
2555 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1548 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2556 error_handler = lambda err: loop.call_soon_threadsafe( 1549 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2557 fut.set_exception, dbus_to_bridge_exception(err) 1550 self.db_core_iface.profile_set_default(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2558 ) 1551 return fut
2559 self.db_core_iface.profile_set_default( 1552
2560 profile, 1553 def profile_start_session(self, password='', profile_key="@DEFAULT@"):
2561 timeout=const_TIMEOUT, 1554 loop = asyncio.get_running_loop()
2562 reply_handler=reply_handler, 1555 fut = loop.create_future()
2563 error_handler=error_handler, 1556 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2564 ) 1557 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2565 return fut 1558 self.db_core_iface.profile_start_session(password, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2566
2567 def profile_start_session(self, password="", profile_key="@DEFAULT@"):
2568 loop = asyncio.get_running_loop()
2569 fut = loop.create_future()
2570 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2571 error_handler = lambda err: loop.call_soon_threadsafe(
2572 fut.set_exception, dbus_to_bridge_exception(err)
2573 )
2574 self.db_core_iface.profile_start_session(
2575 password,
2576 profile_key,
2577 timeout=const_TIMEOUT,
2578 reply_handler=reply_handler,
2579 error_handler=error_handler,
2580 )
2581 return fut 1559 return fut
2582 1560
2583 def profiles_list_get(self, clients=True, components=False): 1561 def profiles_list_get(self, clients=True, components=False):
2584 loop = asyncio.get_running_loop() 1562 loop = asyncio.get_running_loop()
2585 fut = loop.create_future() 1563 fut = loop.create_future()
2586 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1564 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2587 error_handler = lambda err: loop.call_soon_threadsafe( 1565 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2588 fut.set_exception, dbus_to_bridge_exception(err) 1566 self.db_core_iface.profiles_list_get(clients, components, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2589 )
2590 self.db_core_iface.profiles_list_get(
2591 clients,
2592 components,
2593 timeout=const_TIMEOUT,
2594 reply_handler=reply_handler,
2595 error_handler=error_handler,
2596 )
2597 return fut 1567 return fut
2598 1568
2599 def progress_get(self, id, profile): 1569 def progress_get(self, id, profile):
2600 loop = asyncio.get_running_loop() 1570 loop = asyncio.get_running_loop()
2601 fut = loop.create_future() 1571 fut = loop.create_future()
2602 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1572 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2603 error_handler = lambda err: loop.call_soon_threadsafe( 1573 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2604 fut.set_exception, dbus_to_bridge_exception(err) 1574 self.db_core_iface.progress_get(id, profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2605 )
2606 self.db_core_iface.progress_get(
2607 id,
2608 profile,
2609 timeout=const_TIMEOUT,
2610 reply_handler=reply_handler,
2611 error_handler=error_handler,
2612 )
2613 return fut 1575 return fut
2614 1576
2615 def progress_get_all(self, profile): 1577 def progress_get_all(self, profile):
2616 loop = asyncio.get_running_loop() 1578 loop = asyncio.get_running_loop()
2617 fut = loop.create_future() 1579 fut = loop.create_future()
2618 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1580 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2619 error_handler = lambda err: loop.call_soon_threadsafe( 1581 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2620 fut.set_exception, dbus_to_bridge_exception(err) 1582 self.db_core_iface.progress_get_all(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2621 )
2622 self.db_core_iface.progress_get_all(
2623 profile,
2624 timeout=const_TIMEOUT,
2625 reply_handler=reply_handler,
2626 error_handler=error_handler,
2627 )
2628 return fut 1583 return fut
2629 1584
2630 def progress_get_all_metadata(self, profile): 1585 def progress_get_all_metadata(self, profile):
2631 loop = asyncio.get_running_loop() 1586 loop = asyncio.get_running_loop()
2632 fut = loop.create_future() 1587 fut = loop.create_future()
2633 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1588 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2634 error_handler = lambda err: loop.call_soon_threadsafe( 1589 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2635 fut.set_exception, dbus_to_bridge_exception(err) 1590 self.db_core_iface.progress_get_all_metadata(profile, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2636 )
2637 self.db_core_iface.progress_get_all_metadata(
2638 profile,
2639 timeout=const_TIMEOUT,
2640 reply_handler=reply_handler,
2641 error_handler=error_handler,
2642 )
2643 return fut 1591 return fut
2644 1592
2645 def ready_get(self): 1593 def ready_get(self):
2646 loop = asyncio.get_running_loop() 1594 loop = asyncio.get_running_loop()
2647 fut = loop.create_future() 1595 fut = loop.create_future()
2648 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1596 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2649 error_handler = lambda err: loop.call_soon_threadsafe( 1597 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2650 fut.set_exception, dbus_to_bridge_exception(err) 1598 self.db_core_iface.ready_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2651 )
2652 self.db_core_iface.ready_get(
2653 timeout=const_TIMEOUT,
2654 reply_handler=reply_handler,
2655 error_handler=error_handler,
2656 )
2657 return fut 1599 return fut
2658 1600
2659 def roster_resync(self, profile_key="@DEFAULT@"): 1601 def roster_resync(self, profile_key="@DEFAULT@"):
2660 loop = asyncio.get_running_loop() 1602 loop = asyncio.get_running_loop()
2661 fut = loop.create_future() 1603 fut = loop.create_future()
2662 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1604 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2663 error_handler = lambda err: loop.call_soon_threadsafe( 1605 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2664 fut.set_exception, dbus_to_bridge_exception(err) 1606 self.db_core_iface.roster_resync(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2665 )
2666 self.db_core_iface.roster_resync(
2667 profile_key,
2668 timeout=const_TIMEOUT,
2669 reply_handler=reply_handler,
2670 error_handler=error_handler,
2671 )
2672 return fut 1607 return fut
2673 1608
2674 def session_infos_get(self, profile_key): 1609 def session_infos_get(self, profile_key):
2675 loop = asyncio.get_running_loop() 1610 loop = asyncio.get_running_loop()
2676 fut = loop.create_future() 1611 fut = loop.create_future()
2677 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1612 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2678 error_handler = lambda err: loop.call_soon_threadsafe( 1613 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2679 fut.set_exception, dbus_to_bridge_exception(err) 1614 self.db_core_iface.session_infos_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2680 )
2681 self.db_core_iface.session_infos_get(
2682 profile_key,
2683 timeout=const_TIMEOUT,
2684 reply_handler=reply_handler,
2685 error_handler=error_handler,
2686 )
2687 return fut 1615 return fut
2688 1616
2689 def sub_waiting_get(self, profile_key="@DEFAULT@"): 1617 def sub_waiting_get(self, profile_key="@DEFAULT@"):
2690 loop = asyncio.get_running_loop() 1618 loop = asyncio.get_running_loop()
2691 fut = loop.create_future() 1619 fut = loop.create_future()
2692 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1620 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2693 error_handler = lambda err: loop.call_soon_threadsafe( 1621 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2694 fut.set_exception, dbus_to_bridge_exception(err) 1622 self.db_core_iface.sub_waiting_get(profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2695 )
2696 self.db_core_iface.sub_waiting_get(
2697 profile_key,
2698 timeout=const_TIMEOUT,
2699 reply_handler=reply_handler,
2700 error_handler=error_handler,
2701 )
2702 return fut 1623 return fut
2703 1624
2704 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"): 1625 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
2705 loop = asyncio.get_running_loop() 1626 loop = asyncio.get_running_loop()
2706 fut = loop.create_future() 1627 fut = loop.create_future()
2707 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1628 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2708 error_handler = lambda err: loop.call_soon_threadsafe( 1629 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2709 fut.set_exception, dbus_to_bridge_exception(err) 1630 self.db_core_iface.subscription(sub_type, entity, profile_key, timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2710 )
2711 self.db_core_iface.subscription(
2712 sub_type,
2713 entity,
2714 profile_key,
2715 timeout=const_TIMEOUT,
2716 reply_handler=reply_handler,
2717 error_handler=error_handler,
2718 )
2719 return fut 1631 return fut
2720 1632
2721 def version_get(self): 1633 def version_get(self):
2722 loop = asyncio.get_running_loop() 1634 loop = asyncio.get_running_loop()
2723 fut = loop.create_future() 1635 fut = loop.create_future()
2724 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret) 1636 reply_handler = lambda ret=None: loop.call_soon_threadsafe(fut.set_result, ret)
2725 error_handler = lambda err: loop.call_soon_threadsafe( 1637 error_handler = lambda err: loop.call_soon_threadsafe(fut.set_exception, dbus_to_bridge_exception(err))
2726 fut.set_exception, dbus_to_bridge_exception(err) 1638 self.db_core_iface.version_get(timeout=const_TIMEOUT, reply_handler=reply_handler, error_handler=error_handler)
2727 ) 1639 return fut
2728 self.db_core_iface.version_get(
2729 timeout=const_TIMEOUT,
2730 reply_handler=reply_handler,
2731 error_handler=error_handler,
2732 )
2733 return fut