[jdev] discovering extensions without disco

Robert McQueen robert.mcqueen at collabora.co.uk
Tue Apr 4 14:50:25 CDT 2006

Google Talk doesn't implement jabber:iq:privacy, and instead they have
decided to add some simple extensions to their roster for various stuff
which I don't care about, but also including blocking and unblocking people.

When the Google Talk client signs in,  something like this is sent to
request the roster:
<iq type="get" id=...>
<query xmlns="jabber:iq:roster" xmlns:gr="google:roster" gr:ext="2" .../>

And the roster comes back with some extra gr: stuff:
<iq type="result" id=...>
<query xmlns="jabber:iq:roster" xlmns:gr="google:roster" gr:ext="2" ...>
<item jid="foo at bar.org" gr:w="4" gr:mc="23" .../>
<item jid="bar at foo.com" gr:t="B" gr:w="3" gr:mc= .../>

I don't know or care what gr:w or gr:mc are, but gr:t is set to "B" on a
blocked contact, and unset when the contact is unblocked, and we'd
really like to be able to offer block/unblock functionality when we're
on a Google Talk server.

Now, the problem with this is that Google Talk doesn't implement service
discovery either, so we can't get a set of <feature var="yada"/> from
their server. My first idea of just looking to see if these gr: things
are set on the roster items does not work if the roster is empty. In
this case, I've got no idea whether the Google roster extensions are
implemented and I should hence offer blocking functionality to the user.

Some servers such as jabberd will just return all of the extra xmlns:gr
stuff to us in the result, like:
<iq type="result" id=...>
<query xmlns="jabber:iq:roster" xlmns:gr="google:roster" gr:ext="2" .../>

Whereas other servers like jabberd2 strip off all of the unknown xmlns:
<iq type="result" id=...>
<query xmlns="jabber:iq:roster" />

So, the only way I can think of to detect whether the google:roster is
supported, if the roster is empty, is to set some nonsense in that
namespace in my roster request:
<iq type="get" id=...>
<query xmlns="jabber:iq:roster" xmlns:gr="google:roster" gr:ext="2"
gr:hack="Dear Google, Please implement service discovery, Love Rob" .../>

In this case, Google's server removes the invalid nonsense in its reply,
so I can distinguish it from the previous two cases. But this is
horrific... Ignoring the merits of Google's decision to implement
blocking using a non-standard extension like this, can anyone think of a
better way to discover support for their extension?

Or is anyone here from Google and would like to implement service
discovery? Something like this:
<iq type="result" id=...>
<query xmlns="http://jabber.org/protocol/disco#info">
<feature var="google:roster" />
Would be great...


More information about the JDev mailing list