From 10a3a3a67504225ffaaee6aabb39831db36c8f31 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 29 Dec 2014 01:17:59 +0000 Subject: Use events for chat sessions --- src/ui/core.c | 25 ++++--------------------- src/ui/ui.h | 2 +- 2 files changed, 5 insertions(+), 22 deletions(-) (limited to 'src/ui') diff --git a/src/ui/core.c b/src/ui/core.c index e7264435..c3f185f6 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -315,7 +315,7 @@ ui_contact_typing(const char * const barejid) } GSList * -ui_get_recipients(void) +ui_get_chat_recipients(void) { GSList *recipients = wins_get_chat_recipients(); return recipients; @@ -705,15 +705,7 @@ ui_close_connected_win(int index) otr_end_session(chatwin->barejid); } #endif - if (prefs_get_boolean(PREF_STATES)) { - // send chat state before closing - if (chat_session_get_recipient_supports(chatwin->barejid)) { - chat_session_set_gone(chatwin->barejid); - message_send_gone(chatwin->barejid); - chat_session_set_sent(chatwin->barejid); - chat_session_end(chatwin->barejid); - } - } + chat_session_on_window_close(chatwin->barejid); } } } @@ -1169,17 +1161,8 @@ ui_prune_wins(void) ProfWin *window = curr->data; if (window->type == WIN_CHAT) { if (conn_status == JABBER_CONNECTED) { - if (prefs_get_boolean(PREF_STATES)) { - ProfChatWin *chatwin = (ProfChatWin*)window; - - // send chat state before closing - if (chat_session_get_recipient_supports(chatwin->barejid)) { - chat_session_set_gone(chatwin->barejid); - message_send_gone(chatwin->barejid); - chat_session_set_sent(chatwin->barejid); - chat_session_end(chatwin->barejid); - } - } + ProfChatWin *chatwin = (ProfChatWin*)window; + chat_session_on_window_close(chatwin->barejid); } } diff --git a/src/ui/ui.h b/src/ui/ui.h index 7db2227f..e7b46766 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -60,7 +60,7 @@ void ui_update(void); void ui_close(void); void ui_redraw(void); void ui_resize(void); -GSList* ui_get_recipients(void); +GSList* ui_get_chat_recipients(void); void ui_handle_special_keys(const wint_t * const ch, const int result); gboolean ui_switch_win(const int i); void ui_next_win(void); -- cgit 1.4.1-2-gfad0