+static LmHandlerResult
+handle_messages (LmMessageHandler *handler,
+ LmConnection *connection,
+ LmMessage *m,
+ gpointer closure)
+{
+ LmMessageNode *body;
+ const char *peer;
+ const char *body_str;
+
+ peer = lm_message_node_get_attribute (m->node, "from");
+
+
+ g_print ("Incoming message from: %s\n", peer);
+
+ body = lm_message_node_get_child (m->node, "body");
+ if (body) {
+ body_str = lm_message_node_get_value (body);
+
+ if (body_str && body_str[0] == '%')
+ handle_command (connection, peer, body_str + 1, closure);
+ else
+ send_reply (connection, peer, body_str);
+ }
+