examples/README
author Myhailo Danylenko <isbear@ukrpost.net>
Wed, 28 Nov 2012 20:17:53 +0200
changeset 146 04d19c9c1196
parent 121 75a7d595817c
permissions -rw-r--r--
Fix module loading problem


# How to use these scrpits (and how they are organized):

Scripts are generally separated into two classes - library
(those in lm subdirectory), that deal mainly with lm and xmpp
stuff, and mcabber, that provide mcabber interface for library
scripts - mcabber commands, mcabber message handlers, etc.

Most of mcabber scripts expect to be require'd from
mcabberrc.lua. For 'require' to find scripts, you need to
properly set package.path, and in mcabberrc.lua there is
example of this at the beginning. Some of this functionality
is already implemented in C (and implemented better), so,
first look at Modules wiki page.

However, seems like forms interface is better to be left as
it is implemented now - it will be too complex, when implemented
in C, to be really convenient and easy to add other form types.
So, I have no plans on converting forms and all functionality,
that depends on it to binary C modules. This includes remote
commands, registration to jabber entities, muc room administration
and some more.

So, first you need mcabber with enabled dynamic module loading.
This shouldn't be a problem, as this is now default. Then you need
to build this module. For that see README in top-level dir.

Then you need to set modules_dir in your mcabberrc to point to
directory, where your modules will reside. Now you can issue
'/module load lua' command and get module working. It will
provide one command - '/lua' (and also some lua functions to allow
lua to manipulate mcabber to some extent), that evaluates specified
lua expression.

Lua module allows to automatically run specified lua file at
module loading. The name of this file is determined from variable
lua_init_filename. To use these example scripts it should point to
your edited version of mcabberrc.lua. Also there are some other
variables, that need to be set up for proper scripts functioning,
you can find these values in lua.rc in this dir. Note, though, that
some scripts are now unused by me and generally are considered only
as example - eg jobs, marking etc. In mcabberrc.lua you should edit
(if necessary) pacakage.path on beginning and set of require'd
scripts in the end. Right now I am using 'transports', 'room_priv',
'forms', 'privacy', 'muc', 'vcard', 'oob', 'register', 'remote' and
'attention' scripts.

Amongst these, 'muc', 'vcard', 'register' and 'remote' depend on
'forms', and thus have no hope to be implemented in C in near future.

Ah, and almost forgot to mention - for some of the scripts you
need some external lua modules. First, it is 'lua-lm' - lua
interface for 'loudmouth'. It is written by me, and thus can be
found in the same place, where you've got a 'lua' mcabber module.
Others are 'posix', 'base64', 'socket', 'sha1' and 'md5'. First three
were until recent time in Debian repository. Latter two are built from
one source at http://www.inf.puc-rio.br/~roberto/md5/md5-5/md5.html.
You can find out, which modules script requires by looking at
'require' lines at the beginning (do not forget to look at scripts,
that are 'require'd by this script).

  -- Myhailo Danylenko <isbear@ukrpost.net>