Bug 97998

Summary: change jabber priority when away
Product: [Applications] kopete Reporter: Andy Parkins <andyparkins>
Component: Jabber PluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: denilsonsa, scherer.michael
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andy Parkins 2005-01-27 14:10:41 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Context: I log in to my jabber account from home and work; often simultaneously.  The jabber priority is set to be the same for both clients.

Now, new incoming messages go to whichever of the two I logged in at the last.  This means that someone trying to contact me sees that I'm online and sends a message - but I don't get it until I move location.

The solution, I think, is to combine the jabber priority system with the kopete auto-away system.  In addition to marking the session away after a certain period, is it possible that the connection could have its priority lowered as well?

For example, at present in the account options for jabber, on the connection tab, there are location settings for "Resource" and "Priority".  Is it possible to add an additional field - "Away Priority" (defaulting to zero).

A cursory reading of rfc3921 seems to indicate that priority is valid in any presence block, implying that it can be changed during a single log on to the server.

I'll have a look at the kopete source and see what it does at the moment.
Comment 1 Andy Parkins 2005-01-27 14:40:41 UTC
jabberresourcepool.cpp shows that in the case of identical priorities the resource with the latest status().timestamp() will be used - this would address my above requirement perfectly.

However, I've just run tests where I had both running on one screen (one over an SSH tunnelled X connection) and all messages where going to the one that logged in most recently - regardless of away settings of either of them.  Using the resource list available in the tooltip shows that the timestamp is being updated correctly when i change online status.  

Additionally, the resource selection is set to automatic in the sending client.

I'm very confused then as to why messages aren't going to the correct client.  Is this only affecting me?
Comment 2 Till Gerken 2005-01-28 13:25:09 UTC
Kopete locks you to a certain resource of a contact as soon as you received a message from it. Did you make sure that you were sending a message to the contact without having selected a resource? You can see the packet output on the console if you have debugging enabled.

Apart from that, the server is responsible for routing the message. Kopete can try to change the resource priority when going away of course. Does priority have preference over status or the other way around? I'm not sure right now.
Comment 3 Andy Parkins 2005-01-28 16:17:13 UTC
Till: I'm not sure that's true.  For a number of reasons; the first of which is that I was doing these test using an client that had just signed in; ergo it had received no messages from either of the resources.

Secondly (and I may be wrong, I've only looked briefly at the source) jabberbasecontact.cpp uses bestResource() when evaluating the status of the remote and bestResource() when finding the fullAdress() for a contact.

Thirdly, my (again brief) reading of the rfc suggests that the client is responsible for routing to a particular resource.  From section 4.1 of rfc3921: "value of the 'to' address SHOULD be of the form <user@domain/resource> rather than of the form <user@domain> unless the sender has knowledge (via presence) that the intended recipient's resource is no longer available".  In any case, it's not prohibited that the client does routing.

Conversely, I can't see anything in the code that would explain why it's not behaving how I think it should - so I am most likely insane, stupid or both :-)
Comment 4 Michael Scherer 2007-02-20 09:24:58 UTC
Some jabber clients ( gossip, gajim ) do not let the user directly specify the priority but use it to make sure people do not get message when they are away on on client and not on another one. 

I have three coworkers that use kopete, and they both let the client run at home when they are at work. So regulary, messages got routed to the wrong client, because they have placed a priority of 5 on their home ressource and 4 on their work ressource.  

If kopete was able to change the priority based on the presence ( ie if the client is away, set a priority of 10, if he is avaliable, place a priority of 20 ), this would not ahappens. I think this is the sensible thing to do, and this what most, if not all, people expect.
Comment 5 Denilson F. de Sá 2008-01-10 03:18:07 UTC
I agree with Michael Scherer. Pidgin currently sets priority 1 when online and 0 when away. Those are stupid priorities, too low to be useful.

However, changing priorities based on online status is a great feature, specially when the user is able to configure the priorities (and, of course, having sensible default priorities, like maybe 10 for online and 1 for away).

(slightly off-topic: I'm not sure if zero is a valid priority, I remember reading somewhere else that it must be a positive number, greater than zero, but not zero)
Comment 6 Denilson F. de Sá 2008-01-10 03:18:29 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Raphael Kubo da Costa 2010-07-04 03:58:02 UTC
SVN commit 1145738 by rkcosta:

Automatically adjust Jabber priority based on the presence state.

From the original patch description:
"This patch adds the ability to adjust the priority of a jabber resource when
going to an "away" state. This can be used to "redirect" messages to a
different resource (e.g an IM client on a mobile device) base on the presence
state of kopete."

See http://reviewboard.kde.org/r/4274/

Patch from Ralf Haferkamp, thanks!

FEATURE: 97998
GUI:
CCMAIL: rhafer@suse.de


 M  +7 -1      jabberaccount.cpp  
 M  +56 -0     ui/dlgjabbereditaccountwidget.ui  
 M  +28 -0     ui/jabbereditaccountwidget.cpp  
 M  +1 -0      ui/jabbereditaccountwidget.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1145738