about summary refs log tree commit diff stats
path: root/src/ui/core.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-05-20 22:51:35 +0100
committerJames Booth <boothj5@gmail.com>2013-05-20 22:51:35 +0100
commitecc62af3053496e283abb581c49cf1fd0e6cd06a (patch)
treefd7a9bb5214a7028bfdb13ef03067e6ed403c376 /src/ui/core.c
parent4a8db64d7a8baebac732b3c50e1c5184cddc522f (diff)
downloadprofani-tty-ecc62af3053496e283abb581c49cf1fd0e6cd06a.tar.gz
Finished handle usage
Diffstat (limited to 'src/ui/core.c')
-rw-r--r--src/ui/core.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 9c640b8e..8b9cfa21 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -226,18 +226,18 @@ ui_duck_exists(void)
 }
 
 void
-ui_contact_typing(const char * const from)
+ui_contact_typing(const char * const barejid)
 {
-    int win_index = _find_prof_win_index(from);
+    int win_index = _find_prof_win_index(barejid);
 
     if (prefs_get_boolean(PREF_INTYPE)) {
         // no chat window for user
         if (win_index == NUM_WINS) {
-            cons_show_typing(from);
+            cons_show_typing(barejid);
 
         // have chat window but not currently in it
         } else if (win_index != current_index) {
-            cons_show_typing(from);
+            cons_show_typing(barejid);
             current_win_dirty = TRUE;
 
         // in chat window with user
@@ -250,8 +250,16 @@ ui_contact_typing(const char * const from)
        }
     }
 
-    if (prefs_get_boolean(PREF_NOTIFY_TYPING))
-        notify_typing(from);
+    if (prefs_get_boolean(PREF_NOTIFY_TYPING)) {
+        PContact contact = roster_get_contact(barejid);
+        char const *display_usr = NULL;
+        if (p_contact_name(contact) != NULL) {
+            display_usr = p_contact_name(contact);
+        } else {
+            display_usr = barejid;
+        }
+        notify_typing(display_usr);
+    }
 }
 
 void
@@ -490,7 +498,8 @@ ui_contact_offline(const char * const from, const char * const show,
     _show_status_string(console, display_str->str, show, status, NULL, "--",
         "offline");
 
-    int win_index = _find_prof_win_index(from);
+    int win_index = _find_prof_win_index(jidp->barejid);
+    cons_debug("INDEX %d", win_index);
     if (win_index != NUM_WINS) {
         ProfWin *window = windows[win_index];
         _show_status_string(window, display_str->str, show, status, NULL, "--",
@@ -802,21 +811,29 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
 }
 
 void
-ui_recipient_gone(const char * const from)
+ui_recipient_gone(const char * const barejid)
 {
     int win_index;
     ProfWin *window;
 
-    if (from == NULL)
+    if (barejid == NULL)
         return;
 
-    win_index = _find_prof_win_index(from);
+    PContact contact = roster_get_contact(barejid);
+    const char * display_usr = NULL;
+    if (p_contact_name(contact) != NULL) {
+        display_usr = p_contact_name(contact);
+    } else {
+        display_usr = barejid;
+    }
+
+    win_index = _find_prof_win_index(barejid);
     // chat window exists
     if (win_index < NUM_WINS) {
         window = windows[win_index];
-        win_print_time(window, '-');
+        win_print_time(window, '!');
         wattron(window->win, COLOUR_GONE);
-        wprintw(window->win, "*%s ", from);
+        wprintw(window->win, "<- %s ", display_usr);
         wprintw(window->win, "has left the conversation.");
         wprintw(window->win, "\n");
         wattroff(window->win, COLOUR_GONE);