Programming Jabber


Table of Contents
Preface. Preface
1. Preface
What Is Jabber?
The History Of Jabber
IM System Features
What's Inside
The Software
Conventions Used in This Book
How to Contact Us
Acknowledgments
I. Getting Started with Jabber
1. A Taste of Things to Come
Imaginary Conversation
A Simple Script
2. Inside Jabber
XML-Based
Asynchronous Nature
Messaging
Payload Carrier
Request/Response
Component/Service Architecture
Custom Clients
XML-RPC and SOAP
Browsing
3. Installing the Jabber Server
The Jabber Server
4. Server Architecture and Configuration
An Overview of the Server Architecture
Server Configuration
A Tour of jabber.xml
Managing the Configuration
Server Constellations
II. Putting Jabber's Concepts to Work
5. Jabber Technology Basics
Jabber Identifiers
Resources and Priority
XML Streams
The Jabber Building Blocks
5a. Jabber Namespaces
Namespace usage
The IQ Namespaces
The X Namespaces
The X::IQ relationship
6. User Registration and Authorization
XML Stream Flow
User Registration
User Authentication
User Registration Script
7. Messages, Presence, and Presence Subscription
CVS notification
Dialup system watch
Presence-sensitive CVS notification
8. Extending Messages, Groupchat, Components, and Event Models
Keyword assistant
Any coffee left?
RSS punter
Headline viewer
9. Pointers for further development
From client to component
XML-RPC over Jabber
The ERP connection
Browsing LDAP
Conferencing
Appendices. Appendices
A. The jabber.xml Contents
List of Tables
3-1. Command Line Switches
4-1. Filter conditions
4-2. Filter actions
4-3. Effect of <timeout/> tag
4-4. Logging component variables for <format/>
4-5. Conference room settings
4-6. Settings for karma control, with c2s and s2s values
5-1. JID restrictions
5-2. Conversation Namespaces
5-3. Standard Error Codes and Texts
5-4. Presence 'show' values
5a-1. jabber:iq:browse Categories
8-1. RCX "Spirit" ActiveX control properties and functions used
8-2. Jabber and Tk event model reflections
List of Figures
1-1. The Distributed Architecture of Jabber
2-1. Element traffic in an IQ-based conversation
4-1. jabberd and the components
4-2. The Jabber Delivery Tree
4-3. A diagram of the c2s instance configuration in jabber.xml
4-4. Configuration file in diagram form
4-5. Diagram view of sessions component instance
4-6. Storage of server-side user data by hostname
4-7. A message filter
4-8. Diagram view of xdb component instance
4-9. Diagram view of c2s component instance
4-10. Diagram view of elogger
4-11. Diagram view of rlogger
4-12. Diagram view of dnsrv component instance
4-13. Diagram view of conf component instance
4-14. Diagram view of jud component instance
4-15. Diagram view of s2s component instance
4-16. Diagram view of io section
4-17. Diagram view of pidfile section
5-1. Resources, Priority, and Message Delivery
5-2. Changing presence and priority in the WinJab client
5-3. Client<->Server conversation as a pair of streamed XML documents
5a-1. The LDAP hierarchy browsed in the section called Descending the browse hierarchy from an LDAP reflector
6-1. XML Stream flow showing registration and authentication
6-2. A script implementing the client-side zero-knowledge process
6-3. Uses of the reguser script
6-4. An IQ packet under construction by Net::Jabber::IQ
7-1. A typical email CVS notification
7-2. Adding myserver@gnu.pipetree.com to the roster
7-3. Creating the authorization packet
7-4. myserver becoming available and relaying its IP address
7-5. Handlers and the relationship between the Jabber library and your script
7-6. <presence/> elements and roster <item/>s in an "unsubscription conversation"
8-1. The LEGO Mindstorms RCX, or "programmable brick"
8-2. Our device "looking at" the coffee pot
8-3. Running the coffee script in calibration mode
8-4. Receiving information on the coffee's status in WinJab
8-5. JabberCentral's main page
8-6. WinJab's "Agents" menu
8-7. Jarl's headline display window
8-8. Registering with the RSS punter with JIM
8-9. The headline viewer client
A-1. Version 1.4.1 jabber.xml with JUD and Conferencing
List of Examples
1-1. A simple Jabber script
2-1. Qualifying a fragment extension with a namespace
2-2. A jabber:x:delay extension adds meaning to a <presence/> element
2-3. A jabber:x:oob extension is the heart of a <message/> element
2-4. A typical HTTP request/reponse
2-5. A simple client version query via the IQ model
2-6. A multiple-phase IQ to register a user
2-7. Staggered response from IQ-based search request
3-1. Typical output from configure
3-2. Typical output from make
4-1. A <log/> packet
4-2. An <xdb/> data packet
4-3. Two service packets
4-4. Loading of the c2s component with library load
4-5. Loading of the jsm component with library load
4-6. Invoking an external component with STDIO
4-7. The c2s instance configuration in jabber.xml
4-8. jabber.xml configuration for the sessions component instance
4-9. A message filter with two rules
4-10. jabber.xml configuration for the xdb component instance
4-11. Host and namespace filters in an xdb definition
4-12. jabber.xml configuration for the c2s component instance
4-13. jabber.xml configuration for elogger
4-14. jabber.xml configuration for rlogger
4-15. jabber.xml configuration for the dnsrv component instance
4-16. jabber.xml configuration for the conf component instance
4-17. jabber.xml configuration for the jud component instance
4-18. jabber.xml configuration for the s2s component instance
4-19. jabber.xml configuration for the io section
4-20. Specifying SSL certificate & key files per IP address
4-21. Using <allow/> and <deny/> to control connections
4-22. jabber.xml configuration for the pidfile section
4-23. Configuration XML organised with <jabberd:include/>
4-24. Virtual server jabber.xml configuration
5-1. Querying the server yak for online users
5-2. A Chunk of Conversation between a Jabber client and a Jabber server
5a-1. JIM retrieves user preferences stored in a jabber:iq:private namespace
5a-2. Section of user's spool storage showing public and private data
5a-3. An agents or browse query reveals registration and search mechanisms
5a-4. A typical roster
5a-5. Raising and cancelling the <composing/> evevent
5a-6. Storage of an offline message with the jabber:x:expire extension
6-1. A typical user registration process
6-2. Changing a password with jabber:iq:register
6-3. A typical user authentication process
7-1. A Jabber notification formula in the notify file
7-2. Matching users to JIDs in the notify file
7-3. An ip-up starter script
7-4. An ip-down stopper script
7-5. A presence subscription request from dj@gnu.pipetree.com
7-6. Acceptance of a presence subscription request from dj@gnu.pipetree.com
7-7. A presence subscription request with a reason
8-1. Querying the Conferencing component's version
8-2. The Groupchat protocol in action
8-3. Typical contents of the Keyword assistant's hash
8-4. A message to a non-existent transient JID is rejected
8-5. A <presence/> element representing the NOCOFFEE state
8-6. RSS source for JabberCentral
8-7. A headline message carrying a JabberCentral news item
8-8. A component instance definition for our RSS punter mechanism
8-9. An alternative instance definition for our RSS punter mechanism
8-10. The RSS component's stream header
8-11. The server's stream header reply
8-12. A registration conversation for RSS sources
8-13. The JSM configuration's <browse/> section
8-14. A Conferencing component responds to a version query
8-15. Typical contents of the registration hash
8-16. RSS punter responds to jabber:iq:browse requests via iq_browse()