Bug 307577

Summary: Facebook contacts can't be preselected
Product: [Unmaintained] telepathy Reporter: Daniel Vrátil <dvratil>
Component: log-viewerAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, mail
Priority: NOR    
Version: unspecified   
Target Milestone: 0.5-next   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 0.5.1
Sentry Crash Report:

Description Daniel Vrátil 2012-09-29 15:33:39 UTC
Facebook contacts can't be preselected in logviewer, because their UID (or at least of some of them) starts with "-", so the command to invoke ktp-log-viewer with such contact preselected looks like
ktp-log-viewer gabble/jabber/some.user_40chat_2efacebook_2ecom0/ -0123456789@chat.facebook.com

This obviously does not work because KCmdLineArgs interprets the contact UID as a switch and fails with "Unknown option '0123456789@chat.facebook.com'."





Reproducible: Always

Steps to Reproduce:
1. chat with some Facebook contact
2. click "Previous Converstions" in textui

Actual Results:  
Nothing happens

Expected Results:  
Logviewer is opened and the contact is correctly preselected

I suggest changing the ktp-log-viewer command line syntax to

ktp-logviewer accountID,contactID

e.g. passing accountID and contactID as a single argument and separate them just by comma for easier parsing. This assumes comma is not an allowed character within accountID and contactID, which I believe is a safe assumption.
Comment 1 David Edmundson 2012-09-29 15:38:18 UTC
Would simply using quotes when loading log viewer fix it?

could you run this from a console and see if it works?

ktp-log-viewer "gabble/jabber/some.user_40chat_2efacebook_2ecom0/" "-0123456789@chat.facebook.com"

The reason I ask is that we shouldn't really be changing the args to a program in a minor release, and this looks like something that would be good to fix in the 0.5.x series.
Comment 2 Daniel Vrátil 2012-09-29 15:55:01 UTC
Hmm, maybe I was too harsh with the review request then :) Anyway nope, it does not work.
Comment 3 George Kiagiadakis 2012-09-30 09:47:32 UTC
It should work with double dashes before the arguments. i.e.:

ktp-log-viewer -- gabble/jabber/some.user_40chat_2efacebook_2ecom0/ -0123456789@chat.facebook.com
Comment 4 Daniel Vrátil 2012-09-30 17:19:51 UTC
That does not work either, because the values are not available in KCmdLineArgs::parserArgs()
Comment 5 Daniel Vrátil 2012-09-30 17:23:20 UTC
Ignore my previous comment, it actually works! I made a typo in the UID before.

I'll fix all the components that invoke logviewer to pass "--" as the first argument.
Comment 6 Daniel Vrátil 2012-09-30 18:28:09 UTC
Git commit 278f9f82550cf763e96585ec5aed6418f9cc760e by Dan Vrátil.
Committed on 30/09/2012 at 19:46.
Pushed by dvratil into branch 'kde-telepathy-0.5'.

Fix invoking logviewer with preselected Facebook contact
REVIEW: 106635

M  +4    -2    app/chat-window.cpp

http://commits.kde.org/telepathy-text-ui/278f9f82550cf763e96585ec5aed6418f9cc760e