Ok, this may look as a bad joke ;-). Though, I'll try to place here some usefull informations.
The core of server contains only necessary stuff (event loop, API for creating new things), so it is quite small. New things (commands, areas) are implemented through the modules, which can be loaded/unloaded at runtime. It means, if the area isn't used for some period of time, its module is unloaded and system resources freed.
Creating new module (hello world example)
The common way how to create new module is to copy module's templates (src/templates/module) at new place (src/modules/hello) and modify it:
- Rename skeleton.* to hello.*.
- Rename cmdskeleton.* to cmdhello.*.
- Modify Makefile to reflect changes (replace skeleton by hello).
- Modify hello.* and cmdhello.* - replace skeleton with hello and remove Nepos' comments.
- Insert from->writeMessage("Hello world.\r\n") in cmdHello::exec(). It sends a message to caller when the command is executed.
Now compile the module and add it to the module's file (modules/modules.dep). Start the server, log in and try, what happens, if you execute hello commnd.
File with module dependencies
It is located in directory with modules' binaries (modules/modules.dep). Its format is as follows:
First line is standard XML declaration, nothing unusual. Name of the document's root element is modules. It contains module elements, which defines list of available modules. Each module element must have correctly set name attribute and optionally directory and load attributes. The directory attribute changes module's location. If the load attribute is set to no, the module won't be loaded (because of security, or because it isn't needed). Each module element can contain depend elements to define it's dependencies. The module will be loaded after all it's dependencies.
The modules.dep file can look like this one:
<?xml version="1.0" encoding="iso-8859-1"?> <modules> <module name="hello"> </module> <module name="bad" load="no"> <depend>hello</depend> </module> </modules>