Bug 352143

Summary: Any way for open KDE Telepathy chat window in ktp-text-ui via cli or dbus command
Product: [Unmaintained] telepathy Reporter: Murz <MurzNN>
Component: text-uiAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: kde, mklapetek
Priority: NOR    
Version: 0.9.0   
Target Milestone: Future   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Murz 2015-09-02 06:25:08 UTC
Most of jabber clients support opening chat window via command line, for example:
psi --uri=xmpp:contactname@example.com
So I can configure browser and other applications for open chats via same links in web pages.

But I can't find the way how to open chat window in KDE Telepathy Text UI application:
/usr/lib/kde4/libexec/ktp-text-ui --help
shows no variants.

Can you provide some way for open chat with specific contact via command line or other automatic way?

Reproducible: Always
Comment 1 Murz 2015-09-02 06:28:56 UTC
And will be good to provide this way to xmpp and other configured protocols by default for xdg-command:
xdg-open xmpp:contactname@example.com
Comment 2 Murz 2015-09-02 06:51:29 UTC
Same thing is in Kopete:
qdbus org.kde.kopete /Kopete openChat “$contact”

And maybe there are way to open chat via krunner plugin from cli, something like:
qdbus org.kde.krunner /App query ktp-text-ui contactname@example.com
qdbus org.kde.krunner /App contactrunner contactname@example.com
etc.
Comment 3 Martin Klapetek 2015-09-02 13:43:00 UTC
In theory you could use the Telepathy dbus api directly.

My suggestion - run bustle, start a chat from contact list, stop bustle, look at the dbus request it sends. I'm not entirely sure this will be possible at all though.

You can also use KRunner to start chats.
Comment 4 Murz 2015-09-02 14:00:37 UTC
The problem in dbus usage is that it is available only if ktp-text-ui application is open (in memory), but if I close ktp-text-ui window - dbus commands stops working. 

So command line argument will work much easier and stable. I will try to debug dbus commands via bustle, thanks for suggestion.

Via krunner I have found some way to find contact:
qdbus org.kde.krunner /App querySingleRunner ktp_contacts "Contact_nickname"

But this way searching only via "Contact_nickname", via URI like contactname@example.com it can't find contact.

And this command opens krunner window, that need additional manually click for execute action. I can't find the way to auto-execute current action via cli, so I create feature request: https://bugs.kde.org/show_bug.cgi?id=352146

So at now I have see no workaround for this problem.
Comment 5 David Edmundson 2015-09-02 14:15:31 UTC
>The problem in dbus usage is that it is available only if ktp-text-ui application is open

That's not true.

1) for what you're doing you don't want to send a dbus message to KTp anywhere, you want to message the relevant backend to say you want to start a chat; which in turn will start a chat

2) If you did were to send a dbus message to the text-ui it would autostart it

The entire Telepathy spec is built on DBus: http://telepathy.freedesktop.org/spec/
in particular you want: http://telepathy.freedesktop.org/spec/Channel_Dispatcher.html
Comment 6 Murz 2015-09-03 21:36:53 UTC
David Edmundson, thanks for the links. Maybe I misunderstand, but Channel_Dispatcher dbus calls will send messages directly to contact, instead of opening Text UI chat window, or not?

And org.freedesktop.Telepathy.Client.KTp.TextUi is available via 'qdbus | grep Telepathy' command only when I open TextUi window, so with closed window no app can receive my query.

Can you, please, provide some working example via cli dbus command, that opens chat window for some contact? Thanks.
Comment 7 Martin Klapetek 2015-09-03 22:21:40 UTC
As suggested before, please start Bustle, start capturing, start a chat from contact list, stop capturing. That will give you exactly what you need.

I've just tried and the dbus call you want is 

service: org.freedesktop.Telepathy.ChannelDispatcher
path: /org/freedesktop/Telepathy/ChannelDispatcher
iface: org.freedesktop.Telepathy.ChannelDispatcher.EnsureChannelWithHints

For arguments list, see either your Bustle log or http://telepathy.freedesktop.org/spec/Channel_Dispatcher.html#Method:EnsureChannelWithHints

I believe it may actually be easier to write a small command-line utility that would just take account id and contact id and uses TelepathyQt directly.
Comment 8 Justin Zobel 2021-03-09 07:25:57 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 9 Christoph Cullmann 2024-09-18 18:13:06 UTC
Dear user, unfortunately Telepathy is no longer maintained.

Please migrate to another solution, e.g. for Jabber a possibility is Kaidan, for Matrix a candidate is NeoChat.