Modules is a way to extend functionality of alicq.

Every module is a Tcl script, executing in it's own namespace. 
Module can interact with alicq itself, icq library and other modules, using 
two mechanism:
 - hooks;
 - global valiables.

1. Hooks

Hook is a command which is invoked if certain event occurs. If module needs
to handle some event, it should register handler by comand 'Hook'. Hook
takes two arguments: name of event and handler command, e.g:
		Hook IncomingMessage mymodule::MyMessageHandler
		
In this case MyMessageHandler will be invoked on every incoming message, and
arguments, specific to this event will be passed to handler (Events and
their specific parameters are described below).

Module can also provide own events for other modules. Using command 'RunHooks'
allow invoke all handlers for specified event and pass them required
parameters. 'RunHooks' has form:
		RunHooks <event name> [<parameter1> [... parameterN]]
where parameter1, parameterN - agruments, specific for given event.

2. Global variables

There is a small set of global variables (defined in alicq.tcl) which can be
accessed from modules. They are:

 - ::Contacts (contains information about all contatcs)
 - ::Groups (contains information about groups)
 - ::encoding (specifies encoding for outgoing messages)

Module can trace reading/writing of these variables, using tcl command 'trace',
e.g.:
	trace variable ::Contacts w base::ContactChanged

When ::Contacts is changed, command 'base::ContactChanged' will be invoked.

3. Namespaces

Each module is executed in its own namespace. Namespace name is conctructed
from the name of module by cutting directory name and extension, e.g. if module
names is './GUI/colorer.tcl', it's namespace is 'colorer'.

When you specifying command which will be invoked on event (e.g. in trace, bind or Hook), you should give full command name, including namespace name.

4. Events

Here is description of existing events and their parameters. Note, that new
parameters may be added to some events later, so use 'args' in a event handler
to store unneeded arguments.

4.1 Icq library

Error					<error code>  <error string>
MyStatus 				<status>
ContactStatus 			<UIN> <status>
IncomingMessage 		<UIN> <time> <message>
IncomingURL				<UIN> <time> <url(list of description and URL itself)>
AuthorizationRequest	<UIN> <info(list of pairs 'key-value')>
AuthorizationResponse	<UIN>
Contacts				<UIN> <amount> <contact1> [...<contatctN>]
ContactInfo				<Reference> <info>
OutgoingMessage			<UIN> <time> <message>
OutgoingURL				<UIN> <time> <url(see IncomingURL)>

4.2 Module 'base'

InitDisplayFilter		<text widget>
	Called when new message or history window created
DisplayFilter			<text widget> <index1> <index2>
	Called when new text is written to text widget. <inex1> and <index2> specify
	position of new text in the widget.

5. Icq library interface

Here described functions of icq library which can be called from within modules:
icq::SendMessage 		<UIN> <Message>
icq::SendURL	 		<UIN> <Url> <Description>
icq::SendSMS	 		<Number> <message> [<Reference>]
icq::Authorize	 		<UIN>
icq::SetStatus	 		<status>
icq::ShortInfoRequest	<UIN> <Reference>
icq::FullInfoRequest	<UIN> <Reference>

<Reference> is a number in a range 0..255 used to distinguish different
requests.

TODO:
6. Configuration file parameters

