| Top |
| LmHandlerResult | (*LmHandleMessageFunction) () |
| LmMessageHandler * | lm_message_handler_new () |
| void | lm_message_handler_invalidate () |
| gboolean | lm_message_handler_is_valid () |
| LmMessageHandler * | lm_message_handler_ref () |
| void | lm_message_handler_unref () |
A handler can be registered to listen to incoming messages with lm_connection_register_message_handler(). When a message is recieved the handlers of the correct type will be called.
LmHandlerResult (*LmHandleMessageFunction) (LmMessageHandler *handler,LmConnection *connection,LmMessage *message,gpointer user_data);
The actual callback function in an LmMessageHandler. This function is called when an incoming message arrives that haven't been handled by an handler with higher priority.
handler |
||
connection |
an LmConnection |
|
message |
an LmMessage |
|
user_data |
user data set when creating the handler |
LM_HANDLER_RESULT_REMOVE_MESSAGE to indicate that message has been handled, otherwise LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS.
LmMessageHandler * lm_message_handler_new (LmHandleMessageFunction function,gpointer user_data,GDestroyNotify notify);
Creates a new message handler. This can be set to handle incoming messages
and when a message of the type the handler is registered to handle is
received function
will be called and user_data
will be passed to it.
notify
is called when the message handler is freed, that way any memory
allocated by user_data
can be freed.
void
lm_message_handler_invalidate (LmMessageHandler *handler);
Invalidates the handler. Useful if you need to cancel a reply
gboolean
lm_message_handler_is_valid (LmMessageHandler *handler);
Fetches whether the handler is valid or not.
LmMessageHandler *
lm_message_handler_ref (LmMessageHandler *handler);
Adds a reference to handler
.
void
lm_message_handler_unref (LmMessageHandler *handler);
Removes a reference from handler
. When no more references are present the
handler is freed.