JabXPCOM Documentation

JabXPCOM is an XPCOM component which provides access to Jabber from any programming language with XPCOM bindings (such as C++, Java, JavaScript, Python, or Ruby)--currently, it's just a simple wrapper around the C++ jabberoo library released under the GNU Library General Public License.

Building and Installation

Building XPCOM

You can either choose to use a complete Mozilla build (on Debian/Ubuntu, you can just install the mozilla-dev package), or build a standalone XPCOM/XPConnect.

Because I am using a standalone XPConnect build, I will give a few instructions on how to build it in addition to Mozilla's Standalone XPCOM information. The Mozilla project uses its build system for checking out the required parts of the CVS repository:


export CVSROOT=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot"
cvs -z 3 co mozilla/client.mk
cd mozilla
make -f client.mk pull_all BUILD_MODULES=xpconnect MOZ_CO_TAG=MOZILLA_1_0_BRANCH

On a Windows platform you would instead use:


set CVSROOT=":pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot"
cvs -z 3 co mozilla/client.mak
cd mozilla
nmake -f client.mak pull_xpconnect MOZ_CO_TAG=MOZILLA_1_0_BRANCH

If you only want to use XPCOM/XPConnect (and not debug the code yourself), it is a good idea to disable debugging and enable optimisations:


./configure --enable-modules=xpconnect --disable-debug --enable-optimizemake BUILD_MODULES=xpconnect

Again, the build system works a bit differently on a Windows platform:


nmake -f client.mak build_xpconnect

Building PyXPCOM

Your best option is to use my Debian/Ubuntu package from http://cmeerw.org/debian/

Although PyXPCOM packages can be downloaded from ActiveState's Web-site, I don't recommend doing it because the distribution files there are outdated. Better get the current version checked out from the Mozilla CVS repository (see mozilla.org: source code via cvs. You only have to login if you haven't already done so (the password for user anonymous is anonymous):


cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot login
(Logging in to anonymous@cvs-mirror.mozilla.org)
CVS password:

Then change to the directory where your Mozilla sources are and check it out by issuing:


cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot checkout -rMOZILLA_1_7_BRANCH mozilla/extensions/python/xpcom

Before continuing you should probably check the Python related settings in extensions/python/xpcom/src/Makefile.in and extensions/python/xpcom/src/loader/Makefile.in to make sure that they match your setup.

To have the PyXPCOM makefiles integrated into Mozilla's build system, you will also have to apply this patch in Mozilla's home directory: pyxpcom-allmakefiles.diff (via ftp (it is based on this bug report).

In order to build PyXPCOM you have to create the makefiles by running configure in Mozilla's home directoy with --enable-extensions=python/xpcom first. Then you can build it by simply typing make in PyXPCOM's directory:


./configure --enable-modules=xpconnect --enable-extensions=python/xpcom --disable-debug --enable-optimizecd extensions/python/xpcom && make

Building jabberoo

JabXPCOM depends on jabberoo which itself depends on libsigc++. Again, your best option is to use my Debian/Ubuntu package from http://cmeerw.org/debian/

Building JabXPCOM

  • Edit config.mak
  • make
  • Copy the XPCOM components libjabxpcom.so and libtcpstream.so (also libgnutlsstream.so and/or libopensslstream.so if you have built SSL/TLS support) and the type libraries datastream.xpt, jabxpcom.xpt, judoxpcom.xpt and streamconnector.xpt to your Mozilla/XPCOM components directory
  • Run regxpcom (you might have to call it via run-mozilla.sh and/or set LD_LIBRARY_PATH for your Mozilla environment) in your Mozilla/XPCOM components directory
  • If you have successfully installed PyXPCOM you can now try out the JabXPCOM test programs.

Setting Up the Environment

Now that you have (hopefully) everything built, you will need to set up the XPCOM environment (because you usually don't want to mess up your Mozilla browser installation).

The best way to set up the environment is to create a directory for XPCOM and symlink all relevant components into it:

mkdir jabrss
mkdir jabrss/components
cd jabrss/components
ln -s /usr/lib/mozilla/components/proxyObjInst.xpt .
ln -s /usr/lib/mozilla/components/xpcom_base.xpt .
ln -s /usr/lib/mozilla/components/xpcom_components.xpt .
ln -s /usr/lib/mozilla/components/xpcom_ds.xpt .
ln -s /usr/lib/mozilla/components/xpcom_io.xpt .
ln -s /usr/lib/mozilla/components/xpcom_threads.xpt .
ln -s /usr/lib/mozilla/components/xpcom_xpti.xpt .

Now you have to install JabXPCOM/JabRSS into this directory and proceed with the XPCOM registration:

LD_LIBRARY_PATH=/usr/lib/mozilla MOZILLA_FIVE_HOME=. /usr/lib/mozilla/regxpcom

Download

> jabxpcom-0.30 (via ftp) - May 5, 2002; CVS tag: REL_0_30
> jabxpcom-0.20 (via ftp) - Sep 23, 2001; CVS tag: REL_0_20
> jabxpcom-0.10 (via ftp) - Sep 16, 2001; CVS tag: REL_0_10
> jabxpcom-0.01 (via ftp) - May 5, 2001; CVS tag: REL_0_01

JabRSS

Never miss a headline again! JabRSS is a simple RSS (RDF Site Summary) headline notification service for Jabber. It is released under the GNU General Public License.

Source Code

The complete source code is available from the JabXPCOM repository. You can either use the official CVS repository at http://cvs.sunsite.dk/viewcvs.cgi/jabxpcom/
or the bleeding-edge Subversion repository at http://svn.cmeerw.net/src/jabxpcom.
JabRSS itself consists of the files jabrss/jabrss.py and jabrss/parserss.py,
but you will also need a working JabXPCOM installation.

Requirements for Running JabRSS

  • Python 2.2 or 2.3
  • SQLite 3, Debian woody package is here
  • apsw (Another Python SQLite Wrapper), Debian woody package is here
  • PyXPCOM, Debian woody package is here
  • JabXPCOM

Summary of Commands

subscribe http://host.domain/path/to/file.rss .. subscribe to the given RSS URL

unsubscribe http://host.domain/path/to/file.rss .. unsubscribe from the given RSS URL

list .. list currently subscribed RSS URLs (if a URL is marked with "error" it means that the last update of the RSS resource failed for some reason)

info http://host.domain/path/to/file.rss .. display some information about the given RSS URL

set plaintext .. set the message type for headline notifications to normal/plaintext

set chat .. set the message type for headline notifications to chat/plaintext

set headline .. set the message type for headline notifications to headline (please note that not all Jabber clients support headline messages)

set also_deliver {Away} {XA} {DND} .. also deliver headline messages when your presence is "Away", "Extended Away" or "Do Not Disturb"

set size_limit <num> .. limit the size of headline message to the specified amount of bytes

set store_messages <num> .. store at must the specified number of messages for later delivery (note that there is a hard limit of 48)

set header {Title} {URL} .. include an optional header line in headline notifications with the title and/or URL of the feed

set subject {Title} {URL} .. include an optional subject in headline notifications with the title and/or URL of the feed

configuration .. displays your current configuration

show statistics .. displays some basic server statistics

show usage .. displays some basic usage statistics

Usage

First of all you have to subscribe to JabRSS's presence (I am running a JabRSS server with JID jabrss@cmeerw.net) and have to accept the subscription request from JabRSS. Then you can start using it by subscribing to your favorite RSS headlines by sending a subscription command to JabRSS ("subscribe http://some.url/path/to/rss", e.g. send "subscribe http://slashdot.org/slashdot.rdf" to subscribe to Slashdot headlines; or better yet try "subscribe http://cmeerw.org/blog.rdf" which is my Weblog where I will announce JabRSS updates).

If you are looking for other RSS sources, you might want to take a look at Syndic8.com - just search for a feed and subscribe to the RSS URL via jabrss.

There is also a short description on using JabRSS in Spanish on the Biso*os Usuarios de Linux de Mallorca y Alrededores web site.

Terms of Use and Privacy Policy

You are invited to use JabRSS at your own risk. But be warned that any abuse will be acted upon.

The service is provided "as is" without warranty of any kind and might be changed or discontinued at any time without prior notice.

Currently, there is no real privacy policy. Any Jabber message sent to JabRSS might be logged and analysed for debugging purposes. No information about you will be passed on to third parties without your permission.

BTW, if you like this service you could also consider a donation to keep it running.

HTTP Bot Features

  • User-Agent header: "JabRSS (http://jabrss.cmeerw.org)"
  • conditional HTTP GET (Last-Modified and ETag supported)
  • gzip and deflate encoded HTTP requests
  • RSS parser supports RSS 0.90, RSS 0.91, RSS 2.0, RDF 1.0 and Atom 0.3
  • adaptive polling intervals based on the update frequency of the feed (every 30 minutes up to once per day)
  • feeds not supporting conditional HTTP requests will be slightly penalized
  • support for widely-used character data encodings (including UTF-8, UTF-16, ISO8859-1)
  • mostly compliant with RFC 3023
  • proper handling of redirects

Internals

  • SQLite database backend
  • multi-threaded architecture: one thread handling the XMPP communication, another thread polling RSS feeds
  • only feeds that are subscribed to by online users will be polled

Memory Management

As JabXPCOM is built upon jabberoo, it has to take jabberoo's memory management rules into account.

This isn't any problem at all for non-const elements. But some special care has to be taken for (references to) const elements which are passed to callback functions, because these const elements are managed by jabberoo and are deleted when the callback function returns. But as these elements are wrapped inside XPCOM objects and a callback function might store a reference to an XPCOM object, the jabberoo object has to be copied in this case.

Technically, the callback function wrapper checks if any references to the XPCOM object are still held and calls the detach method of the XPCOM wrapper which then takes care of making a local copy of the jabberoo object.

Source Code (CVS and SVN)

The latest bleeding edge development version of JabXPCOM can be found in the Subversion repository on http://svn.cmeerw.net/src/jabxpcom/