Review Request 107295: Add methods to set and get preferred handlers

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Tue Feb 12 00:30:37 UTC 2013



> On Nov. 13, 2012, 11:23 a.m., George Kiagiadakis wrote:
> > That's some very good quality code :)
> > 
> > This API is useful, so I agree to the idea. We need a way to configure handler preferences, especially for tube apps. You will definitely need to distinguish between requested=true/false (think of krfb/krdc) and perhaps TargetHandleType=1/2 for extensibility.
> > 
> > I am not totally sure how this is going to blend with the .desktop files, but here are my thoughts. There are 2 kinds of .desktop files:
> > 
> > 1) Ones that specify actions to start (channels with requested=true). These can populate the CL with actions on contacts for example. For this kind, we will either need a mechanism to group together apps that do the same action (for example vino and krfb) and use this API to know which one is the preferred app to use, or we can let them both be there as actions with the app name in parenthesis or something like that.
> > 
> > 2) Ones that specify notification messages for the approver. Here the approver will have to choose the preferred app and use its .desktop file as a source for the messages. I think it should be possible to use this API for this purpose.
> > 
> > One last thing. I don't really like having desktop sharing in the API. I think that all tube apps should be equal and use the .desktop file specification. We may want to remove it one day (say krfb breaks and nobody maintains it...) or we may want to exchange it with another app that speaks another protocol (other than rfb). The API should stay clean of these changes. But in any case, I think that for the moment it can stay and we can remove it after the whole thing with the .desktop files has been implemented (we don't keep BC anyway).
> 
> Daniele E. Domenichelli wrote:
>     Ok, I thought about it for a while, the problem is that we need to support at least TargetHandleType and Requested, but perhaps we need some more?
>     
>     so I'm thinking to re-implement this to some convention for the saved variables in ktelepathyrc - preferredHandlers section:
>     
>     I have 4 options where I can store the variables:
>     a) Save stuff in the variable name (require some more work when reading the entries from the config file and it could be difficult when we have to hand
>     b) Save stuff in the value
>     c) Use different sections
>     d) Use different files (I would avoid this because it's ugly)
>     
>     Moreover entries can contain the whole property name, or we can make some assumptions
>     
>     1) Full - No assumptions, should always work
>     org.freedesktop.Telepathy.Channel.Type.StreamTube#org.freedesktop.Telepathy.Channel.TargetHandleType:u:1&org.freedesktop.Telepathy.Channel.Requested:b:false&org.freedesktop.Telepathy.Channel.Type.StreamTube.Service:s:rfb=org.freedesktop.Telepathy.Client.krfb_rfb_handler
>     
>     2) Medium - Assume that "org.freedesktop.Telepathy.Channel." can be stripped from filters
>     org.freedesktop.Telepathy.Channel.Type.StreamTube#TargetHandleType:u:1#Requested:b:false#Type.StreamTube.Service:s:rfb=org.freedesktop.Telepathy.Client.krfb_rfb_handler
>     
>     3) Short (assume that we always need TargetHandleType, Requested and sometimes a Service)
>     org.freedesktop.Telepathy.Channel.Type.StreamTube#TargetHandleType:1#Requested:false#Service:rfb=org.freedesktop.Telepathy.Client.krfb_rfb_handler
>     
>     4) Minimal (position based)
>     org.freedesktop.Telepathy.Channel.Type.StreamTube#1#false#rfb=org.freedesktop.Telepathy.Client.krfb_rfb_handler
>     
>     
>     
>     
>     
>     [preferredHandlers]
>     org.freedesktop.Telepathy.Channel.Type.Text=org.freedesktop.Telepathy.Client.KTp.TextUi
>     org.freedesktop.Telepathy.Channel.Type.StreamTube#rfb=advanced
>     
>     [preferredHandlers org.freedesktop.Telepathy.Channel.Type.StreamTube#rfb]
>     default=org.freedesktop.Telepathy.Client.foo
>     TargetHandleType:u:1&Requested:b:false=org.freedesktop.Telepathy.Client.bar
>     Requested:b:false=org.freedesktop.Telepathy.Client.boo
>     
>     
>     
>

Disregard the previous comment, it was some unfinished pending comment that for some reason was still there


- Daniele E.


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107295/#review21927
-----------------------------------------------------------


On Nov. 12, 2012, 4:20 p.m., Daniele E. Domenichelli wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107295/
> -----------------------------------------------------------
> 
> (Updated Nov. 12, 2012, 4:20 p.m.)
> 
> 
> Review request for Telepathy.
> 
> 
> Description
> -------
> 
> Together with https://git.reviewboard.kde.org/r/107169 , I would like to have methods to set and get preferred handlers, so here it is, documentation included.
> 
> In future, when we have the .desktop magic working, I would like to add methods to retrieve available handlers for one channel type in order to have some interface where we can configure them, for now I suggest we start using preferredHandlerForXXX everywhere.
> 
> 
> Diffs
> -----
> 
>   KTp/CMakeLists.txt 0fd12f084384c4df308707b8879e51d8b5908c69 
>   KTp/handlers.h PRE-CREATION 
>   KTp/handlers.cpp PRE-CREATION 
> 
> Diff: http://git.reviewboard.kde.org/r/107295/diff/
> 
> 
> Testing
> -------
> 
> Run this test, works as expected both reading and writing, but I'm too lazy to write proper unit tests, since we don't have them yet in ktp-common-internals (yes, we definitely should have them, but that's another patch)
> 
>     kDebug() << KTp::Handlers::defaultHandlerForTextChat();
>     kDebug() << KTp::Handlers::defaultHandlerForFileTransfer();
>     kDebug() << KTp::Handlers::defaultHandlerForAudioVideo();
>     kDebug() << KTp::Handlers::defaultHandlerForDesktopSharing();
> 
>     kDebug() << KTp::Handlers::preferredHandlerForTextChat();
>     kDebug() << KTp::Handlers::preferredHandlerForFileTransfer();
>     kDebug() << KTp::Handlers::preferredHandlerForAudioVideo();
>     kDebug() << KTp::Handlers::preferredHandlerForDesktopSharing();
> 
>     kDebug() << KTp::Handlers::preferredHandlerForTextChat(QLatin1String("A"));
>     kDebug() << KTp::Handlers::preferredHandlerForFileTransfer(QLatin1String("B"));
>     kDebug() << KTp::Handlers::preferredHandlerForAudioVideo(QLatin1String("C"));
>     kDebug() << KTp::Handlers::preferredHandlerForDesktopSharing(QLatin1String("D"));
> 
>     KTp::Handlers::setPreferredHandlerForTextChat(QLatin1String("E"));
>     KTp::Handlers::setPreferredHandlerForFileTransfer(QLatin1String("F"));
>     KTp::Handlers::setPreferredHandlerForAudioVideo(QLatin1String("G"));
>     KTp::Handlers::setPreferredHandlerForDesktopSharing(QLatin1String("H"));
> 
>     kDebug() << KTp::Handlers::preferredHandlerForTextChat(QLatin1String("I"));
>     kDebug() << KTp::Handlers::preferredHandlerForFileTransfer(QLatin1String("J"));
>     kDebug() << KTp::Handlers::preferredHandlerForAudioVideo(QLatin1String("K"));
>     kDebug() << KTp::Handlers::preferredHandlerForDesktopSharing(QLatin1String("L"));
> 
>     KTp::Handlers::unsetPreferredHandlerForTextChat();
>     KTp::Handlers::unsetPreferredHandlerForFileTransfer();
>     KTp::Handlers::unsetPreferredHandlerForAudioVideo();
>     KTp::Handlers::unsetPreferredHandlerForDesktopSharing();
> 
>     kDebug() << KTp::Handlers::preferredHandlerForTextChat();
>     kDebug() << KTp::Handlers::preferredHandlerForFileTransfer();
>     kDebug() << KTp::Handlers::preferredHandlerForAudioVideo();
>     kDebug() << KTp::Handlers::preferredHandlerForDesktopSharing();
> 
> 
> Thanks,
> 
> Daniele E. Domenichelli
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20130212/bed27563/attachment-0001.html>


More information about the KDE-Telepathy mailing list