diff options
author | xengineering <me@xengineering.eu> | 2022-08-19 10:51:24 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-08-19 12:13:49 +0200 |
commit | 43aa02ccbd484d8c7cecec7c38c446847b34e007 (patch) | |
tree | 5e34779ee75c8788760d74a9f73a01575c335f54 /limox.c | |
parent | 4c848f4085cd174d1ad54169632a95023774717b (diff) | |
download | limox-43aa02ccbd484d8c7cecec7c38c446847b34e007.tar limox-43aa02ccbd484d8c7cecec7c38c446847b34e007.tar.zst limox-43aa02ccbd484d8c7cecec7c38c446847b34e007.zip |
Implement new datastructures
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; |