Bug 26171

Summary: Need ContactMonitor helper
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 26205, 38142, 38248    
Bug Blocks:    

Description Guillaume Desmottes 2010-01-22 07:57:19 UTC
I'm adding tube support to a game and have to say that the barrier entry is still pretty big. If you want to get the list of contacts supporting a specific tube type you have to:

- Instantiate and prepare an account manager
- Iterate over the accounts and prepare them
- Once an account is ready, get is connection and wait it's ready
- Make an EnsureChannel() call per contact list channel.
- Instantiate a TpChannel and wait it's ready.
- Get the members and call GetContactCapabilities()
- Iterate over the caps and call tp_connection_get_contacts_by_handle() with the handles supporting the desired tube.
- Finally, you have the TpContacts supporting the tube!

Each of these points is a separated function; and we don't even support updating yet!

TpGlib should have a ContactMonitor object (or something like that) to which you pass the kind of channels you want to be supported, does all that boring job for you and returns a list of TpContact.
It would also connect the needed signals and notify you when new contacts are added and removed.
Comment 1 Simon McVittie 2010-01-25 04:33:59 UTC
First, we should have telepathy-qt4-style API for the contact lists (some views of a single merged list, in terms of TpContact objects); then we can add views that are filtered by capability. I'll clone this bug to represent the first part.

I'd anticipate this being in terms of a caller-supplied predicate closure (function/user_data pair), which, given an aa{sv}, tells you whether it is acceptable or not; we could provide some sample predicates, like one each for stream and D-Bus tubes (with user_data = the tube service as a string).
Comment 2 Xavier Claessens 2011-07-29 01:20:50 UTC
Most of this is covered by bug #38142 and bug #26205, the remaining part is getting channel contacts and that's on bug #38248.
Comment 3 Xavier Claessens 2011-08-17 04:45:57 UTC
Let's make this dup of bug #38248 since it would fix this bug as well, and has a branch already.

*** This bug has been marked as a duplicate of bug 38248 ***
Comment 4 Guillaume Desmottes 2011-08-17 07:02:22 UTC
This bug is not closed yet. Getting all the initial connections is indeed much easier but it's still a pain to track update (new account, new connection, etc).
Comment 5 GitLab Migration User 2019-12-03 20:02:28 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-glib/issues/25.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.