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