diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/chatwin.c | 17 | ||||
-rw-r--r-- | src/ui/console.c | 3 | ||||
-rw-r--r-- | src/ui/rosterwin.c | 5 | ||||
-rw-r--r-- | src/ui/titlebar.c | 19 | ||||
-rw-r--r-- | src/ui/window.c | 13 |
5 files changed, 37 insertions, 20 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index ba66c7ae..79401038 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -362,13 +362,18 @@ chatwin_get_string(ProfChatWin *chatwin) GString *res = g_string_new("Chat "); - PContact contact = roster_get_contact(chatwin->barejid); - if (contact == NULL) { - g_string_append(res, chatwin->barejid); + jabber_conn_status_t conn_status = jabber_get_connection_status(); + if (conn_status == JABBER_CONNECTED) { + PContact contact = roster_get_contact(chatwin->barejid); + if (contact == NULL) { + g_string_append(res, chatwin->barejid); + } else { + const char *display_name = p_contact_name_or_jid(contact); + g_string_append(res, display_name); + g_string_append_printf(res, " - %s", p_contact_presence(contact)); + } } else { - const char *display_name = p_contact_name_or_jid(contact); - g_string_append(res, display_name); - g_string_append_printf(res, " - %s", p_contact_presence(contact)); + g_string_append(res, chatwin->barejid); } if (chatwin->unread > 0) { diff --git a/src/ui/console.c b/src/ui/console.c index a5406cab..212656c3 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -746,8 +746,7 @@ cons_show_status(const char *const barejid) } void -cons_show_room_invite(const char *const invitor, const char * const room, - const char *const reason) +cons_show_room_invite(const char *const invitor, const char * const room, const char *const reason) { char *display_from = NULL; PContact contact = roster_get_contact(invitor); diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index dd5d886f..a3540d01 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -466,6 +466,11 @@ rosterwin_roster(void) return; } + jabber_conn_status_t conn_status = jabber_get_connection_status(); + if (conn_status != JABBER_CONNECTED) { + return; + } + ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout; assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK); diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 41715811..5894e0ac 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -403,15 +403,18 @@ _show_contact_presence(ProfChatWin *chatwin) theme_item_t presence_colour = THEME_TITLE_OFFLINE; const char *presence = "offline"; - PContact contact = roster_get_contact(chatwin->barejid); - if (contact) { - if (resource) { - Resource *resourcep = p_contact_get_resource(contact, resource); - if (resourcep) { - presence = string_from_resource_presence(resourcep->presence); + jabber_conn_status_t conn_status = jabber_get_connection_status(); + if (conn_status == JABBER_CONNECTED) { + PContact contact = roster_get_contact(chatwin->barejid); + if (contact) { + if (resource) { + Resource *resourcep = p_contact_get_resource(contact, resource); + if (resourcep) { + presence = string_from_resource_presence(resourcep->presence); + } + } else { + presence = p_contact_presence(contact); } - } else { - presence = p_contact_presence(contact); } } diff --git a/src/ui/window.c b/src/ui/window.c index 039d4770..b4d1e9ab 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -248,10 +248,15 @@ win_get_title(ProfWin *window) if (window->type == WIN_CHAT) { ProfChatWin *chatwin = (ProfChatWin*) window; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); - PContact contact = roster_get_contact(chatwin->barejid); - if (contact) { - const char *name = p_contact_name_or_jid(contact); - return strdup(name); + jabber_conn_status_t conn_status = jabber_get_connection_status(); + if (conn_status == JABBER_CONNECTED) { + PContact contact = roster_get_contact(chatwin->barejid); + if (contact) { + const char *name = p_contact_name_or_jid(contact); + return strdup(name); + } else { + return strdup(chatwin->barejid); + } } else { return strdup(chatwin->barejid); } |