Bug 11688 - [Patch] support of xep-0012, last activity
Summary: [Patch] support of xep-0012, last activity
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: gabble (show other bugs)
Version: unspecified
Hardware: Other All
: low enhancement
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-22 10:57 UTC by Michael Scherer
Modified: 2011-08-03 02:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch for supporting jabber:iq:last (7.95 KB, patch)
2007-07-22 10:58 UTC, Michael Scherer
Details | Splinter Review
Support XEP-0012: Last Activity (8.06 KB, patch)
2011-06-27 10:52 UTC, Will Thompson
Details | Splinter Review
MucChannel: fix coding style violations (1.15 KB, patch)
2011-06-27 10:52 UTC, Will Thompson
Details | Splinter Review

Description Michael Scherer 2007-07-22 10:57:15 UTC
XEP-0012 describe a way to get last time since a user sent a message, to see if he is idle since a long time.

Here is a patch that add support of response to this kind of query to gabble. 

It stores the time last message was sent, and calculate the delta between now and this moment to fulfill the request.
Comment 1 Michael Scherer 2007-07-22 10:58:27 UTC
Created attachment 10835 [details] [review]
Patch for supporting jabber:iq:last
Comment 2 Guillaume Desmottes 2007-08-30 02:34:25 UTC
I added your patch in our review system for easier review and merge.
http://projects.collabora.co.uk/~monkey/telepathy-gabble-bug-11688/
Comment 3 Guillaume Desmottes 2007-08-30 03:06:47 UTC
Shouldn't we use time_t instead of gdouble ?


connection_iq_last_cb: please check lm_message_node_get_attribute (iq, "from") != NULL


+  g_free( seconds);  ->  g_free (seconds);

According latest coding style, when you write a function call on multi lines, args have to be 4 spaces alligned.

Except that, patch looks good to me.
Comment 4 Guillaume Desmottes 2008-08-05 05:12:51 UTC
I updated the last version of your patch:
http://monkey.collabora.co.uk/telepathy-gabble-bug-11688/
Comment 5 Will Thompson 2008-10-10 05:31:54 UTC
From a code correctness and style perspective, the branch at
<http://monkey.collabora.co.uk/telepathy-gabble_bug-11688/> looks fine.
However, I have other issues with it.

Section 8 — Security Considerations — of XEP-0012 says:

> A client MUST provide a way for a human user to disable sending of Last
> Activity responses from the client's full JID <localpart@domain.tld/resource>.

Gabble would not provide such a way, and so would be in violation of a MUST.
This could be rectified by adding a send-last-activity connection property,
which should default to False so that existing UIs don't start silently sending
more information about you than you told it to.

Section 4 —  Online User Query — pseudo-defines the idle time to be:

> the last time that the user interacted with the client application

which Gabble would not be sending.  Gabble would be sending the last time an
application interacted with Gabble, which is not even an upper bound on the last
time the user interacted with the client application: Empathy sets your presence
automatically when your screensaver kicks in, at which point the time since the
last activity would be erroneously reset to 0.

There's no way for a Telepathy UI to retrieve the last activity time of a
contact.  In any case, this XEP requires clients to *poll* for the idle time of
their contacts, which is ridiculous.  A better model would be to include the
last activity time (not seconds since last activity) in your presence.  Then, we
could define an interface on org.freedesktop.Telepathy.Connection — IdleTimes,
say — with something resembling the following API:

 » method SetIdle(uint64: last_activity_unix_time) → nothing
   - your presence applet would call this with the time of your last interaction
     — with it or with your entire desktop, per user preference — after you've
     been idle for n minutes (say, 5) or when your screensaver kicks in or
     something
 » method Back() → nothing
 » signal BecameIdle(uint32: handle, uint64: last_activity_unix_time)
   - raised when a contact becomes idle.
 » signal CameBack(uint32: handle)
   - raised when a contact came back.

I don't really see the use of implementing this XEP: its design is fundamentally
wrong.  I'm amazed that I can't find a XEP proposing to do idleness as a
presence attribute; we should write one.  :-)
Comment 6 Will Thompson 2011-06-27 10:48:41 UTC
Wow. I'm not proud of the comment above. The entire second half is completely wrong: the patch did indeed only update the last-activity time when the user actually sent a message, rather than on every stanza sent (as I had assumed at the time). And the tone is not exactly friendly. I apologize, and have updated the patch to apply to current master.
Comment 7 Will Thompson 2011-06-27 10:52:03 UTC
Created attachment 48478 [details] [review]
Support XEP-0012: Last Activity
Comment 8 Will Thompson 2011-06-27 10:52:35 UTC
Created attachment 48479 [details] [review]
MucChannel: fix coding style violations

I noticed these while updating the patch.
Comment 9 Guillaume Desmottes 2011-08-03 02:34:28 UTC
Review of attachment 48478 [details] [review]:

++
Comment 10 Guillaume Desmottes 2011-08-03 02:34:40 UTC
Review of attachment 48479 [details] [review]:

++
Comment 11 Will Thompson 2011-08-03 02:42:40 UTC
Merged to master for 0.13.4.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.