mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-25 18:36:21 +00:00
Tidy titlebar.c
This commit is contained in:
@@ -59,8 +59,8 @@ static gboolean typing;
|
|||||||
static GTimer *typing_elapsed;
|
static GTimer *typing_elapsed;
|
||||||
|
|
||||||
static void _title_bar_draw(void);
|
static void _title_bar_draw(void);
|
||||||
static void _show_contact_presence(void);
|
|
||||||
static void _show_self_presence(void);
|
static void _show_self_presence(void);
|
||||||
|
static void _show_contact_presence(ProfChatWin *chatwin);
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
static void _show_privacy(ProfChatWin *chatwin);
|
static void _show_privacy(ProfChatWin *chatwin);
|
||||||
#endif
|
#endif
|
||||||
@@ -182,17 +182,21 @@ _title_bar_draw(void)
|
|||||||
mvwprintw(win, 0, 0, " %s", current_title);
|
mvwprintw(win, 0, 0, " %s", current_title);
|
||||||
|
|
||||||
if (current && current->type == WIN_CHAT) {
|
if (current && current->type == WIN_CHAT) {
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)current;
|
ProfChatWin *chatwin = (ProfChatWin*) current;
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
_show_contact_presence();
|
_show_contact_presence(chatwin);
|
||||||
|
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
_show_privacy(chatwin);
|
_show_privacy(chatwin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (typing) {
|
if (typing) {
|
||||||
wprintw(win, " (typing...)");
|
wprintw(win, " (typing...)");
|
||||||
}
|
}
|
||||||
} else if (current && current->type == WIN_MUC_CONFIG) {
|
} else if (current && current->type == WIN_MUC_CONFIG) {
|
||||||
if (win_has_modified_form(current)) {
|
ProfMucConfWin *confwin = (ProfMucConfWin*) current;
|
||||||
|
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
|
||||||
|
if (confwin->form->modified) {
|
||||||
wprintw(win, " *");
|
wprintw(win, " *");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,13 +325,10 @@ _show_privacy(ProfChatWin *chatwin)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_show_contact_presence(void)
|
_show_contact_presence(ProfChatWin *chatwin)
|
||||||
{
|
{
|
||||||
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
|
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
|
||||||
|
if (chatwin && chatwin->resource) {
|
||||||
ProfWin *current = wins_get_current();
|
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)current;
|
|
||||||
if (current && win_has_chat_resource(current)) {
|
|
||||||
wprintw(win, "/");
|
wprintw(win, "/");
|
||||||
wprintw(win, chatwin->resource);
|
wprintw(win, chatwin->resource);
|
||||||
}
|
}
|
||||||
@@ -336,24 +337,15 @@ _show_contact_presence(void)
|
|||||||
theme_item_t presence_colour = THEME_TITLE_OFFLINE;
|
theme_item_t presence_colour = THEME_TITLE_OFFLINE;
|
||||||
const char *presence = "offline";
|
const char *presence = "offline";
|
||||||
|
|
||||||
if (current && win_has_chat_resource(current)) {
|
PContact contact = roster_get_contact(chatwin->barejid);
|
||||||
char *barejid = roster_barejid_from_name(current_recipient);
|
if (contact) {
|
||||||
if (barejid) {
|
if (chatwin && chatwin->resource) {
|
||||||
PContact contact = roster_get_contact(barejid);
|
Resource *resource = p_contact_get_resource(contact, chatwin->resource);
|
||||||
if (contact) {
|
if (resource) {
|
||||||
Resource *resource = p_contact_get_resource(contact, chatwin->resource);
|
presence = string_from_resource_presence(resource->presence);
|
||||||
if (resource) {
|
|
||||||
presence = string_from_resource_presence(resource->presence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
char *barejid = roster_barejid_from_name(current_recipient);
|
|
||||||
if (barejid) {
|
|
||||||
PContact contact = roster_get_contact(barejid);
|
|
||||||
if (contact) {
|
|
||||||
presence = p_contact_presence(contact);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
presence = p_contact_presence(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user