diff --git a/makefile b/makefile index b8909b3..dad3826 100644 --- a/makefile +++ b/makefile @@ -9,7 +9,7 @@ INSTALLPATH = /usr/local CFLAGS = `pkg-config --cflags glib-2.0` LFLAGS = -lm -lstrophe -lpthread -lssl -lcrypto `pkg-config --libs glib-2.0` -DEBFLAGS = -g -Wall +DEBFLAGS = -g -Wall -DDEBUG OFLAGS = -O2 NAME = xmpp-bot diff --git a/src/core/context.c b/src/core/context.c index fff2e2a..edcb418 100644 --- a/src/core/context.c +++ b/src/core/context.c @@ -11,7 +11,6 @@ #include /* For SHA1 */ #include #include -#include /* debug */ #include "context.h" /* static lifetime but only accessible here and through get and set functions below */ @@ -110,19 +109,19 @@ if(setData) { /* Add with base64 data */ data = xmpp_stanza_new(bctx->ctx); - assert(xmpp_stanza_set_name(data, "data") == 0); - assert(xmpp_stanza_set_ns(data, "urn:xmpp:avatar:data") == 0); - assert(xmpp_stanza_add_child(item, data) == 0); + xmpp_stanza_set_name(data, "data"); + xmpp_stanza_set_ns(data, "urn:xmpp:avatar:data"); + xmpp_stanza_add_child(item, data); /* requires an hidden stanza */ dt = xmpp_stanza_new(bctx->ctx); /* get contents of file */ if(g_file_get_contents(bctx->avatarBase64->str, &avatar, &length, NULL)) { - assert(xmpp_stanza_set_text(dt, avatar) == 0); + xmpp_stanza_set_text(dt, avatar); } else { fprintf(stderr, "Unable to read BASE64-encoded avatar.\n"); } - assert(xmpp_stanza_add_child(data, dt) == 0); + xmpp_stanza_add_child(data, dt); } else { struct stat fileInfo; char * bytes; @@ -178,7 +177,11 @@ xmpp_initialize(); /* create a context */ +#ifdef DEBUG newLog = xmpp_get_default_logger(XMPP_LEVEL_DEBUG); /* pass NULL instead to silence output */ +#else + newLog = xmpp_get_default_logger(XMPP_LEVEL_INFO); /* pass NULL instead to silence output */ +#endif newCtx = xmpp_ctx_new(NULL, newLog); if (!(newLog && newCtx)) {