Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 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 | 68580b6be895 |
children | 890a703197cf |
comparison
equal
deleted
inserted
replaced
1527:ac87eef9050f | 1528:4b4b3948420c |
---|---|
2592 x = xml_get_xmlns(xmldata, NS_ENCRYPTED); | 2592 x = xml_get_xmlns(xmldata, NS_ENCRYPTED); |
2593 if (x && (p = xmlnode_get_data(x)) != NULL) | 2593 if (x && (p = xmlnode_get_data(x)) != NULL) |
2594 enc = p; | 2594 enc = p; |
2595 | 2595 |
2596 p = xmlnode_get_tag_data(xmldata, "subject"); | 2596 p = xmlnode_get_tag_data(xmldata, "subject"); |
2597 if (p != NULL) { | 2597 |
2598 if (xmlnode_get_tag(xmldata, "subject")) { | |
2598 if (!type || strcmp(type, TMSG_GROUPCHAT)) { // Chat message | 2599 if (!type || strcmp(type, TMSG_GROUPCHAT)) { // Chat message |
2599 subject = p; | 2600 subject = p; |
2600 } else { // Room topic | 2601 } else { // Room topic |
2601 GSList *roombuddy; | 2602 GSList *roombuddy; |
2602 gchar *mbuf; | 2603 gchar *mbuf; |
2603 gchar *subj = p; | 2604 gchar *subj = p; |
2605 | |
2606 // In a groupchat message, the subject can be NULL when | |
2607 // the topic is cleared! | |
2608 if (!p) | |
2609 p = ""; | |
2610 | |
2604 // Get the room (s) and the nickname (r) | 2611 // Get the room (s) and the nickname (r) |
2605 s = g_strdup(from); | 2612 s = g_strdup(from); |
2606 r = strchr(s, JID_RESOURCE_SEPARATOR); | 2613 r = strchr(s, JID_RESOURCE_SEPARATOR); |
2607 if (r) *r++ = 0; | 2614 if (r) *r++ = 0; |
2608 else r = s; | 2615 else r = s; |
2611 if (roombuddy) | 2618 if (roombuddy) |
2612 buddy_settopic(roombuddy->data, subj); | 2619 buddy_settopic(roombuddy->data, subj); |
2613 // Display inside the room window | 2620 // Display inside the room window |
2614 if (r == s) { | 2621 if (r == s) { |
2615 // No specific resource (this is certainly history) | 2622 // No specific resource (this is certainly history) |
2616 mbuf = g_strdup_printf("The topic has been set to: %s", subj); | 2623 if (subj) |
2624 mbuf = g_strdup_printf("The topic has been set to: %s", subj); | |
2625 else | |
2626 mbuf = g_strdup_printf("The topic has been cleared"); | |
2617 } else { | 2627 } else { |
2618 mbuf = g_strdup_printf("%s has set the topic to: %s", r, subj); | 2628 if (subj) |
2629 mbuf = g_strdup_printf("%s has set the topic to: %s", r, subj); | |
2630 else | |
2631 mbuf = g_strdup_printf("%s has cleared the topic", r); | |
2619 } | 2632 } |
2620 scr_WriteIncomingMessage(s, mbuf, 0, | 2633 scr_WriteIncomingMessage(s, mbuf, 0, |
2621 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0); | 2634 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0); |
2622 if (settings_opt_get_int("log_muc_conf")) | 2635 if (settings_opt_get_int("log_muc_conf")) |
2623 hlog_write_message(s, 0, -1, mbuf); | 2636 hlog_write_message(s, 0, -1, mbuf); |