Mercurial > hg
changeset 473:c024d1d5d350
Fix segfault when receiving a message stanza with no body tag
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 02 Oct 2005 22:31:36 +0200 |
parents | 75442262c082 |
children | 27efa1e2671a |
files | mcabber/src/jabglue.c |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/jabglue.c Sun Oct 02 18:05:34 2005 +0200 +++ b/mcabber/src/jabglue.c Sun Oct 02 22:31:36 2005 +0200 @@ -834,18 +834,21 @@ char *tmp = NULL; time_t timestamp = 0; - x = xmlnode_get_tag(packet->x, "body"); - p = xmlnode_get_data(x); if (p) body = p; + body = xmlnode_get_tag_data(packet->x, "body"); - if ((x = xmlnode_get_tag(packet->x, "subject")) != NULL) - if ((p = xmlnode_get_data(x)) != NULL) { - tmp = g_new(char, strlen(body)+strlen(p)+4); + p = xmlnode_get_tag_data(packet->x, "subject"); + if (p != NULL) { + if (type && !strcmp(type, "groupchat")) { + // That's a room topic + } else { + tmp = g_new(char, (body ? strlen(body) : 0) + strlen(p) + 4); *tmp = '['; strcpy(tmp+1, p); strcat(tmp, "]\n"); - strcat(tmp, body); + if (body) strcat(tmp, body); body = tmp; } + } /* there can be multiple <x> tags. we're looking for one with xmlns = jabber:x:encrypted */