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,37 +346,33 @@ _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); if (subject != NULL) {
message = xmpp_stanza_get_text(subject);
// handle subject if (message != NULL) {
if (subject != NULL) { handle_room_subject(jid->barejid, message);
message = xmpp_stanza_get_text(subject); xmpp_free(ctx, message);
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;
} }
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)) { if (!jid_is_valid_room_form(jid)) {
log_error("Invalid room JID: %s", jid->str); log_error("Invalid room JID: %s", jid->str);