Mercurial > hg
changeset 1528:4b4b3948420c
MUC fix: the topic couldn't be cleared
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 04 Oct 2008 13:03:42 +0200 |
parents | ac87eef9050f |
children | 890a703197cf |
files | mcabber/src/commands.c mcabber/src/jabglue.c |
diffstat | 2 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/commands.c Thu Oct 02 22:05:10 2008 +0200 +++ b/mcabber/src/commands.c Sat Oct 04 13:03:42 2008 +0200 @@ -2584,9 +2584,14 @@ return; } + // If arg is "-", let's clear the topic + if (!strcmp(arg, "-")) + arg = NULL; + arg = to_utf8(arg); // Set the topic - jb_send_msg(buddy_getjid(bud), NULL, ROSTER_TYPE_ROOM, arg, NULL, NULL, NULL); + jb_send_msg(buddy_getjid(bud), NULL, ROSTER_TYPE_ROOM, arg ? arg : "", + NULL, NULL, NULL); g_free(arg); }
--- a/mcabber/src/jabglue.c Thu Oct 02 22:05:10 2008 +0200 +++ b/mcabber/src/jabglue.c Sat Oct 04 13:03:42 2008 +0200 @@ -2594,13 +2594,20 @@ enc = p; p = xmlnode_get_tag_data(xmldata, "subject"); - if (p != NULL) { + + if (xmlnode_get_tag(xmldata, "subject")) { if (!type || strcmp(type, TMSG_GROUPCHAT)) { // Chat message subject = p; } else { // Room topic GSList *roombuddy; gchar *mbuf; gchar *subj = p; + + // In a groupchat message, the subject can be NULL when + // the topic is cleared! + if (!p) + p = ""; + // Get the room (s) and the nickname (r) s = g_strdup(from); r = strchr(s, JID_RESOURCE_SEPARATOR); @@ -2613,9 +2620,15 @@ // Display inside the room window if (r == s) { // No specific resource (this is certainly history) - mbuf = g_strdup_printf("The topic has been set to: %s", subj); + if (subj) + mbuf = g_strdup_printf("The topic has been set to: %s", subj); + else + mbuf = g_strdup_printf("The topic has been cleared"); } else { - mbuf = g_strdup_printf("%s has set the topic to: %s", r, subj); + if (subj) + mbuf = g_strdup_printf("%s has set the topic to: %s", r, subj); + else + mbuf = g_strdup_printf("%s has cleared the topic", r); } scr_WriteIncomingMessage(s, mbuf, 0, HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0);