From 62c2febc11457baf00220f9c3951397dac7989d1 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 27 Oct 2015 23:05:20 +0000 Subject: Tidied ui_recipient_gone --- src/ui/chatwin.c | 40 ++++++++++++---------------------------- src/ui/ui.h | 2 +- 2 files changed, 13 insertions(+), 29 deletions(-) (limited to 'src/ui') diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 7921e559..c4fe9507 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -191,37 +191,21 @@ ui_handle_otr_error(const char *const barejid, const char *const message) } void -ui_recipient_gone(const char *const barejid, const char *const resource) +ui_recipient_gone(ProfChatWin *chatwin) { - if (barejid == NULL) - return; - if (resource == NULL) - return; - - gboolean show_message = TRUE; - - ProfChatWin *chatwin = wins_get_chat(barejid); - if (chatwin) { - ChatSession *session = chat_session_get(barejid); - if (session && g_strcmp0(session->resource, resource) != 0) { - show_message = FALSE; - } - if (show_message) { - const char * display_usr = NULL; - PContact contact = roster_get_contact(barejid); - if (contact) { - if (p_contact_name(contact)) { - display_usr = p_contact_name(contact); - } else { - display_usr = barejid; - } - } else { - display_usr = barejid; - } - - win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_GONE, "", "<- %s has left the conversation.", display_usr); + const char *display_usr = NULL; + PContact contact = roster_get_contact(chatwin->barejid); + if (contact) { + if (p_contact_name(contact)) { + display_usr = p_contact_name(contact); + } else { + display_usr = chatwin->barejid; } + } else { + display_usr = chatwin->barejid; } + + win_vprint((ProfWin*)chatwin, '!', 0, NULL, 0, THEME_GONE, "", "<- %s has left the conversation.", display_usr); } ProfChatWin* diff --git a/src/ui/ui.h b/src/ui/ui.h index 5e634438..81a600c3 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -104,7 +104,7 @@ void ui_incoming_private_msg(const char *const fulljid, const char *const messag void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id); void ui_disconnected(void); -void ui_recipient_gone(const char *const barejid, const char *const resource); +void ui_recipient_gone(ProfChatWin *chatwin); void ui_outgoing_chat_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode); void ui_outgoing_chat_msg_carbon(const char *const barejid, const char *const message); -- cgit 1.4.1-2-gfad0