about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-07-03 15:16:19 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-07-03 15:16:19 +0200
commit19902e8e217ef3a3646fc852cce8133fc0275059 (patch)
treed21246467c3c4c5c18dd72b7d075344e3a221877
parentad9263520e8c3c151d48ba579bece5f705c2131e (diff)
downloadprofani-tty-19902e8e217ef3a3646fc852cce8133fc0275059.tar.gz
Set plain message in _private_chat_handler
In case that plain is NULL we need to copy over from body.

Fix https://github.com/profanity-im/profanity/issues/1144
-rw-r--r--src/xmpp/message.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 09863b63..e795953b 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -922,6 +922,13 @@ _private_chat_handler(xmpp_stanza_t *const stanza)
     }
 #endif
 
+    if (!message->plain && !message->body) {
+        log_error("Message received without body from: %s", jid->str);
+        goto out;
+    } else if (!message->plain) {
+        message->plain = strdup(message->body);
+    }
+
     message->timestamp = stanza_get_delay(stanza);
     message->body = xmpp_message_get_body(stanza);