1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Fixe rejoining room after nickname conflict

fixes #241
This commit is contained in:
James Booth 2013-09-22 01:26:40 +01:00
parent d0c8ed462d
commit d70245c887
3 changed files with 14 additions and 5 deletions

View File

@ -145,7 +145,9 @@ muc_join_room(const char * const room, const char * const nick)
void
muc_leave_room(const char * const room)
{
g_hash_table_remove(rooms, room);
if (rooms != NULL) {
g_hash_table_remove(rooms, room);
}
}
/*

View File

@ -196,6 +196,11 @@ prof_handle_error_message(const char *from, const char *err_msg)
} else {
cons_show_error("Error received from server: %s", err_msg);
}
// remove the room from muc
Jid *room_jid = jid_create(from);
muc_leave_room(room_jid->barejid);
jid_destroy(room_jid);
} else {
cons_show_error("Error received from server: %s", err_msg);
}

View File

@ -320,10 +320,12 @@ presence_leave_chat_room(const char * const room_jid)
xmpp_conn_t *conn = connection_get_conn();
char *nick = muc_get_room_nick(room_jid);
xmpp_stanza_t *presence = stanza_create_room_leave_presence(ctx, room_jid,
nick);
xmpp_send(conn, presence);
xmpp_stanza_release(presence);
if (nick != NULL) {
xmpp_stanza_t *presence = stanza_create_room_leave_presence(ctx, room_jid,
nick);
xmpp_send(conn, presence);
xmpp_stanza_release(presence);
}
}
static int