Next: Service routines
Up: Server
Previous: Connection control
  Contents
The handlers are functions that are responsible for specific
operations in the application. A handler could be invoked as
a result of an event in the ICQ network or as a result of a
user request. The handlers are implemented in the files:
The description above gives a very intuitive separation of
handlers into two basic groups:
- ICQ handlers
- are handlers (also referred to as
``callbacks'') invoked by events in the ICQ network. In
fact, they are being called by the icq_Main()
function. Please refer to the icqlib manual for more
information on callbacks.
The convention in the code is to name these handlers
icq_handle_ where is the event to be
handled.
The callbacks implemented in the current version of csicq
are:
- icq_handle_logged_in which handles
connection establishment messages from the ICQ network,
informing the client that they are connected to the network
and initializing the contact list.
- icq_handle_not_logged_in which handles
messages from the ICQ network notifying that we could not
login to the network, notifying the user that the attempt
was unsuccessful.
- icq_handle_disconnect which handles
messages from the ICQ network notifying that we have been
disconnected from the network, notifying the user of that
and trying to reconnect.
- icq_handle_recv_message which handles the
event of a new message received by the user. The handler
composes a message to the user using our protocol and sends
if over the TCP connection, notifying the user of the
incoming message.
- icq_handle_update_status handles the event
of a change in status of one of the user's contacts. The handler
composes a message to the user using our protocol and sends
if over the TCP connection, notifying the user of the
change in status.
- icq_handle_user_online handles the event
of a contact coming online. Similar to
icq_handle_update_status.
- icq_handle_user_offline handles the event
of a contact going offline. Similar to
icq_handle_update_status.
- icq_handle_arv_ack handles the event
of receiving server ack message. This handler is not used by
the current version of csicq and used for testing purposes
only.
- User handlers
- are invoked as a response to an event
on the user connection. The user sends a message using our
protocol, it is being received and then interpreted by the
handle_message function (which is not really a
handler but rather a dispatcher of messages to
handlers). The function determines according to the message
type which user handler should be invoked and activates
it. The naming convention for these handlers is
handle_ where is the event to be handled.
The handlers implemented in the current version of csicq
are:
- handle_login_req handles a login request
fro mthe user. It initializes the ICQLINK of the
connection and attempts to connect to the ICQ network.
- handle_disconnect handles a disconnection
request from the user. Namely it ends the session.
- handle_send_msg handles a request by the
user to send a message. The handler calls the appropriate
icqlib function to forward the message to the ICQ network.
- handle_add_usr handles a user request to
add some contact to their contact list. The handler adds the
new contact to the list of contacts and notifies the ICQ
network of the addition.
- handle_del_usr handles a user request to
remove a contact from their contact list. The handler
removes the contact from the contact list.
Next: Service routines
Up: Server
Previous: Connection control
  Contents
Zvika Brakerski
2001-05-09