about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/jabber.c2
-rw-r--r--src/profanity.c7
-rw-r--r--src/profanity.h1
-rw-r--r--src/ui.h1
-rw-r--r--src/windows.c25
5 files changed, 35 insertions, 1 deletions
diff --git a/src/jabber.c b/src/jabber.c
index 150f7c6f..766c78bf 100644
--- a/src/jabber.c
+++ b/src/jabber.c
@@ -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 {
diff --git a/src/profanity.c b/src/profanity.c
index 885c55ea..41a89956 100644
--- a/src/profanity.c
+++ b/src/profanity.c
@@ -146,6 +146,13 @@ prof_handle_login_success(const char *jid)
 }
 
 void
+prof_handle_gone(const char * const from)
+{
+    win_show_gone(from);
+    win_page_off();
+}
+
+void
 prof_handle_lost_connection(void)
 {
     cons_bad_show("Lost connection.");
diff --git a/src/profanity.h b/src/profanity.h
index a67fb2df..dc56b775 100644
--- a/src/profanity.h
+++ b/src/profanity.h
@@ -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
diff --git a/src/ui.h b/src/ui.h
index 46fb22bf..2c60428d 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -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,
diff --git a/src/windows.c b/src/windows.c
index 792c4556..cda57fa8 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -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,