Updated 2013-09-20 04:16:14 by pooryorick

jabberlib, sometimes spelled JabberLib, and also called jlib, allows Tcl programs to connect to other jabber/xmpp agents. It originated in the zABBER project, and was later forked into Coccinella. The original was subsequently also forked into Tkabber. Later, the original was forked yet again into tkchat, leaving no less than four branches of the original jabberlib.

Other than jabber UI clients, it can be used for powerful application messaging, like YAMI and spread.

See Also  edit

mailing list for zABBER and the original jabberlib

Documentation  edit

For Tcl, this seems to be the only jabber library available, and like too many other open-source projects, documentation is not present.

Description  edit

As the Coccinella fork is the most-recently and most-actively updated fork, it is now the de-facto "standard" jabberlib. Its description is as follows:

Coccinella jabberlib  edit

One of the core parts in the Coccinella is the JabberLib, written in Tcl. In order to serve other Tcl developers, it is downloadable here as a separate archive. It's already included in the Coccinella distribution. It hides all of the XML stuff that the Jabber protocol uses. Some test files are included to get you started. No docs available, except a brief summary of commands in the prefix header of each source file.

Included is also a patched TclXML package that is needed for XML parsing in Tcl.

Tkabber jabberlib  edit

vkvalli:

Directory containing jabberlib in Tkabber : jabberlib-tclxml

Important files:
jabberlib
transports
wrapper

The difficult part to understand from the code are how to register callbacks for receiving messages.

Hint: grep for uplevel usage. (Windows users, use tcllib's fileutil::grep.)

The examples code:
jsend
rssbot

For receiving msg aspect, rssbot is more useful.

Flow of events on receiving message:

There is a TCP transport in transports file. I think that seems to be the code for socket receive. It calls jlib::inmsg.

jlib::inmsgwrapper:parserjlib::parseclient:message

It seems the calling application needs to define client:message which is the callback procedure for receive.

The above flow of calling cannot explicitly seen from the code. During jlib:connect, wrapper object is created and stored in some global array. Wrapper object creation takes the commands for parse as one of its argument. jlib::parse is passed as an argument during wrapper:new. Hence it is invoked during wrapper:parse.