This file will help you if you are interested in contributing to this project.

Modules
-------
See modules.dia for a map of the modules. Arrows in it mean "who knows who".

main:         It has the main() function.
user_iface:   The ncurses user interface.
contact_list: Manages the list of contacts.
uconfig:      Manages the program configuration.
parse:        Parses lines written by the user.
protocol:     Understands and generates messages sent over the network.
transport:    Implements the server, and transports messages.
tls:          Encryption and authentication code.
tcp:          Wrapper to simplify the use of TCP sockets.
demux:        I/O demultiplexer, timer and secure signal handler.
misc:         Miscellaneous functions.

In this program, a message is composed by a header (struct msg_header in
protocol.c), and a payload (it's meaning depends on the type of message).
For example, in messages of type TEXT, the payload contains the text
written by the user. Only the protocol module knows the format of
these messages, and only the transport module knows how to send and
receive them (it uses the tcp module).

The user interface is divided in four modules, but only user_iface is
used by the rest of modules, and the other three are used by user_iface.
They are: ui_output, which solves painting issues; ui_input, which handles
user input; and ui_format, which takes care of text formatting and alignment.

If you understand spanish, look at the file SECUENCIAS, which is a good
reference of the flow of execution of the program. I'll try to translate
it in the future. Note it's a bit outdated.

The most obscure part could seem to be 'demux', but a quick look at demux.h
will show you how easy to use it is.

Coding conventions
------------------
We use 8 spaces tabulator for indentation. Try to stick to 80 columns.

The .c files have this structure:

	1. File description and copyright.
	2. Includes.
	3. Defines.
	4. Extern variables.
	5. Static variables.
	6. Prototypes of static functions.
	7. Extern functions.
	8. Static functions.

This example shows most of our coding conventions:

/* This is the description of
   this nice function. */
int
some_function (int a, char b)
{
	int this_is_a_variable;

	some_other_function (a, b);
	while (foo) {
		bar();
	}
}

This is the "official" indent line (not definitive):
indent -bbo -br -brs -cd41 -di8 -i8 -nbfda -nce -ncs -nsc

Try to keep function descriptions in .h and .c syncronised.

Functions whose name begins with "cb_" are callback functions.

Functions normally return 0 if everything is OK. Some may also return a
positive value indicating, for example, number of bytes sent. Functions
return a negative value if something goes wrong. Defines exist for these
values, in common.h (ERR_*).
