1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Fixed handling of room subject

This commit is contained in:
James Booth 2014-04-13 03:11:46 +01:00
parent 99592e2779
commit bc6f8ceb3a
2 changed files with 24 additions and 29 deletions

View File

@ -260,7 +260,6 @@ _bookmark_handle_result(xmpp_conn_t * const conn,
room_jid = jid_create_from_bare_and_resource(jid, name); room_jid = jid_create_from_bare_and_resource(jid, name);
if (!muc_room_is_active(room_jid->barejid)) { if (!muc_room_is_active(room_jid->barejid)) {
presence_join_room(jid, name, NULL); presence_join_room(jid, name, NULL);
/* TODO: this should be removed after fixing #195 */
handle_bookmark_autojoin(jid); handle_bookmark_autojoin(jid);
} }
jid_destroy(room_jid); jid_destroy(room_jid);

View File

@ -346,11 +346,8 @@ _groupchat_handler(xmpp_conn_t * const conn,
char *room_jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *room_jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
Jid *jid = jid_create(room_jid); Jid *jid = jid_create(room_jid);
// handle room broadcasts // handle room subject
if (jid->resourcepart == NULL) {
xmpp_stanza_t *subject = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_SUBJECT); xmpp_stanza_t *subject = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_SUBJECT);
// handle subject
if (subject != NULL) { if (subject != NULL) {
message = xmpp_stanza_get_text(subject); message = xmpp_stanza_get_text(subject);
if (message != NULL) { if (message != NULL) {
@ -360,9 +357,10 @@ _groupchat_handler(xmpp_conn_t * const conn,
jid_destroy(jid); jid_destroy(jid);
return 1; return 1;
}
// handle other room broadcasts // handle room broadcasts
} else { if (jid->resourcepart == NULL) {
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY); xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY);
if (body != NULL) { if (body != NULL) {
message = xmpp_stanza_get_text(body); message = xmpp_stanza_get_text(body);
@ -375,8 +373,6 @@ _groupchat_handler(xmpp_conn_t * const conn,
jid_destroy(jid); jid_destroy(jid);
return 1; return 1;
} }
}
if (!jid_is_valid_room_form(jid)) { if (!jid_is_valid_room_form(jid)) {
log_error("Invalid room JID: %s", jid->str); log_error("Invalid room JID: %s", jid->str);