Bug 334207

Summary: XMPP connection with Zimbra server shows available contacts as offline
Product: [Unmaintained] telepathy Reporter: Thomas Van Parys <kde>
Component: generalAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, mklapetek, nik
Priority: NOR    
Version: 0.8.0   
Target Milestone: Future   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 0.8.2
Sentry Crash Report:

Description Thomas Van Parys 2014-05-02 08:40:58 UTC
Since recently, Zimbra offers XMPP connection to its chat feature.
http://wiki.zextras.com/wiki/ZxChat

However, contacts that are "Available" will still be listed greyed out as "Offline" in KDE Contact List. 
If you open a chat window for a contact that's actually online (as seen in the zimbra webclient, or in other clients like Pidgin or Thunderbird), the chat window will show the correct status in the window icon (a green dot). Chatting with the online contacts works without problem.

Contacts that have set their status to "busy" or "away" do show up correctly in the contact list.



Reproducible: Always

Steps to Reproduce:
1. Connect to your Zimbra XMPP server
2. Add some contacts (and have them add you back)
3. Make sure your contacts are online ("Available")
4. Open Contact list
Actual Results:  
Contacts appear offline

Expected Results:  
Contacts should appear online

Note that the Pidgin and Thunderbird XMPP clients handle the online presence of Zimbra contacts just fine, so it's unlikely to only be a Zimbra bug.
Comment 1 David Edmundson 2014-05-02 14:56:50 UTC
>the chat window will show the correct status in the window icon (a green dot).
This is weird. I don't quite know what would cause that. 

The bug is almost certainly in either Zimbra or telepathy-gabble (https://bugs.freedesktop.org/) our jabber backend. There is currently no open bug on Zimbra, maybe you could file one?

I would bet Zimbra is doing something odd (wrong) which other clients just happen to handle better. XMPP specs can be less than clear sometimes.

If you run ktp-debugger and have a look in the gabble tab, it should provide some useful information.

If you can provide me access to a zimbra server, I could have a look, until then your best bet is to file a bug upstream with as much debug as possible.

Sorry we can't help much.
Comment 2 Thomas Van Parys 2014-05-02 15:12:47 UTC
I'm sorry, but the zimbra server I'm using is a private one, so I can't give you access.

I ran ktp-debugger and the only thing I could make up from the gabble tab, is that the returned presence for Available contacts is "chat", which are the ones shown as offline in the contact list.
Just a guess, but maybe this string is just not recognised as a valid status by Telepathy?
So either Zimbra should change its returned presence, or Telepathy should accept "chat" as valid.

But as I don't know your code, this is just a wild guess.

Contacts returning "dnd" or "away" are displayed correctly.
Comment 3 Thomas Van Parys 2014-05-02 15:30:35 UTC
(In reply to comment #2)
> I'm sorry, but the zimbra server I'm using is a private one, so I can't give
> you access.
> 
> I ran ktp-debugger and the only thing I could make up from the gabble tab,
> is that the returned presence for Available contacts is "chat", which are
> the ones shown as offline in the contact list.
> Just a guess, but maybe this string is just not recognised as a valid status
> by Telepathy?
> So either Zimbra should change its returned presence, or Telepathy should
> accept "chat" as valid.
> 
> But as I don't know your code, this is just a wild guess.
> 
> Contacts returning "dnd" or "away" are displayed correctly.

Just a quick check:
http://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-show

It seems like Zimbra broadcasts its Available presence as "chat", while this should rather be done by simply omitting the <shown/> tag. Still, Telepathy should recognise this as Available, rather than Offline.

(if these guesses don't make sense, I'll just submit the bug at Zimbra too :-) )

tnx!
Comment 4 Martin Klapetek 2014-05-02 15:32:57 UTC
Do you have a chance to try with Empathy? It's Gnome's Telepathy client, I wonder what happens there with Zimbra

(maybe it's *just* a bug in tp-qt?)
Comment 5 David Edmundson 2014-05-02 15:34:48 UTC
I just checked the same XMPP page :)
It seems you may be onto something. 

I'll have a look at TpQt code, see if there's anything obvious. If not it should be possible to recreate this with my local prosody.
Comment 6 Thomas Van Parys 2014-05-02 15:41:52 UTC
(In reply to comment #4)
> Do you have a chance to try with Empathy? It's Gnome's Telepathy client, I
> wonder what happens there with Zimbra
> 
> (maybe it's *just* a bug in tp-qt?)

Martin,

Indeed.
Empathy displays the Available ("chat") presences correctly as well.
Comment 7 David Edmundson 2014-05-02 15:46:05 UTC
Thanks for all the testing.
Confirming this bug.
Comment 8 David Edmundson 2014-05-02 15:54:56 UTC
We found it.

the kpeople datasource plugin uses the presence status rather than the presence type.

presence.type() maps to the enum which merges the concept of "chat" and "available". Which we use for most code.
.status() is a bit more arbitrary.

We need to either: put a switch on the type in in the datasource

OR

make libkpeople functions and KPeopleTranslationProxy::translatePresence handle "chat" as well as "available".

I think the first one is better?

lets get this in 0.8.2
Comment 9 Thomas Van Parys 2014-05-02 16:01:37 UTC
(In reply to comment #8)
> 
> I think the first one is better?
> 

using .type() indeed seems more straightforward.

> lets get this in 0.8.2

Thanks for the extremely fast response!
Comment 10 David Edmundson 2014-05-03 18:33:43 UTC
Git commit 7a8c0dac8f8e3977f098db0421cbaaed90ad2eda by David Edmundson.
Committed on 02/05/2014 at 23:51.
Pushed by davidedmundson into branch 'kde-telepathy-0.8'.

Map connection presence type to string

In libkpeople we pass the presence around as a string as that's all
KABC::custom() supports.

We used to use presence->status(); this is problematic as it is free
text which can contain anything; especially when on multiple protocols.

A presence might have the status "chat" which is mapped to the presence
type Tp::ConnectionPresenceTypeOnline. We want to use this mapping and
only have a subset of presence strings.

M  +17   -1    kpeople/datasourceplugin/im-persons-data-source.cpp

http://commits.kde.org/telepathy-common-internals/7a8c0dac8f8e3977f098db0421cbaaed90ad2eda
Comment 11 David Edmundson 2014-05-28 18:35:56 UTC
*** Bug 335489 has been marked as a duplicate of this bug. ***