summaryrefslogtreecommitdiff
path: root/limox.c
diff options
context:
space:
mode:
Diffstat (limited to 'limox.c')
-rw-r--r--limox.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/limox.c b/limox.c
index 618c2ef..b0e74dd 100644
--- a/limox.c
+++ b/limox.c
@@ -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);
}
}