Presence spreed plugin auto unavailable not working (with solution)

Hi,
I’m running kopano-presence 8.6.80.743-0+84.1 and I had to change if int(time.time()) - info['last_update'] > self.limit*60: to if time.time() - info['last_update'] > int(self.limit)*60: in plugin_spreed.py for it to work.

Hi @nbj ,

I think I have seen that still working recently, Will see if I can reproduce your issue later this week.

btw: still have your other post on my to do list.

Hi @nbj ,

it took a while but I finally found some time to play around with this. For me logged in users to WebApp always stay available, regardless if you changes are applied or not. This only changes when the user closed the webapp window, then the code seems to kick in and set the user to unavailable.

I’m not exactly sure about the intended behaviour here, will consult with a developer on this.

ok, hat a quick hat with a developer. So the intended workflow is as followed:

  • When a user has WebApp open. WebApp sends “I’m there” messages for the user to presence
  • that part in the code where you made your changes loops over all the states and checks which user has not sent his/her “I’m there” for a defined time (two minutes in the default configuration).
    -if a user did not check in then the following is logged:
2018-05-31 14:03:23,650 - presence - INFO - spreed: auto unavailable
2018-05-31 14:03:23,650 - presence - DEBUG - spreed: user1 unavailable

And that indeed does work here fore me (without your changes applied).

Are we talking about different things?

Hi @fbartels,
What was happening to me was that when the user logged out webapp/closed browser window but didn’t logout from webmeetings (probably what a user will do every time) it stayed as online and never changed state to offline. With the proposed modification the user goes offline after 2 minutes if the server doesn’t received a status update in the meantime.

I changed the cast to the int(self.limit)*60 because without it I was getting the self.limit repeated 60 (eg “2*60=2222222222222222222222222…”) times instead of a numerical result (“2*60=120”). This way int(time.time()) - info['last_update'] > self.limit*60: would never return true.

For the record I’m running it in Ubuntu 16.04.4 with Python 2.7.12