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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     1
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
     2
# How to use these scrpits (and how they are organized):
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     3
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     4
Scripts are generally separated into two classes - library
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     5
(those in lm subdirectory), that deal mainly with lm and xmpp
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     6
stuff, and mcabber, that provide mcabber interface for library
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     7
scripts - mcabber commands, mcabber message handlers, etc.
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     8
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     9
Most of mcabber scripts expect to be require'd from
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    10
mcabberrc.lua. For 'require' to find scripts, you need to
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    11
properly set package.path, and in mcabberrc.lua there is
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    12
example of this at the beginning. Some of this functionality
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    13
is already implemented in C (and implemented better), so,
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    14
first look at Modules wiki page.
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    15
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    16
However, seems like forms interface is better to be left as
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    17
it is implemented now - it will be too complex, when implemented
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    18
in C, to be really convenient and easy to add other form types.
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    19
So, I have no plans on converting forms and all functionality,
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    20
that depends on it to binary C modules. This includes remote
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    21
commands, registration to jabber entities, muc room administration
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    22
and some more.
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    23
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    24
So, first you need mcabber with enabled dynamic module loading.
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    25
This shouldn't be a problem, as this is now default. Then you need
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    26
to build this module. For that see README in top-level dir.
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    27
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    28
Then you need to set modules_dir in your mcabberrc to point to
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    29
directory, where your modules will reside. Now you can issue
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    30
'/module load lua' command and get module working. It will
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    31
provide one command - '/lua' (and also some lua functions to allow
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    32
lua to manipulate mcabber to some extent), that evaluates specified
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    33
lua expression.
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    34
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    35
Lua module allows to automatically run specified lua file at
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    36
module loading. The name of this file is determined from variable
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    37
lua_init_filename. To use these example scripts it should point to
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    38
your edited version of mcabberrc.lua. Also there are some other
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    39
variables, that need to be set up for proper scripts functioning,
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    40
you can find these values in lua.rc in this dir. Note, though, that
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    41
some scripts are now unused by me and generally are considered only
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    42
as example - eg jobs, marking etc. In mcabberrc.lua you should edit
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    43
(if necessary) pacakage.path on beginning and set of require'd
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    44
scripts in the end. Right now I am using 'transports', 'room_priv',
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    45
'forms', 'privacy', 'muc', 'vcard', 'oob', 'register', 'remote' and
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    46
'attention' scripts.
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    47
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    48
Amongst these, 'muc', 'vcard', 'register' and 'remote' depend on
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    49
'forms', and thus have no hope to be implemented in C in near future.
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    50
86
9b98ea6c73f6 Note about external modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 85
diff changeset
    51
Ah, and almost forgot to mention - for some of the scripts you
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    52
need some external lua modules. First, it is 'lua-lm' - lua
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    53
interface for 'loudmouth'. It is written by me, and thus can be
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    54
found in the same place, where you've got a 'lua' mcabber module.
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    55
Others are 'posix', 'base64', 'socket', 'sha1' and 'md5'. First three
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    56
were until recent time in Debian repository. Latter two are built from
86
9b98ea6c73f6 Note about external modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 85
diff changeset
    57
one source at http://www.inf.puc-rio.br/~roberto/md5/md5-5/md5.html.
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    58
You can find out, which modules script requires by looking at
86
9b98ea6c73f6 Note about external modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 85
diff changeset
    59
'require' lines at the beginning (do not forget to look at scripts,
121
75a7d595817c Put help into separate files
Myhailo Danylenko <isbear@ukrpost.net>
parents: 86
diff changeset
    60
that are 'require'd by this script).
86
9b98ea6c73f6 Note about external modules
Myhailo Danylenko <isbear@ukrpost.net>
parents: 85
diff changeset
    61
85
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    62
  -- Myhailo Danylenko <isbear@ukrpost.net>
1e5f17c25133 Examples readme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    63