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

Show message when other user <gone/>

This commit is contained in:
James Booth 2012-11-01 01:21:00 +00:00
parent 0ce7b2acb7
commit e45e6c46b7
5 changed files with 35 additions and 1 deletions

View File

@ -443,7 +443,7 @@ _message_handler(xmpp_conn_t * const conn,
// handle <gone/>
} else if (xmpp_stanza_get_child_by_name(stanza, "gone") != NULL) {
// do something
prof_handle_gone(short_from);
// handle <active/>
} else {

View File

@ -145,6 +145,13 @@ prof_handle_login_success(const char *jid)
prefs_add_login(jid);
}
void
prof_handle_gone(const char * const from)
{
win_show_gone(from);
win_page_off();
}
void
prof_handle_lost_connection(void)
{

View File

@ -34,5 +34,6 @@ void prof_handle_contact_offline(char *contact, char *show, char *status);
void prof_handle_incoming_message(char *from, char *message);
void prof_handle_error_message(const char *from, const char *err_msg);
void prof_handle_roster(GSList *roster);
void prof_handle_gone(const char * const from);
#endif

View File

@ -87,6 +87,7 @@ void win_close_win(void);
int win_in_chat(void);
char *win_get_recipient(void);
void win_show_typing(const char * const from);
void win_show_gone(const char * const from);
void win_show_incomming_msg(const char * const from, const char * const message);
void win_show_error_msg(const char * const from, const char *err_msg);
void win_show_outgoing_msg(const char * const from, const char * const to,

View File

@ -337,6 +337,31 @@ win_show_error_msg(const char * const from, const char *err_msg)
}
}
void
win_show_gone(const char * const from)
{
int win_index;
WINDOW *win;
if (from == NULL)
return;
win_index = _find_prof_win_index(from);
// chat window exists
if (win_index < NUM_WINS) {
win = _wins[win_index].win;
_win_show_time(win);
wattron(win, COLOUR_AWAY);
wprintw(win, "*%s ", from);
wprintw(win, "has left the conversation.");
wprintw(win, "\n");
wattroff(win, COLOUR_AWAY);
if (win_index == _curr_prof_win) {
dirty = TRUE;
}
}
}
#ifdef HAVE_LIBNOTIFY
static void
_win_notify(const char * const message, int timeout,