Chat room windows now created only after successful join

This commit is contained in:
James Booth
2014-04-21 00:37:04 +01:00
parent 9a55d8ad19
commit 2c15aba92a
17 changed files with 89 additions and 102 deletions

View File

@@ -36,23 +36,22 @@
#include "ui/ui.h"
void
handle_room_join_error(const char * const room, const char * const err)
{
if (muc_room_is_active(room)) {
muc_leave_room(room);
}
ui_handle_room_join_error(room, err);
}
// handle presence stanza errors
void
handle_presence_error(const char *from, const char * const type,
const char *err_msg)
{
// handle nickname conflict on entering room
if ((from != NULL) && g_strcmp0(err_msg, "conflict") == 0) {
// remove the room from muc
Jid *room_jid = jid_create(from);
if (!muc_get_roster_received(room_jid->barejid)) {
muc_leave_room(room_jid->barejid);
ui_handle_recipient_error(room_jid->barejid, err_msg);
}
jid_destroy(room_jid);
// handle any other error from recipient
} else if (from != NULL) {
// handle error from recipient
if (from != NULL) {
ui_handle_recipient_error(from, err_msg);
// handle errors from no recipient
@@ -404,6 +403,12 @@ handle_room_nick_change(const char * const room,
void
handle_room_roster_complete(const char * const room)
{
if (muc_room_is_autojoin(room)) {
ui_room_join(room, FALSE);
} else {
ui_room_join(room, TRUE);
}
muc_remove_invite(room);
muc_set_roster_received(room);
GList *roster = muc_get_roster(room);
ui_room_roster(room, roster, NULL);
@@ -499,13 +504,6 @@ handle_autoping_cancel(void)
ui_current_page_off();
}
void
handle_bookmark_autojoin(char *jid)
{
ui_room_join(jid, FALSE);
muc_remove_invite(jid);
}
void
handle_xmpp_stanza(const char * const msg)
{