Programming Jabber

Book description

Jabber is a set of protocols expressed in XML, and an extensible framework that allows people and applications to exchange all sorts of information, from simple text messages to being used to extend the backbone of an enterprise data system. Jabber gives you the power to build applications that have identity, presence, and that can take part in conversations.Programming Jabber offers developers a chance to learn and understand the Jabber technology and protocol from an implementer's point of view. Detailed information of each part of the Jabber protocol is introduced, explained, and discussed in the form of mini-projects, or simple and extended examples. Programming Jabber provides this foundation by:

  • Showing you how to install and configure the Jabber server
  • Providing a detailed overview of the server architecture and configuration options
  • Covering the core Jabber technologies such as XML streams and Jabber identifiers
  • Referencing all of Jabber's XML namespaces
  • Examining the client registration and authentication phases
  • Showing how to deploy your own Jabber-based messaging solutions
  • Demonstrating how to embed XML-RPC-style call mechanisms into Jabber
Programming Jabber is divided into two parts. The first part serves as an introduction to Jabber; you'll learn about its features, why it's more than an IM system, and how to install and configure a Jabber server of your own. The second part provides detailed information about the Jabber protocol, and a series of practical examples, which can be used to solve everyday problems. The examples, in Perl, Python, and Java, use various Jabber features as a way of illustrating parts of the protocol.Programming Jabber provides the foundation and framework for developers to hit the ground running, and is the essential book on Jabber.

Publisher resources

View/Submit Errata

Table of contents

  1. A Note Regarding Supplemental Files
  2. Preface
    1. The History of Jabber
      1. The Pre-Jabber History
      2. Scratching an Itch
      3. Along Came Jabber
    2. IM System Features
    3. What’s Inside
    4. Software Used in This Book
      1. Java
      2. Perl
      3. Python
    5. Where to Go for More Information
    6. Conventions Used in This Book
    7. How to Contact Us
    8. Acknowledgments
  3. I. Getting Started with Jabber
    1. 1. Introducing Jabber
      1. 1.1. Imaginary Jabber Conversation
      2. 1.2. A Simple Script
    2. 2. Inside Jabber
      1. 2.1. XML-Based
      2. 2.2. Asynchronous Nature
        1. 2.2.1. Store and Forward
        2. 2.2.2. Queuing
        3. 2.2.3. Message Receipt
      3. 2.3. Messaging
      4. 2.4. Payload Carrier
      5. 2.5. Request/Response
      6. 2.6. Component/Service Architecture
      7. 2.7. Custom Clients
      8. 2.8. XML-RPC and SOAP
      9. 2.9. Browsing
    3. 3. Installing the Jabber Server
      1. 3.1. Downloading the Jabber Server
      2. 3.2. Installing the Server
        1. 3.2.1. Running the Configure Server
        2. 3.2.2. Running make
      3. 3.3. Configuring the Jabber Server
      4. 3.4. Starting and Stopping the Jabber Server
        1. 3.4.1. Starting the Server
        2. 3.4.2. Connecting a Client
        3. 3.4.3. Stopping the Server
        4. 3.4.4. jabberd Command-Line Switches
      5. 3.5. Monitoring and Troubleshooting the Server
        1. 3.5.1. If Your Server Doesn’t Start
    4. 4. Server Architecture and Configuration
      1. 4.1. An Overview of the Server Architecture
        1. 4.1.1. jabberd and Components
        2. 4.1.2. Component Types
          1. 4.1.2.1. The log components
          2. 4.1.2.2. The xdb components
          3. 4.1.2.3. The service components
          4. 4.1.2.4. Delivery trees
        3. 4.1.3. Component Connection Methods
          1. 4.1.3.1. Library load
          2. 4.1.3.2. TCP sockets
          3. 4.1.3.3. Standard I/O (STDIO)
      2. 4.2. Server Configuration
        1. 4.2.1. Component Instances
        2. 4.2.2. A Typical Component Instance Description
          1. 4.2.2.1. Component type
          2. 4.2.2.2. Identification
          3. 4.2.2.3. Host filter
          4. 4.2.2.4. The <host/> tag
          5. 4.2.2.5. Component connection method
          6. 4.2.2.6. Custom configuration
      3. 4.3. A Tour of jabber.xml
      4. 4.4. Component Instance: sessions
        1. 4.4.1. Component Type and Identification
        2. 4.4.2. Host Filter
        3. 4.4.3. Custom Configuration
          1. 4.4.3.1. Filter service
          2. 4.4.3.2. Server vCard
          3. 4.4.3.3. Registration instructions
          4. 4.4.3.4. Welcome message
          5. 4.4.3.5. Administration
          6. 4.4.3.6. Update info request
          7. 4.4.3.7. Autoupdate of JUD
          8. 4.4.3.8. Browsable service information
        4. 4.4.4. Component Connection Method
      5. 4.5. Component Instance: xdb
        1. 4.5.1. Component Type and Identification
        2. 4.5.2. Host Filter
        3. 4.5.3. Custom Configuration
        4. 4.5.4. Component Connection Method
      6. 4.6. Component Instance: c2s
        1. 4.6.1. Component Type and Identification
        2. 4.6.2. Host Filter
        3. 4.6.3. Custom Configuration
        4. 4.6.4. Component Connection Method
      7. 4.7. Logging Definition: elogger
        1. 4.7.1. Component Type and Identification
        2. 4.7.2. Host Filter
        3. 4.7.3. Custom Configuration
      8. 4.8. Logging Definition: rlogger
        1. 4.8.1. Component Type and Identification
        2. 4.8.2. Host Filter
        3. 4.8.3. Custom Configuration
      9. 4.9. Component Instance: dnsrv
        1. 4.9.1. Component Type and Identification
        2. 4.9.2. Host Filter
        3. 4.9.3. Custom Configuration
        4. 4.9.4. Component Connection Method
      10. 4.10. Component Instance: conf
        1. 4.10.1. Component Type and Identification
        2. 4.10.2. Host Filter
        3. 4.10.3. Custom Configuration
        4. 4.10.4. Component Connection Method
      11. 4.11. Component Instance: jud
        1. 4.11.1. Component Type and Identification
        2. 4.11.2. Host Filter
        3. 4.11.3. Custom Configuration
        4. 4.11.4. Component Connection Method
      12. 4.12. Component Instance: s2s
        1. 4.12.1. Component Type and Identification
        2. 4.12.2. Host Filter
        3. 4.12.3. Custom Configuration
        4. 4.12.4. Component Connection Method
      13. 4.13. The io Section
        1. 4.13.1. The <rate/> Tag
        2. 4.13.2. The <karma/> Tag
        3. 4.13.3. The <ssl/> Tag
        4. 4.13.4. The <allow/> and <deny/> Tags
      14. 4.14. pidfile Section
      15. 4.15. Managing the Configuration
        1. 4.15.1. The <jabberd:cmdline/> Tag
      16. 4.16. Server Constellations
        1. 4.16.1. Multiple Servers on One Host
        2. 4.16.2. “Real” Virtual Jabber Servers
          1. 4.16.2.1. Configuration for a-domain.com
          2. 4.16.2.2. Configuration for b-domain.com
        3. 4.16.3. Splitting Up Jabber Server Processes
          1. 4.16.3.1. Define the configuration for the satellite server
          2. 4.16.3.2. Open a connection point in the main server
          3. 4.16.3.3. List the service definition in <browse/>
          4. 4.16.3.4. Add a connector mechanism to the satellite server
          5. 4.16.3.5. Specify a different PID file location
          6. 4.16.3.6. Starting the main server
          7. 4.16.3.7. Starting the satellite server
        4. 4.16.4. Using Services on Other Jabber Servers
  4. II. Putting Jabber’s Concepts to Work
    1. 5. Jabber Technology Basics
      1. 5.1. Jabber Identifiers
        1. 5.1.1. Rules and Regulations
      2. 5.2. Resources and Priorities
      3. 5.3. XML Streams
        1. 5.3.1. The Conversation as XML Documents
        2. 5.3.2. The Opening Tag
        3. 5.3.3. The Response
          1. 5.3.3.1. The from attribute
          2. 5.3.3.2. The id attribute
        4. 5.3.4. The Simplest Jabber Client
      4. 5.4. Jabber’s Building Blocks
        1. 5.4.1. The Message Element
          1. 5.4.1.1. Message attributes
            1.  
            2.  
            3.  
          2. 5.4.1.2. Message subelements
        2. 5.4.2. The Presence Element
          1. 5.4.2.1. Presence attributes
          2. 5.4.2.2. Presence subelements
            1.  
            2.  
            3.  
          3. 5.4.2.3. Presence subscription
          4. 5.4.2.4. Availability Tracker
        3. 5.4.3. The IQ Element
          1. 5.4.3.1. IQ attributes
          2. 5.4.3.2. IQ subelements
    2. 6. Jabber Namespaces
      1. 6.1. Namespace Usage
      2. 6.2. The IQ Namespaces
        1. 6.2.1. jabber:iq:agent
        2. 6.2.2. jabber:iq:agents
        3. 6.2.3. jabber:iq:auth
        4. 6.2.4. jabber:iq:autoupdate
        5. 6.2.5. jabber:iq:browse
          1. 6.2.5.1. Descending the browse hierarchy from an LDAP reflector
        6. 6.2.6. jabber:iq:conference
          1. 6.2.6.1. The jabber:iq:conference namespace at work
        7. 6.2.7. jabber:iq:gateway
          1. 6.2.7.1. Discovering and using the AIM Transport’s jabber:iq:gateway utility
        8. 6.2.8. jabber:iq:last
        9. 6.2.9. jabber:iq:oob
        10. 6.2.10. jabber:iq:private
          1. 6.2.10.1. Storing public data
        11. 6.2.11. jabber:iq:register
          1. 6.2.11.1. The <key/> tag
        12. 6.2.12. jabber:iq:roster
        13. 6.2.13. jabber:iq:search
        14. 6.2.14. jabber:iq:time
          1. 6.2.14.1. Specifying clients as query targets
        15. 6.2.15. jabber:iq:version
      3. 6.3. The X Namespaces
        1. 6.3.1. jabber:x:autoupdate
        2. 6.3.2. jabber:x:conference
        3. 6.3.3. jabber:x:delay
        4. 6.3.4. jabber:x:encrypted
        5. 6.3.5. jabber:x:envelope
        6. 6.3.6. jabber:x:event
        7. 6.3.7. jabber:x:expire
        8. 6.3.8. jabber:x:oob
        9. 6.3.9. jabber:x:roster
        10. 6.3.10. jabber:x:signed
      4. 6.4. The X::IQ Relationship
      5. 6.5. Miscellaneous Namespaces
        1. 6.5.1. The vcard-temp Namespace
        2. 6.5.2. The XHTML Namespace
    3. 7. User Registration and Authorization
      1. 7.1. XML Stream Flow
      2. 7.2. User Registration
        1. 7.2.1. Configuration and Module Load Directives
        2. 7.2.2. Step by Step
          1. 7.2.2.1. The XML stream header exchange
          2. 7.2.2.2. “Required” fields
          3. 7.2.2.3. Set without get
          4. 7.2.2.4. Still no connection
          5. 7.2.2.5. Passwords
          6. 7.2.2.6. Reversing a user registration
          7. 7.2.2.7. A note on error messages
      3. 7.3. User Authentication
        1. 7.3.1. Configuration and Module Load Directives
          1. 7.3.1.1. Plaintext authentication method
          2. 7.3.1.2. Digest authentication method
          3. 7.3.1.3. Zero-knowledge authentication method
        2. 7.3.2. Choosing the Authentication Method
        3. 7.3.3. Password Errors and Retries
      4. 7.4. User Registration Script
        1. 7.4.1. Using the Script
    4. 8. Using Messages and Presence
      1. 8.1. CVS Notification via Jabber
        1. 8.1.1. CVS Watches and Notification
          1. 8.1.1.1. CVS commands
          2. 8.1.1.2. CVS administrative files
          3. 8.1.1.3. The notification
        2. 8.1.2. CVS Notifications via Jabber
        3. 8.1.3. The cvsmsg Script
      2. 8.2. Dialup System Watch
        1. 8.2.1. Making Preparations for Execution
          1. 8.2.1.1. Presence
          2. 8.2.1.2. Starting and stopping the script
        2. 8.2.2. The HostAlive Script
        3. 8.2.3. Step by Step
      3. 8.3. Presence-Sensitive CVS Notification
        1. 8.3.1. Subscription Relationships
        2. 8.3.2. The cvsmsg-s Script
        3. 8.3.3. Taking the cvsmsg-s Script Step by Step
          1. 8.3.3.1. Presence callback
          2. 8.3.3.2. Connection and authentication
          3. 8.3.3.3. Registration of <presence/> handler
          4. 8.3.3.4. Request for roster
          5. 8.3.3.5. Sending of availability information
          6. 8.3.3.6. Waiting for packets
          7. 8.3.3.7. Finishing up
        4. 8.3.4. Jabber Programming and Callbacks
    5. 9. Groupchat, Components, and Event Models
      1. 9.1. Keyword Assistant
        1. 9.1.1. Conferencing
        2. 9.1.2. The Script’s Scope
        3. 9.1.3. The keyassist Script
        4. 9.1.4. Dissecting the keyassist Script
          1. 9.1.4.1. Maintaining the keyword dictionary
          2. 9.1.4.2. Message callback
          3. 9.1.4.3. Presence callback
          4. 9.1.4.4. The main script
          5. 9.1.4.5. The processing loop
      2. 9.2. Connecting Devices to Jabber
        1. 9.2.1. What We’re Going to Do
        2. 9.2.2. The Coffee Script
        3. 9.2.3. Examining the Coffee Script Step by Step
          1. 9.2.3.1. Declaring the modules, constants, and variables
          2. 9.2.3.2. Initialization and calibration
          3. 9.2.3.3. Connecting to the Jabber server
          4. 9.2.3.4. Sensor poll/presence push loop
          5. 9.2.3.5. The setup_Jabber() function
          6. 9.2.3.6. The set_presence() function
          7. 9.2.3.7. The InPresence() subroutine
          8. 9.2.3.8. The setup_RCX() function
          9. 9.2.3.9. The calibrate() function
          10. 9.2.3.10. The set_status() function
      3. 9.3. An RSS News Agent
        1. 9.3.1. Writing the News Agent
          1. 9.3.1.1. The newsagent script as a component
          2. 9.3.1.2. Working out who gets what newsfeeds
          3. 9.3.1.3. Polling the RSS sources
        2. 9.3.2. Other Differences Between Client and Component Programming
        3. 9.3.3. The RSS News Agent Script
        4. 9.3.4. Reviewing the RSS News Agent Script Step by Step
          1. 9.3.4.1. Module declarations and variable definitions
          2. 9.3.4.2. Connecting to the Jabber server
          3. 9.3.4.3. Preparing the RSS event function and element handlers
          4. 9.3.4.4. Authenticating handshake and launch of main loop
          5. 9.3.4.5. Handling registration requests
          6. 9.3.4.6. Handling version requests
          7. 9.3.4.7. Handling browse requests
          8. 9.3.4.8. Dealing with other requests
          9. 9.3.4.9. The RSS mechanism
          10. 9.3.4.10. The cleanup() function
          11. 9.3.4.11. Helper functions
        5. 9.3.5. Further Ideas
      4. 9.4. A Simple Headline Viewer
        1. 9.4.1. What the Headline Viewer Is Going to Do
        2. 9.4.2. The hlv Script
        3. 9.4.3. Reviewing the hlv Script Step by Step
    6. 10. Pointers for Further Development
      1. 10.1. A Simple Jabber-Based Address Book
        1. 10.1.1. Using the JUD and vCards
        2. 10.1.2. What Demo::JBook Will Do
          1. 10.1.2.1. Searching a JUD
          2. 10.1.2.2. Retrieving vCard information
        3. 10.1.3. Using Demo::JBook as an Apache Handler
        4. 10.1.4. The Demo::JBook Script
        5. 10.1.5. Taking Demo::JBook Step by Step
          1. 10.1.5.1. Declarations
          2. 10.1.5.2. General handler preparation
          3. 10.1.5.3. State 1: Build the JUD query form
          4. 10.1.5.4. State 2: Query the JUD
          5. 10.1.5.5. State 3: Retrieve a vCard
          6. 10.1.5.6. General handler close
        6. 10.1.6. Notes for Improvement
      2. 10.2. XML-RPC over Jabber
        1. 10.2.1. Jabber-RPC
        2. 10.2.2. Building a Requester and a Responder
          1. 10.2.2.1. The responder: JabberRPCResponder
          2. 10.2.2.2. The requester: JabberRPCRequester
        3. 10.2.3. JabberRPCResponder
          1. 10.2.3.1. The RPCHandler class
          2. 10.2.3.2. The IQRPC classes
          3. 10.2.3.3. The JabberRPCResponder script
        4. 10.2.4. Looking at JabberRPCResponder Step by Step
        5. 10.2.5. JabberRPCRequester
        6. 10.2.6. Looking at JabberRPCRequester Step by Step
        7. 10.2.7. Jabber-RPC in Perl
      3. 10.3. Browsing LDAP
        1. 10.3.1. Building the Reflector
          1. 10.3.1.1. Identifying ldapr in the browsing hierarchy
          2. 10.3.1.2. Navigating into the LDAP hierarchy
          3. 10.3.1.3. What the reflector is actually doing
        2. 10.3.2. The ldapr script
        3. 10.3.3. Looking at ldapr Step by Step
          1. 10.3.3.1. Performing the actual reflection
          2. 10.3.3.2. Supporting functions
      4. 10.4. Building an ERP Connection
        1. 10.4.1. Building an Order Approval Notification Mechanism
          1. 10.4.1.1. Getting the notification out of R/3
        2. 10.4.2. The approv Script
        3. 10.4.3. Taking This Further
  5. A. The jabber.xml Contents
  6. B. The IQRPC Classes for JabberRPCResponder
    1. B.1. The IQRPC Class
    2. B.2. The IQRPCBuilder Class
  7. About the Author
  8. Colophon
  9. Copyright

Product information

  • Title: Programming Jabber
  • Author(s): DJ Adams
  • Release date: January 2002
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596002022