Attachments you submit will be routed for moderation. If you have an account, please
log in first.
|
File 1753.patch, 1.9 KB
(added by sascha_silbe, 3 years ago)
|
|
PresenceService.get_buddy(): accept object path
|
-
From: Sascha Silbe <sascha-pgp@silbe.org>
Subject: [PATCH] PresenceService.get_buddy(): accept object path (#1753)
In addition to public keys accept DBus object paths to be used as identifier
for get_buddy().
This is a prerequisite for inviting legacy clients to Chat.
Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
---
src/sugar/presence/presenceservice.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py
index f4aa6df..d9449da 100644
|
a
|
b
|
|
| 394 | 394 | error_handler=lambda e: \ |
| 395 | 395 | self._get_buddies_error_cb(error_handler, e)) |
| 396 | 396 | |
| 397 | | def get_buddy(self, key): |
| 398 | | """Retrieve single Buddy object for the given public key |
| | 397 | def get_buddy(self, ident): |
| | 398 | """Retrieve single Buddy object for the given public key or object path |
| 399 | 399 | |
| 400 | | key -- buddy's public encryption key |
| | 400 | ident -- buddy's public encryption key or DBus object path |
| 401 | 401 | |
| 402 | 402 | returns single Buddy object or None if the activity |
| 403 | 403 | is not found using GetBuddyByPublicKey on the |
| 404 | 404 | service |
| 405 | 405 | """ |
| | 406 | if ident.startswith('/'): |
| | 407 | return self._new_object(ident) |
| | 408 | |
| 406 | 409 | try: |
| 407 | | buddy_op = self._ps.GetBuddyByPublicKey(dbus.ByteArray(key)) |
| | 410 | buddy_op = self._ps.GetBuddyByPublicKey(dbus.ByteArray(ident)) |
| 408 | 411 | except dbus.exceptions.DBusException: |
| 409 | 412 | _logger.exception('Unable to retrieve buddy handle for %r from ' |
| 410 | | 'presence service', key) |
| | 413 | 'presence service', ident) |
| 411 | 414 | return None |
| 412 | 415 | return self._new_object(buddy_op) |
| 413 | 416 | |
Download in other formats: