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

Merge branch 'master' into otr

This commit is contained in:
James Booth 2013-09-22 01:28:26 +01:00
commit df63d37a3e
5 changed files with 15 additions and 7 deletions

View File

@ -145,7 +145,9 @@ muc_join_room(const char * const room, const char * const nick)
void void
muc_leave_room(const char * const room) 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 { } else {
cons_show_error("Error received from server: %s", err_msg); 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 { } else {
cons_show_error("Error received from server: %s", err_msg); cons_show_error("Error received from server: %s", err_msg);
} }

View File

@ -484,6 +484,7 @@ _connection_handler(xmpp_conn_t * const conn,
chat_sessions_init(); chat_sessions_init();
xmpp_handler_add(conn, connection_error_handler, NULL, NULL, STANZA_TYPE_ERROR, ctx);
roster_add_handlers(); roster_add_handlers();
message_add_handlers(); message_add_handlers();
presence_add_handlers(); presence_add_handlers();

View File

@ -51,7 +51,6 @@ message_add_handlers(void)
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
HANDLE(NULL, STANZA_TYPE_ERROR, connection_error_handler);
HANDLE(NULL, STANZA_TYPE_GROUPCHAT, _groupchat_message_handler); HANDLE(NULL, STANZA_TYPE_GROUPCHAT, _groupchat_message_handler);
HANDLE(NULL, STANZA_TYPE_CHAT, _chat_message_handler); HANDLE(NULL, STANZA_TYPE_CHAT, _chat_message_handler);
HANDLE(NULL, NULL, _conference_message_handler); HANDLE(NULL, NULL, _conference_message_handler);

View File

@ -72,7 +72,6 @@ presence_add_handlers(void)
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
HANDLE(NULL, STANZA_TYPE_ERROR, connection_error_handler);
HANDLE(STANZA_NS_MUC_USER, NULL, _room_presence_handler); HANDLE(STANZA_NS_MUC_USER, NULL, _room_presence_handler);
HANDLE(NULL, STANZA_TYPE_UNAVAILABLE, _unavailable_handler); HANDLE(NULL, STANZA_TYPE_UNAVAILABLE, _unavailable_handler);
HANDLE(NULL, STANZA_TYPE_SUBSCRIBE, _subscribe_handler); HANDLE(NULL, STANZA_TYPE_SUBSCRIBE, _subscribe_handler);
@ -321,10 +320,12 @@ presence_leave_chat_room(const char * const room_jid)
xmpp_conn_t *conn = connection_get_conn(); xmpp_conn_t *conn = connection_get_conn();
char *nick = muc_get_room_nick(room_jid); char *nick = muc_get_room_nick(room_jid);
xmpp_stanza_t *presence = stanza_create_room_leave_presence(ctx, room_jid, if (nick != NULL) {
nick); xmpp_stanza_t *presence = stanza_create_room_leave_presence(ctx, room_jid,
xmpp_send(conn, presence); nick);
xmpp_stanza_release(presence); xmpp_send(conn, presence);
xmpp_stanza_release(presence);
}
} }
static int static int