1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Tidied xmlconsole

This commit is contained in:
James Booth 2014-04-15 23:45:17 +01:00
parent e6e0a13e89
commit ef776e52ca
5 changed files with 24 additions and 18 deletions

View File

@ -1382,6 +1382,7 @@ cmd_execute_default(const char * const inp)
break;
case WIN_CONSOLE:
case WIN_XML:
cons_show("Unknown command: %s", inp);
break;

View File

@ -230,17 +230,21 @@ _ui_handle_stanza(const char * const msg)
{
if (ui_xmlconsole_exists()) {
ProfWin *xmlconsole = wins_get_xmlconsole();
if (g_str_has_prefix(msg, "SENT:")) {
win_vprint_line(xmlconsole, '!', COLOUR_ONLINE, "<- %s", &msg[6]);
} else if (g_str_has_prefix(msg, "RECV:")) {
win_vprint_line(xmlconsole, '!', COLOUR_AWAY, "-> %s", &msg[6]);
}
win_update_virtual(xmlconsole);
if (wins_is_current(xmlconsole)) {
ui_current_page_off();
}
if (g_str_has_prefix(msg, "SENT:")) {
win_print_line_no_time(xmlconsole, 0, "SENT:");
win_print_line_no_time(xmlconsole, COLOUR_ONLINE, &msg[6]);
win_print_line_no_time(xmlconsole, COLOUR_ONLINE, "");
} else if (g_str_has_prefix(msg, "RECV:")) {
win_print_line_no_time(xmlconsole, 0, "RECV:");
win_print_line_no_time(xmlconsole, COLOUR_AWAY, &msg[6]);
win_print_line_no_time(xmlconsole, COLOUR_ONLINE, "");
}
if (wins_is_current(xmlconsole)) {
win_update_virtual(xmlconsole);
ui_current_page_off();
}
}
}

View File

@ -302,14 +302,6 @@ status_bar_clear(void)
message = NULL;
}
int i;
is_active[1] = TRUE;
is_new[1] = FALSE;
for (i = 2; i < 12; i++) {
is_active[i] = FALSE;
is_new[i] = FALSE;
}
werase(status_bar);
int cols = getmaxx(stdscr);

View File

@ -89,6 +89,14 @@ win_print_line(ProfWin *window, const char show_char, int attrs,
wattroff(window->win, attrs);
}
void
win_print_line_no_time(ProfWin *window, int attrs, const char * const msg)
{
wattron(window->win, attrs);
wprintw(window->win, "%s\n", msg);
wattroff(window->win, attrs);
}
void
win_vprint_line(ProfWin *window, const char show_char, int attrs,
const char * const msg, ...)

View File

@ -63,6 +63,7 @@ void win_vprint_line(ProfWin *self, const char show_char, int attrs,
const char * const msg, ...);
void win_print_line(ProfWin *self, const char show_char, int attrs,
const char * const msg);
void win_print_line_no_time(ProfWin *window, int attrs, const char * const msg);
void win_update_virtual(ProfWin *window);
void win_move_to_end(ProfWin *window);
void win_print_time(ProfWin *window, char show_char);