Developing Prosody modules
Creating modules for Prosody is a piece of cake.
If you are new to Lua then take a look at the online Programming in Lua book for an introduction to the language, and the Lua manual for later reference. If you are already familiar with programming then Lua will hardly need learning at all.
A module consists of a single Lua script, which will get loaded by the server whenever necessary. When loaded into the server, there will be available a global object 'module' through which you can interact with the module manager and the rest of the server.
The methods of the module API object are described on this page.
Reference
module:log(level, message, ...)
Logs the specified message at the specified level. message may contain format specifiers, like printf and string.format.
module:get_host()
Returns the host that the current module is loaded for, or “*” if it is a global module (not associated with a particular host).
module:set_global()
Sets the current module as a 'global' module, that is one which is not associated with a particular host and may only be loaded once per running server.
module:hook(event, callback, priority)
Calls the specified callback when the specified event occurs. The optional priority allows order to be given in which callbacks are called. Higher priority callbacks are called before lower priority callbacks.
