Presence-Sensitive CVS Notification

In Section 8.1 early in this chapter, we replaced the email-based CVS notification mechanism with a Jabber-based one. The script used was extremely simple—it connected to the Jabber server specified, authenticated, and sent off the notification message to the recipient JID.

What if we wanted to make the script “sensitive”? Jabber’s presence concept could help us here; if we extended the mechanism to allow for the building of presence-based relationships between the notification script and the notification recipients, we can make the sending of the notification message dependent on the recipient’s availability. “Presence-based relationships” refers to the presence subscription mechanism described in Section 5.4.2.3.

Here’s how it would work:

  • Each potential recipient adds the JID used by the CVS notification script to his roster and sends a subscription request to it.[5]

  • The notification script, called cvsmsg-s (“cvsmsg-sensitive“), on receipt of the presence subscription from a recipient, accepts the request and reciprocates by sending a subscription request back to that recipient.

  • On receipt of the presence subscription from the notification script, the recipient accepts the request.

  • When the notification script starts up to send a message, it announces its own availability with a <presence/> element, which causes the availability of the JIDs to which it has a presence subscription to be sent to it. Based on these <presence/> packets ...

Get Programming Jabber now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.