Modules
From Mcabber Wiki
Overview
Starting from version 0.10.0 (as of this writing is yet in development state) mcabber supports dynamic loading of modules. It introduces new command '/module' with subcommands to load, unload and obtain info on module. This command is allowed during initialization time, so you can specify it in your mcabberrc. Modules are searched in directory, specified in mcabber variable 'modules_dir', that you should set before issuing these commands. Default module installation/loading directory is '/usr/lib/mcabber'.
Api is still very experimental and likely to be changed, but there is a short HOWTO about writing your own modules in 'doc/' subdirectory of mcabber source. It contains up-to-date information on module-related routines, that mcabber offers and some examples.
Existing modules
Right now there exist next modules (if you know of some other modules, feel free to add them to list below):
- beep (http://mcabber.com/hg/)
Simple module to beep on *all* messages. Available in development version of mcabber (0.10.0). Serves the purpose of example for module writing HOWTO.
Module adds '/disco' command, that sends service discovery requests.
Modularization of legacy mcabber eventcmd script. Available in experimental version of mcabber.
Another approach for eventcmd. It passes arguments to script as environment variables, so, you can use '$jid' instead of $1. Because of this it is more flexible for future changes (see hooks description in HOWTO). Though, it is not officially approved new interface for eventcmd - it is only my vision of it.
Modularization of mcabber fifo. Allows recreation of fifo in run-time by reloading module. Available in experimental version of mcabber.
In-Band and SOCKS5 Bytestreams implementation. Adds command '/stream'. It supports IBB native session initiation and bare SCOKS5 Bytestream requests and can send/receive files this way. Though, this module is, probably, the only implementation, that supports such file transfer methods, so you will be unable to use this module alone to exchange files with, other clients. However this module is designed with ability to be used by other modules as transfer pipe, so, there is si/file-transfer module to transfer files in more convenient way. This module should be considered still in beta stage, but yet already usable.
Lua interface module for mcabber. Adds '/lua' command (and much more in example scripts). Needs much more work, but already usable. Example scripts need some other lua modules, most nonfamous of them is probably lua interface to loudmouth - http://isbear.unixzone.org.ua/source/lua-lm/.
Allows to see mood changes of other buddies and publish your. Adds '/mood' command. Requires 'pep' module.
Provides common incoming message handler for PEP-using modules.
Allows to see music, that buddy listens to, and publish your own. Right now you can use '/tune' command through fifo to update your published tune, but this module also provides means to do this from other modules, and soon there should be mpd module, that will use it.
Allows to see other's activity and publish your. Provides '/activity' command. Requires pep module.
Allows to see other's location and publish your. Provides '/geoloc' command. Requires 'pep' module. Also provides header file to allow other modules to publish information.
Looks for urls in incoming messages and prints them to log and/or calls shell command to handle them.
This is a module, implementing avatar publishing/retrieving via pep/pubsub. This module informs you, when your buddies publish their avatars via pep and provides command '/avatar' to publish your own. But this is not all. It also will actually show you buddy's avatar! Yes, it is aalib :)
Tampering with mcabber's environment. Module can be useful for development and debugging, as well as for on-the-fly changing of some parameters, like AAOPTS for aalib, used in avatar module. Also provides way to change current working directory.
Uses tune module to publish your current playing in MPD (Music Player Daemon) song via pep.
Provides command '/cmd', that sends output of specified shell command to current buddy.
Yet Another Useless Built-In Language. Provides '/eval', '/if', '/then', '/else', '/let' and '/multi' commands. Probably most useful amongst them is '/multi'. If, breaking my expectations, this module becomes useful and famous (presence of beard may cause this), I promise, that I'll improve string/parentheses parsing, add loops and maybe even switch to tree-producing parser with operators precedence.
Adds ability to mark several buddies and do some command for each of these buddies. Provides commands '/mark' and '/marked'.
Allows to define alias-like commands with shell-like positional arguments substitution. Provides command '/templatecmd'. If you're searching for a way to define alias for '/send_to -f <filename_here> .' - this module is for you.
Stream initiation (file transfer profile) module. Uses streams module for its transfer methods, thus, it now supports both IBB and SOCKS5 Bytestreams. Provides command '/si'.
Notes on modules, written by me (Myhailo Danylenko)
- Modules, included in experimental version of mcabber are supposed to merge to mainstream in 0.10.1.
- I use cmake as build system, it allows me quickly generate debian packages (not too accurate, but at least it is package). See README for a brief description how to build module.
- Most modules need more work - to add flexibility, providing mcabber variables, that control module behavior, to check for resource releasing in extreme situations, etc.
- Most modules, that provide some command also include help file for them (in English). You may need to adjust variable help_dirs, if you have installed module with another prefix than mcabber itself to be able to use this help files.
- Every module contains file modulename.rc (by default it will be installed into <install prefix>/share/doc/libmcabber-<modulename>/), that contains list of all mcabber variables introduced by this module with descriptions and load commands, necessary to get this module loaded (i.e. first load commands for modules, that are required for this module to work, then load command for this module itself).
- If you have found a bug in module, please report it here: http://isbear.unixzone.org.ua/bugs/.