So you've decided what kind of module you want to write (system or user). You've created a directory for your module in the appropriate location and you've read the Citadel Coding Style document.
If you are writing a user module then feel free to ignore everything in the Citadel Coding Style document. If you are writing a system module you can ignore it too but we'd rather you didn't.
Even if you are writing a user module it is a good idea to follow the Citadel Coding Style document practice as you may like to have your module included at a later date.
Either way there are a few golden rules about writing modules. First I'll start with the absolutely must do things.
- One of your module source files must contain one and only one function called CTDL_MODULE_INIT(module_name), more on this later.
- Each of your module source files must #include “ctdl_module.h”
- At the moment you must edit the Makefile.in to have your module compiled and linked it (More on this in Makefile.in and modules).
Not many of those ehh.
- All of your functions should be named in accordance with the Citadel Coding style for private functions. That is they should be named like save_to_ldap
- None of your functions should be shared to the outside world. So you shouldn't be declaring functions with names like CtdlGetUser
- You should not try to #include any file from the main source directory or from any other module directory.
- You should not attempt to call a function defined in any other module or other module directory.
- You should not try to call a Citadel core function that does not have a name like CtdlAccessCheck (OK, there are lots of exceptions to that one but we are working on it).
- You may call any function documented in the Module API document.