ICQ steps using libicq:

Startup steps

Callbacks

EVENT_LOGIN

When libicq receives an ack packet from the server re: login, it finishes the login sequence, sends our contact list to the server, and sets the user's status to Current_Status. This callback function is then called.

All this function needs to do is set a local variable that you are now online, etc. No processing is required.

EVENT_DISCONNECT

This function doesn't seem to be called by libicq at this time.

EVENT_MESSAGE

Gets called when a message arrives with a data parameter that is a struct of type CLIENT_MSG_PTR (see libicq.h). This includes all messages; URLs, files, away messages, etc.

EVENT_ONLINE

EVENT_OFFLINE

EVENT_STATUS_UPDATE

These callbacks are called whenever information on a user on our contact list changes. They are called with data of type USER_UPDATE_PTR. You can use one function to handle all of them if you wish.

EVENT_SEARCH_RESULTS

This function is called with data in the struct format SEARCH_RESULTS_PTR when the search results are returned from the server.

EVENT_INFO

A USER_INFO_PTR data structure is sent to this function as a response to a request for information re: a user on your contact list or otherwise.

EVENT_EXT_INFO

A USER_EXT_INFO_PTR data structure is sent to this function as a response to a request for full information about a user.

Logging in

You may wish to keep a global variable (or static in a function) that keeps track of the user's online-ness. Set this variable to a value indicating that you are connecting, then create the timed functions. Call ICQ_Change_Status(STATUS_ONLINE) to send the connecting signal to the server. Events: now loop! During loop: