about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/core.c11
-rw-r--r--src/ui/titlebar.c4
-rw-r--r--src/ui/ui.h2
3 files changed, 13 insertions, 4 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 0859d2d4..68cc9537 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -569,7 +569,16 @@ ui_switch_win(const int i)
             title_bar_title();
             status_bar_active(0);
         } else {
-            title_bar_set_recipient(current->from);
+            PContact contact = roster_get_contact(current->from);
+            if (contact != NULL) {
+                if (p_contact_name(contact) != NULL) {
+                    title_bar_set_recipient(p_contact_name(contact));
+                } else {
+                    title_bar_set_recipient(current->from);
+                }
+            } else {
+                title_bar_set_recipient(current->from);
+            }
             title_bar_draw();;
             status_bar_active(i);
         }
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index c786c774..4b3ca997 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -29,7 +29,7 @@
 
 static WINDOW *title_bar;
 static char *current_title = NULL;
-static char *recipient = NULL;
+static const char *recipient = NULL;
 static GTimer *typing_elapsed;
 static int dirty;
 static contact_presence_t current_status;
@@ -126,7 +126,7 @@ title_bar_set_status(contact_presence_t status)
 }
 
 void
-title_bar_set_recipient(char *from)
+title_bar_set_recipient(const char * const from)
 {
     if (typing_elapsed != NULL) {
         g_timer_destroy(typing_elapsed);
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 97b53b6d..c724f9ae 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -138,7 +138,7 @@ void title_bar_resize(void);
 void title_bar_show(const char * const title);
 void title_bar_title(void);
 void title_bar_set_status(contact_presence_t status);
-void title_bar_set_recipient(char *from);
+void title_bar_set_recipient(const char * const from);
 void title_bar_set_typing(gboolean is_typing);
 void title_bar_draw(void);