diff options
author | xengineering <me@xengineering.eu> | 2022-08-16 08:11:38 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-08-16 08:11:38 +0200 |
commit | 8fca7d6ea2d7e191d8b4201e3490bfd001813461 (patch) | |
tree | 99a03cc4b34558ae6cf88053b6f3fbc20eb22840 | |
parent | 21a2b2033485c106a537e5e2302f4e4d96a66b94 (diff) | |
download | limox-8fca7d6ea2d7e191d8b4201e3490bfd001813461.tar limox-8fca7d6ea2d7e191d8b4201e3490bfd001813461.tar.zst limox-8fca7d6ea2d7e191d8b4201e3490bfd001813461.zip |
Handle every xmpp_conn_event_t with debug message
-rw-r--r-- | limox.c | 40 |
1 files changed, 28 insertions, 12 deletions
@@ -37,18 +37,34 @@ static xmpp_sm_state_t* sm_state; static void conn_handler(xmpp_conn_t *conn, xmpp_conn_event_t status,int error, xmpp_stream_error_t *stream_error, void *userdata) { - if (status == XMPP_CONN_CONNECT) { - printf("DEBUG: connected\n"); - - // send initial presence - xmpp_stanza_t* presence; - presence = xmpp_presence_new(ctx); - xmpp_send(conn, presence); - xmpp_stanza_release(presence); - } else if (status == XMPP_CONN_DISCONNECT) { - printf("got XMPP_CONN_DISCONNECT\n"); - } else { - printf("Unhandled connection event!\n"); + switch (status) { + + case XMPP_CONN_CONNECT: + printf("DEBUG: Got XMPP_CONN_CONNECT\n"); + + // send initial presence + xmpp_stanza_t* presence; + presence = xmpp_presence_new(ctx); + xmpp_send(conn, presence); + xmpp_stanza_release(presence); + + break; + + case XMPP_CONN_RAW_CONNECT: + printf("DEBUG: Got XMPP_CONN_RAW_CONNECT\n"); + break; + + case XMPP_CONN_DISCONNECT: + printf("DEBUG: Got XMPP_CONN_DISCONNECT\n"); + break; + + case XMPP_CONN_FAIL: + printf("DEBUG: Got XMPP_CONN_FAIL\n"); + break; + + default: + printf("DEBUG: Got unknown connection status '%d'!\n", status); + exit(1); } } |