1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Tidy up leaving room

This commit is contained in:
James Booth 2012-11-10 01:17:16 +00:00
parent 7512d70ff5
commit 81f9292948
4 changed files with 22 additions and 6 deletions

View File

@ -1093,7 +1093,6 @@ _cmd_close(const char * const inp, struct cmd_help_t help)
if (win_in_groupchat()) {
char *room_jid = win_get_recipient();
jabber_leave_chat_room(room_jid);
win_close_win();
} else if (win_in_chat()) {
if (prefs_get_states()) {

View File

@ -251,8 +251,6 @@ jabber_leave_chat_room(const char * const room_jid)
room_jid, nick);
xmpp_send(jabber_conn.conn, presence);
xmpp_stanza_release(presence);
room_leave(room_jid);
}
void
@ -589,10 +587,20 @@ _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza)
return 1;
}
// handle self presence (means room roster has been sent)
// handle self presence
if (strcmp(room_get_nick_for_room(room), nick) == 0) {
room_set_roster_received(room);
prof_handle_room_roster_complete(room);
char *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
// left room
if (type != NULL) {
if (strcmp(type, STANZA_TYPE_UNAVAILABLE) == 0) {
prof_handle_leave_room(room);
}
// roster received
} else {
prof_handle_room_roster_complete(room);
}
// handle presence from room members
} else {

View File

@ -208,6 +208,7 @@ prof_handle_room_message(const char * const room_jid, const char * const nick,
void
prof_handle_room_roster_complete(const char * const room)
{
room_set_roster_received(room);
win_show_room_roster(room);
win_page_off();
}
@ -230,6 +231,13 @@ prof_handle_room_member_offline(const char * const room, const char * const nick
win_page_off();
}
void
prof_handle_leave_room(const char * const room)
{
room_leave(room);
win_close_win();
}
void
prof_handle_contact_online(char *contact, char *show, char *status)
{

View File

@ -45,5 +45,6 @@ void prof_handle_room_member_online(const char * const room,
const char * const nick, const char * const show, const char * const status);
void prof_handle_room_member_offline(const char * const room,
const char * const nick, const char * const show, const char * const status);
void prof_handle_leave_room(const char * const room);
#endif