Bug 35199

Summary: Function to create TpBaseClient from a .client file
Product: Telepathy Reporter: Danielle Madeley <danielle>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED MOVED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: git master   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: write-manager-file.py

Description Danielle Madeley 2011-03-10 23:51:29 UTC
It's so easy for .client files and the TpBaseClient to get out of sync, causing havoc. It would be nice if you could simply create a TpBaseClient from a .client file.

Proposed API:

TpBaseClient *
tp_base_client_new_from_client_file (const char *filename,
    TpSimpleObserverObserveChannelsImpl observe_channels,
    TpSimpleApproverAddDispatchOperationImpl add_dispatch_op,
    TpSimpleHandlerHandleChannelsImpl handle_channels,
    gpointer user_data,
    GDestroyNotify destroy);

If observe_channels, add_dispatch_op or handle_channels were defined, and the .client file did not define that type of client, there could be a WARNING.

All properties such as name, recover, delay_approvers, the filters and capabilities would all be learned from the .client file. The uniquify property would clearly always be FALSE (you don't want a unique name for a registered client).
Comment 1 Will Thompson 2012-03-21 09:55:57 UTC
I've actually just implemented the reverse: a little Python program which introspects a running client and spits out a .client file.

http://cgit.collabora.com/git/user/wjt/telepathy-glib/commit/?h=generate-client-file

The output looks kosher… it remains to be seen whether it works. I will find this out shortly…
Comment 2 Danielle Madeley 2012-03-21 15:22:52 UTC
Created attachment 58833 [details]
write-manager-file.py

FWIW I wrote something similar to generate .manager files. Although I suspect it would be a pain in the neck to use when cross-compiling.
Comment 3 Will Thompson 2012-03-26 08:11:35 UTC
(In reply to comment #2)
> Created attachment 58833 [details]
> write-manager-file.py
> 
> FWIW I wrote something similar to generate .manager files. Although I suspect
> it would be a pain in the neck to use when cross-compiling.

I already wrote one of those, but it lives in tp-python. http://cgit.freedesktop.org/telepathy/telepathy-python/tree/examples/generate-manager-file.py

Yours is much more complete.
Comment 4 Simon McVittie 2012-03-26 10:47:40 UTC
(In reply to comment #2)
> Although I suspect
> it would be a pain in the neck to use when cross-compiling.

This comment has already been made about write-manager-file in Gabble and Rakia.

Perhaps we could have it as a manual step, and just check in the resulting manager files? It's not as if they change very often. If it can be automated (as it can for CMs, but probably not for clients?), the regression tests could sanity-check that it hasn't changed, perhaps?

One alternative way to get a manager/client file out, which is just as problematic for cross-compiling but doesn't need D-Bus or Python, would be to have a C API to write it out, and activate it via a command-line option (like dbus-daemon --introspect).
Comment 5 GitLab Migration User 2019-12-03 20:37:53 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/58.

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.