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:
parent
7512d70ff5
commit
81f9292948
@ -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()) {
|
||||
|
18
src/jabber.c
18
src/jabber.c
@ -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 {
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user