Added presence_error tests, added muc_close()

This commit is contained in:
James Booth
2014-01-30 23:15:39 +00:00
parent 12666b41e6
commit 0338d136e0
9 changed files with 139 additions and 23 deletions

View File

@@ -54,6 +54,16 @@ muc_init(void)
invite_ac = autocomplete_new();
}
void
muc_close(void)
{
autocomplete_free(invite_ac);
if (rooms != NULL) {
g_hash_table_destroy(rooms);
rooms = NULL;
}
}
void
muc_add_invite(char *room)
{

View File

@@ -30,6 +30,7 @@
#include "tools/autocomplete.h"
void muc_init(void);
void muc_close(void);
void muc_join_room(const char * const room, const char * const nick);
void muc_leave_room(const char * const room);
gboolean muc_room_is_active(Jid *jid);

View File

@@ -318,6 +318,7 @@ _shutdown(void)
jabber_disconnect();
jabber_shutdown();
roster_free();
muc_close();
caps_close();
ui_close();
chat_log_close();

View File

@@ -43,7 +43,7 @@ handle_presence_error(const char *from, const char * const type,
const char *err_msg)
{
// handle nickname conflict on entering room
if (g_strcmp0(err_msg, "conflict") == 0) {
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)) {
@@ -67,20 +67,20 @@ void
handle_message_error(const char * const from, const char * const type,
const char * const err_msg)
{
// handle errors from no recipient
if (from == NULL) {
ui_handle_error(err_msg);
// handle recipient not found ('from' contains a value and type is 'cancel')
if ((from != NULL) && ((type != NULL && (strcmp(type, "cancel") == 0)))) {
} else if (type != NULL && (strcmp(type, "cancel") == 0)) {
ui_handle_recipient_not_found(from, err_msg);
if (prefs_get_boolean(PREF_STATES) && chat_session_exists(from)) {
chat_session_set_recipient_supports(from, FALSE);
}
// handle any other error from recipient
} else if (from != NULL) {
ui_handle_recipient_error(from, err_msg);
// handle errors from no recipient
} else {
ui_handle_error(err_msg);
ui_handle_recipient_error(from, err_msg);
}
}