[JDEV] Chatting with the correct resource

Mikael Hallendal micke at imendio.com
Fri Nov 7 16:28:56 CST 2003

fre 2003-11-07 klockan 18.23 skrev Daniel Chote:
> This was one of the items ive always had an opinion on, since the very 
> first day I started jabber development.. Ive tried 4 different 
> approaches to this method now... And just from my point of view what im 
> doing now is fairly efficient...  In the original Rival, i didnt really 
> cater for resources, everything message was sent to a resource stripped 
> jid.  Rival v2 was pretty much the same, but you "could" specify a jid 
> if you wanted. Rival3 allowed you to view resources in your contact list 
> if you wanted... if you started a chat session with someone, it would go 
> to a recource stripped jid, but if you recieved a message from someone 
> with a resource as the start to a chat session, i would send back to the 
> jid with resource, so... if they got on another client at the same time 
> and sent you a new message, it would create a new chat window based on 
> the new jid...  In the new Rival's that im working on, i take a little 
> more complex approach.  Each roster item in the list as a default 
> resource value, which is generated by collating all the presence 
> recieved from a user, and then ordering it based on <show/>... so.. if 
> someone had 2 resources active, one away and one online... the online 
> resource gets set as the default, if the presence changes, it resorts 
> based on the best one...   So, when a chat session is started, it goes 
> to the resource thats got the highest status..  Im however not looking 
> at presence priority at this point (as most of the time its irrelevant 
> or not recieved :P).

It sounds like the solution you are aiming for now is pretty close to
the one we are doing in Gossip, though we are using the priority instead
of <show/>. In Gossip however this is the same, since we set priority
depending on your <show/>-status. Might be a solution for you aswell
since it'll make your Rival users get the expected results when chatting
with people using priority-aware clients.

Sounds like a good solution to use the resource of an incoming chat and
send to the resource with highest "availability" (however you calculate
it) for outgoing messages.

> So thats how I do it in Rival... I dont feel this is something that 
> _needs_ to be standardised across clients, mainly because of the 
> different user experiences offered by having the selection.   *Not 
> everyone likes the MSN experience*

The problem here is that you almost never chat only with people that use
the same client. And if everyone handles this differently you can't be
sure that there messages will end up where you think they'll do.

  Mikael Hallendal
Mikael Hallendal               micke at imendio.com
Imendio HB                     http://www.imendio.com
Phone: +46 (0)709 718 918

More information about the JDev mailing list