diff --git a/src/otr/otr.c b/src/otr/otr.c index af43854c..2cb86695 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -32,6 +32,10 @@ #include "contact.h" #include "ui/ui.h" +#define PRESENCE_ONLINE 1 +#define PRESENCE_OFFLINE 0 +#define PRESENCE_UNKNOWN -1 + static OtrlUserState user_state; static OtrlMessageAppOps ops; static char *jid; @@ -49,10 +53,14 @@ cb_is_logged_in(void *opdata, const char *accountname, const char *protocol, const char *recipient) { PContact contact = roster_get_contact(recipient); + if (contact == NULL) { + return PRESENCE_ONLINE; + } + if (g_strcmp0(p_contact_presence(contact), "offline") == 0) { - return 0; + return PRESENCE_OFFLINE; } else { - return 1; + return PRESENCE_ONLINE; } } diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c index 395b2c6f..99932024 100644 --- a/src/ui/titlebar.c +++ b/src/ui/titlebar.c @@ -157,11 +157,15 @@ _title_bar_draw(void) waddch(win, ' '); mvwprintw(win, 0, 0, " %s", current_title); - #ifdef HAVE_LIBOTR // show privacy if (current_recipient != NULL) { - char *recipient_jid = roster_barejid_from_name(current_recipient); + char *recipient_jid = NULL; + if (roster_find_contact(current_recipient) != NULL) { + recipient_jid = roster_barejid_from_name(current_recipient); + } else { + recipient_jid = current_recipient; + } ProfWin *current = wins_get_by_recipient(recipient_jid); if (current != NULL) { if (current->type == WIN_CHAT) {