examples/README
author Myhailo Danylenko <isbear@ukrpost.net>
Wed, 31 Mar 2010 01:25:19 +0300
changeset 99 ed4676536ed9
parent 86 9b98ea6c73f6
child 121 75a7d595817c
permissions -rw-r--r--
Update most useful scripts * new hooks interface * connection state checking


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, that will provide common hook and help
infrastructure. For 'require' to find scripts, you need to
properly set package.path, and in mcabberrc.lua there is
example of this on 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 to get development version of mcabber, compiled
with --modules-enable. 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
'/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 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. 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. Rigth 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 to loudmouth. It is written by me, and thus can be
fond at the same place, where you find 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 require your scripts 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>