diff options
Diffstat (limited to 'limox.c')
-rw-r--r-- | limox.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -40,19 +40,16 @@ static xmpp_sm_state_t* sm_state; static int message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata) { - // local variables - xmpp_stanza_t* body; - const char* content; - - body = xmpp_stanza_get_child_by_name(stanza, "body"); + xmpp_stanza_t* body = xmpp_stanza_get_child_by_name(stanza, "body"); if (body == NULL) { printf("DEBUG: Got message stanza of type char without body!\n"); return 1; } - content = xmpp_stanza_get_text(body); + const char* content = xmpp_stanza_get_text(body); + const char* sender = xmpp_stanza_get_from(stanza); - gui_add_message(xmpp_stanza_get_from(stanza), content); + data_add_incoming_message(sender, content); return 1; } @@ -60,16 +57,14 @@ static int message_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, static int roster_handler(xmpp_conn_t *conn, xmpp_stanza_t *stanza, void *userdata) { - printf("DEBUG: Received roster.\n"); - // iterate over roster result xmpp_stanza_t* query = xmpp_stanza_get_child_by_name(stanza, "query"); for (xmpp_stanza_t* item = xmpp_stanza_get_children(query); item; item = xmpp_stanza_get_next(item)) { - add_roster_item(xmpp_stanza_get_attribute(item, "jid"), - xmpp_stanza_get_attribute(item, "subscription"), - xmpp_stanza_get_attribute(item, "name")); + data_add_roster_item(xmpp_stanza_get_attribute(item, "jid"), + xmpp_stanza_get_attribute(item, "subscription"), + xmpp_stanza_get_attribute(item, "name")); } return 1; |