diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-09-04 10:27:03 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2019-09-04 10:27:03 +0200 |
commit | 09c5f38f1154825cf51a5f48f4de02f0d22a3f5f (patch) | |
tree | 54373d346a129a29c3f31c7c33042fcc8eaf0053 /src/xmpp | |
parent | f9addf4f53453f8c51401bc7171972dc829cee8f (diff) | |
download | profani-tty-09c5f38f1154825cf51a5f48f4de02f0d22a3f5f.tar.gz |
Set message->plain in carbon case
message->plain should always contain something. In the case of the carbons we forgot to set if rom the body in case it's empy.
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/message.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 033a7a11..8a711e90 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -1008,6 +1008,13 @@ _handle_carbons(xmpp_stanza_t *const stanza) Jid *jid_from = jid_create(from); Jid *jid_to = jid_create(to); + if (!message->plain && !message->body) { + log_error("Message received without body from: %s", jid_from->fulljid); + goto out; + } else if (!message->plain) { + message->plain = strdup(message->body); + } + // check for pgp encrypted message xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(message_stanza, STANZA_NS_ENCRYPTED); if (x) { @@ -1029,9 +1036,9 @@ _handle_carbons(xmpp_stanza_t *const stanza) } } +out: message_free(message); jid_destroy(my_jid); - return TRUE; } |