Last activity patch

Here is a patch to handle the last activity request better. Instead of reseting the idle time for every packet, it does so conditionally. It only resets the idle time if the packet is a presence or message packet.
smackLastActivity.patch.zip (678 Bytes)

you dont need to post 2 seperate threads, one is enough

What do you mean? This is a separate patch for Smack. Should I have posted this along with my patch to Spark in the Spark forum? That one adds functionality to Spark to send a last activity request to away/offline users to show on the pop up while this patch address Smacks issue of resetting the idle time. I had posted them together before, but it seemed like a tricky situation since it’s two separate trees. I was hoping I could at least get the Spark patch added since it would work with other clients and then I could always use a custom version of Smack since it has a privacy issue.

Hi Lemon,

we are basically applying patched to both trees. That was the reason for Wolf’s comment.

Just fo curiousity: What’s the privacy isse for Smack and do you have a patch?

Walter

The privacy issue is that I couldn’t see a way to have Smack respect the “Idle enabled” user setting in Spark. So if a user automatically went idle or manually set there status as away, Smack would reset the idle clock and respond to a last activity request accordingly. So basically people would always be able to tell how long it has been since you changed your status or went idle and haven’t sent a message. Maybe I should have only reset the idle timer on presence packets, but the problem would still be there.

Hi, I read your comment and thought you had committed this patch. But, it doesn’t seem to be in smack source.

Right now presence seems to be pretty broken, so I was wondering when this might get committed.

Waht do you mean with “presence s pretty broken”? Works for me in Spark 2.6.3

Recorded as http://issues.igniterealtime.org/browse/SMACK-345

Sorry, I might be mis-using the term “presence.” What I meant is, no one ever goes idle on Spark, so you don’t have any way to see if they are “away.”

Does your Spark go idle if you are away for a while?

While reviewing your patch I found that it will only call resetIdleTime() when

  1. The packet is of type Presence and the state goes to available

  2. The packet is of type Message and it’s a chat type Message

About

  1. I don’t think that this is desired, because a user could also explictly change from away to extended away. We maybe need a better way to detect human interaction regard presence changes

  2. The test of tyupe chat is not necessray. Type.NORMAL, Type.GROUP_CHAT, … etc should also result in resetIdleTime()

The current implementation is not optimal. It sure has some room for improvement.