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

Show contacts handle as window title in chat

This commit is contained in:
James Booth 2013-05-19 03:45:27 +01:00
parent 1c41a46dce
commit db6e7f5697
3 changed files with 13 additions and 4 deletions

View File

@ -568,8 +568,17 @@ ui_switch_win(const int i)
if (i == 0) { if (i == 0) {
title_bar_title(); title_bar_title();
status_bar_active(0); status_bar_active(0);
} else {
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 { } else {
title_bar_set_recipient(current->from); title_bar_set_recipient(current->from);
}
} else {
title_bar_set_recipient(current->from);
}
title_bar_draw();; title_bar_draw();;
status_bar_active(i); status_bar_active(i);
} }

View File

@ -29,7 +29,7 @@
static WINDOW *title_bar; static WINDOW *title_bar;
static char *current_title = NULL; static char *current_title = NULL;
static char *recipient = NULL; static const char *recipient = NULL;
static GTimer *typing_elapsed; static GTimer *typing_elapsed;
static int dirty; static int dirty;
static contact_presence_t current_status; static contact_presence_t current_status;
@ -126,7 +126,7 @@ title_bar_set_status(contact_presence_t status)
} }
void void
title_bar_set_recipient(char *from) title_bar_set_recipient(const char * const from)
{ {
if (typing_elapsed != NULL) { if (typing_elapsed != NULL) {
g_timer_destroy(typing_elapsed); g_timer_destroy(typing_elapsed);

View File

@ -138,7 +138,7 @@ void title_bar_resize(void);
void title_bar_show(const char * const title); void title_bar_show(const char * const title);
void title_bar_title(void); void title_bar_title(void);
void title_bar_set_status(contact_presence_t status); 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_set_typing(gboolean is_typing);
void title_bar_draw(void); void title_bar_draw(void);