From 7a4cfc14d1210603fe01073d64cf9683a24ebba5 Mon Sep 17 00:00:00 2001 From: Stefan Kropp Date: Sat, 29 Jan 2022 06:55:00 +0100 Subject: XEP-0107: User Mood - Clean mood * Bugfix in mood_autocomplete (wrong parameter) * Implemented /mood clean ______________________________________ / Profanity! THE XMPP client with mood \ \ support! / -------------------------------------- \ \ .--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/ --- src/xmpp/iq.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/xmpp/iq.c') diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 81eec81e..1cac9096 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -2828,17 +2828,18 @@ publish_user_mood(const char* const mood, const char* const text) xmpp_stanza_add_child(item, mood_t); xmpp_stanza_t* x = xmpp_stanza_new(ctx); - xmpp_stanza_set_name(x, mood); - xmpp_stanza_add_child(mood_t, x); - xmpp_stanza_t* text_t = xmpp_stanza_new(ctx); - xmpp_stanza_set_name(text_t, STANZA_NAME_TEXT); - xmpp_stanza_add_child(mood_t, text_t); - xmpp_stanza_t* t = xmpp_stanza_new(ctx); - xmpp_stanza_set_text(t, text); - xmpp_stanza_add_child(text_t, t); + if (mood) { + xmpp_stanza_set_name(x, mood); + xmpp_stanza_add_child(mood_t, x); + xmpp_stanza_set_name(text_t, STANZA_NAME_TEXT); + xmpp_stanza_add_child(mood_t, text_t); + + xmpp_stanza_set_text(t, text); + xmpp_stanza_add_child(text_t, t); + } iq_send_stanza(iq); xmpp_stanza_release(iq); -- cgit 1.4.1-2-gfad0