[jdev] GEOLOC Support

Joe Hildebrand hildjj at gmail.com
Thu Sep 11 17:26:44 CDT 2008


On Sep 9, 2008, at 10:24 AM, Stephen Pendleton wrote:

> Hi, I thought I would put together a simple "cookbook" on how to add  
> GEOLOC XEP-0080 support to a client. Hopefully it will help someone  
> else out. If anyone sees any problems with the steps below, please  
> let me know. BTW, I am not sure why Step 1 is needed since Step 2  
> advertises the same capabilities.

Step 1 is required, because when someone asks what your caps hash  
means, you have to be able to answer.  It's important that the results  
from step 1 match the stuff that is hashed in step 2.

> STEPS TO ADD GEOLOC SUPPORT:
> 1) Client should respond to iq query http://jabber.org/protocol/disco#info 
>  with a stanza like:
> <iq type='result'...>
> <<query xmlns='http://jabber.org/protocol/disco#info'>
> <feature var='http://jabber.org/geoloc'/>
> <feature var='http://jabber.org/geoloc+notify'/>

Only include http://jabber.org/geoloc if you expect people to send you  
iq's in the geoloc namespace directly.  That would be pretty rare.

> 2) Client should add <c> stanza to presence stanza with the proper  
> "ver" attribute indicating geoloc support.
> The "ver" attribute is a SHA-1 hash of a string like:
> "client/pc//fooclient 1.0<http://jabber.org/protcol/geoloc<http://jabber.org/protcol/geoloc+notify 
> <"
>
> The stanza looks something like:
> <presence from='romeo at montague.lit/orchard'>
>   <c xmlns='http://jabber.org/protocol/caps'
>      hash='sha-1'
>      node='http://www.chatopus.com'
>      ver='zHyEOgxTrkpSdGcQKH8EFPLsriY='/>
> </presence>
>
> 3) When location changes the client publishes its new location:
> <iq type='set' from='portia at merchantofvenice.lit/pda' id='publish1'>
>   <pubsub xmlns='http://jabber.org/protocol/pubsub'>
>     <publish node='http://jabber.org/protocol/geoloc'>
>       <item>
>         <geoloc xmlns='http://jabber.org/protocol/geoloc'  
> xml:lang='en'>
>           <country>Italy</country>
>           <lat>45.44</lat>
>           <locality>Venice</locality>
>           <lon>12.33</lon>
>         </geoloc>
>       </item>
>     </publish>
>   </pubsub>
> </iq>

If you just want to publish, you don't need to do steps 1 and 2.  They  
take care of the subscribe side.



More information about the JDev mailing list