External Component How-To
Sometimes it is not entirely clear how to approach certain scenarios when translating one "legacy" IM service (AIM/ICQ/MSN/etc) into XMPP. Here we will gather together knowledge of ways to handle such scenarios.
Idle Time
In many other IM protocols, there is a separate status of "idle time" that is not related to what your actual away/available/whatever status is. You can be away with an idle time of 5 minutes, or available with an idle time of 2 days. There may be a reason why the latter wants to be shown as available despite being idle so long. That said, simply making an idle time over X minutes turn into away is not a true representation of what the legacy IM service was indicating. As such, I was pointed at a way to indicate idle time using XEP-0108. The following is an example of how I might indicate idle time:
<iq type='set' from='juliet@capulet.com/balcony' to='pubsub.shakespeare.lit' id='activity1'> <pubsub xmlns='http://jabber.org/protocol/pubsub'> <publish node='generic/juliet-activity'> <item id='current'> <activity xmlns='http://jabber.org/protocol/activity'> <inactive/> </activity> <headers xmlns='http://jabber.org/protocol/shim'> <header name='Start'>2005-03-17T19:00:00Z</header> </headers> </item> </publish> </pubsub> </iq>
The start time here is when I -started- being idle. The client should then calculate the difference between "now" and this start time. That way there's no need to keep sending "i'm idle for 5 minutes", "i'm idle for 10 minutes" updates over and over again. Instead, I publish one "I'm idle since" and then I'm done until I no longer want to be idle.
Now how to make this a tad more practical? Probably something involving PEP. Will investigate this later.