From bc6f8ceb3aa62c714f09acb7dc1dec30580ab720 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 13 Apr 2014 03:11:46 +0100 Subject: [PATCH] Fixed handling of room subject --- src/xmpp/bookmark.c | 1 - src/xmpp/message.c | 52 +++++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c index 4df3ba9e..2e4f70db 100644 --- a/src/xmpp/bookmark.c +++ b/src/xmpp/bookmark.c @@ -260,7 +260,6 @@ _bookmark_handle_result(xmpp_conn_t * const conn, room_jid = jid_create_from_bare_and_resource(jid, name); if (!muc_room_is_active(room_jid->barejid)) { presence_join_room(jid, name, NULL); - /* TODO: this should be removed after fixing #195 */ handle_bookmark_autojoin(jid); } jid_destroy(room_jid); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 7520aa0a..6da2b367 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -346,37 +346,33 @@ _groupchat_handler(xmpp_conn_t * const conn, char *room_jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); Jid *jid = jid_create(room_jid); - // handle room broadcasts - if (jid->resourcepart == NULL) { - xmpp_stanza_t *subject = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_SUBJECT); - - // handle subject - if (subject != NULL) { - message = xmpp_stanza_get_text(subject); - if (message != NULL) { - handle_room_subject(jid->barejid, message); - xmpp_free(ctx, message); - } - - jid_destroy(jid); - return 1; - - // handle other room broadcasts - } else { - xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY); - if (body != NULL) { - message = xmpp_stanza_get_text(body); - if (message != NULL) { - handle_room_broadcast(room_jid, message); - xmpp_free(ctx, message); - } - } - - jid_destroy(jid); - return 1; + // handle room subject + xmpp_stanza_t *subject = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_SUBJECT); + if (subject != NULL) { + message = xmpp_stanza_get_text(subject); + if (message != NULL) { + handle_room_subject(jid->barejid, message); + xmpp_free(ctx, message); } + + jid_destroy(jid); + return 1; } + // handle room broadcasts + if (jid->resourcepart == NULL) { + xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY); + if (body != NULL) { + message = xmpp_stanza_get_text(body); + if (message != NULL) { + handle_room_broadcast(room_jid, message); + xmpp_free(ctx, message); + } + } + + jid_destroy(jid); + return 1; + } if (!jid_is_valid_room_form(jid)) { log_error("Invalid room JID: %s", jid->str);