mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 02:16:21 +00:00
Added resource_presence_t and contact_presence_t
This commit is contained in:
@@ -32,7 +32,7 @@ static char *current_title = NULL;
|
||||
static char *recipient = NULL;
|
||||
static GTimer *typing_elapsed;
|
||||
static int dirty;
|
||||
static presence_t current_status;
|
||||
static contact_presence_t current_status;
|
||||
|
||||
static void _title_bar_draw_title(void);
|
||||
static void _title_bar_draw_status(void);
|
||||
@@ -45,7 +45,7 @@ create_title_bar(void)
|
||||
title_bar = newwin(1, cols, 0, 0);
|
||||
wbkgd(title_bar, COLOUR_TITLE_TEXT);
|
||||
title_bar_title();
|
||||
title_bar_set_status(PRESENCE_OFFLINE);
|
||||
title_bar_set_status(CONTACT_OFFLINE);
|
||||
dirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ title_bar_show(const char * const title)
|
||||
}
|
||||
|
||||
void
|
||||
title_bar_set_status(presence_t status)
|
||||
title_bar_set_status(contact_presence_t status)
|
||||
{
|
||||
current_status = status;
|
||||
_title_bar_draw_status();
|
||||
@@ -187,18 +187,26 @@ _title_bar_draw_status(void)
|
||||
mvwaddch(title_bar, 0, cols - 14, '[');
|
||||
wattroff(title_bar, COLOUR_TITLE_BRACKET);
|
||||
|
||||
if (current_status == PRESENCE_ONLINE) {
|
||||
mvwprintw(title_bar, 0, cols - 13, " ...online ");
|
||||
} else if (current_status == PRESENCE_AWAY) {
|
||||
mvwprintw(title_bar, 0, cols - 13, " .....away ");
|
||||
} else if (current_status == PRESENCE_DND) {
|
||||
mvwprintw(title_bar, 0, cols - 13, " ......dnd ");
|
||||
} else if (current_status == PRESENCE_CHAT) {
|
||||
mvwprintw(title_bar, 0, cols - 13, " .....chat ");
|
||||
} else if (current_status == PRESENCE_XA) {
|
||||
mvwprintw(title_bar, 0, cols - 13, " .......xa ");
|
||||
} else {
|
||||
mvwprintw(title_bar, 0, cols - 13, " ..offline ");
|
||||
switch (current_status)
|
||||
{
|
||||
case CONTACT_ONLINE:
|
||||
mvwprintw(title_bar, 0, cols - 13, " ...online ");
|
||||
break;
|
||||
case CONTACT_AWAY:
|
||||
mvwprintw(title_bar, 0, cols - 13, " .....away ");
|
||||
break;
|
||||
case CONTACT_DND:
|
||||
mvwprintw(title_bar, 0, cols - 13, " ......dnd ");
|
||||
break;
|
||||
case CONTACT_CHAT:
|
||||
mvwprintw(title_bar, 0, cols - 13, " .....chat ");
|
||||
break;
|
||||
case CONTACT_XA:
|
||||
mvwprintw(title_bar, 0, cols - 13, " .......xa ");
|
||||
break;
|
||||
case CONTACT_OFFLINE:
|
||||
mvwprintw(title_bar, 0, cols - 13, " ..offline ");
|
||||
break;
|
||||
}
|
||||
|
||||
wattron(title_bar, COLOUR_TITLE_BRACKET);
|
||||
|
||||
@@ -92,7 +92,7 @@ void title_bar_refresh(void);
|
||||
void title_bar_resize(void);
|
||||
void title_bar_show(const char * const title);
|
||||
void title_bar_title(void);
|
||||
void title_bar_set_status(presence_t status);
|
||||
void title_bar_set_status(contact_presence_t status);
|
||||
void title_bar_set_recipient(char *from);
|
||||
void title_bar_set_typing(gboolean is_typing);
|
||||
void title_bar_draw(void);
|
||||
|
||||
@@ -506,7 +506,7 @@ ui_disconnected(void)
|
||||
}
|
||||
}
|
||||
|
||||
title_bar_set_status(PRESENCE_OFFLINE);
|
||||
title_bar_set_status(CONTACT_OFFLINE);
|
||||
status_bar_clear_message();
|
||||
status_bar_refresh();
|
||||
}
|
||||
@@ -1094,26 +1094,8 @@ cons_show_login_success(ProfAccount *account)
|
||||
_win_show_time(console->win, '-');
|
||||
wprintw(console->win, "%s logged in successfully, ", account->jid);
|
||||
|
||||
presence_t presence = accounts_get_login_presence(account->name);
|
||||
char *presence_str;
|
||||
switch(presence)
|
||||
{
|
||||
case PRESENCE_CHAT:
|
||||
presence_str = "chat";
|
||||
break;
|
||||
case PRESENCE_AWAY:
|
||||
presence_str = "away";
|
||||
break;
|
||||
case PRESENCE_XA:
|
||||
presence_str = "xa";
|
||||
break;
|
||||
case PRESENCE_DND:
|
||||
presence_str = "dnd";
|
||||
break;
|
||||
default:
|
||||
presence_str = "online";
|
||||
break;
|
||||
}
|
||||
resource_presence_t presence = accounts_get_login_presence(account->name);
|
||||
const char *presence_str = string_from_resource_presence(presence);
|
||||
|
||||
_presence_colour_on(console->win, presence_str);
|
||||
wprintw(console->win, "%s", presence_str);
|
||||
|
||||
Reference in New Issue
Block a user