diff --git a/src/bot/handlers.c b/src/bot/handlers.c index 47a2f22..cababad 100644 --- a/src/bot/handlers.c +++ b/src/bot/handlers.c @@ -62,11 +62,6 @@ printf("Incoming message from %s: %s\n", xmpp_stanza_get_attribute(stanza, "from"), intext->str); /* parse with yyparse() */ - if(grammar_parse_string(intext) == 0) { - printf("===== Parse OK!\n"); - } else { - fprintf(stderr, "===== Parse error\n"); - } reply = xmpp_stanza_new(ctx); xmpp_stanza_set_name(reply, "message"); @@ -76,9 +71,12 @@ body = xmpp_stanza_new(ctx); xmpp_stanza_set_name(body, "body"); - replytext = g_string_new(" to you too!"); - strcpy(replytext->str, intext->str); - strcat(replytext->str, " to you too!"); + replytext = g_string_copy(intext); + if(grammar_parse_string(intext) == 0) { + g_string_append(replytext, " -> Parse OK!\n"); + } else { + g_string_append(replytext, " -> Parse ERROR :(\n"); + } text = xmpp_stanza_new(ctx); xmpp_stanza_set_text(text, replytext->str);