about summary refs log tree commit diff stats
path: root/src/xmpp/iq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp/iq.c')
-rw-r--r--src/xmpp/iq.c17
1 files changed, 9 insertions, 8 deletions
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);