Simplified interface

This commit is contained in:
James Booth
2012-02-28 01:42:47 +00:00
parent 509888c419
commit 64041a4aa7
2 changed files with 10 additions and 26 deletions

View File

@@ -232,7 +232,7 @@ static int _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
log_msg(CONN, "ERROR: query failed"); log_msg(CONN, "ERROR: query failed");
else { else {
query = xmpp_stanza_get_child_by_name(stanza, "query"); query = xmpp_stanza_get_child_by_name(stanza, "query");
cons_highlight_show("Roster:"); cons_show("Roster:");
item = xmpp_stanza_get_children(query); item = xmpp_stanza_get_children(query);
while (item != NULL) { while (item != NULL) {

View File

@@ -188,7 +188,9 @@ void win_show_contact_offline(char *from, char *show, char *status)
void cons_help(void) void cons_help(void)
{ {
_win_show_time(0); _win_show_time(0);
wattron(_wins[0].win, A_BOLD);
wprintw(_wins[0].win, "Help:\n"); wprintw(_wins[0].win, "Help:\n");
wattroff(_wins[0].win, A_BOLD);
cons_show(" Commands:"); cons_show(" Commands:");
cons_show(" /help : This help."); cons_show(" /help : This help.");
@@ -221,12 +223,6 @@ void cons_bad_show(char *msg)
} }
void cons_show(char *msg) void cons_show(char *msg)
{
_win_show_time(0);
wprintw(_wins[0].win, "%s\n", msg);
}
void cons_highlight_show(char *msg)
{ {
_win_show_time(0); _win_show_time(0);
wattron(_wins[0].win, A_BOLD); wattron(_wins[0].win, A_BOLD);
@@ -237,7 +233,9 @@ void cons_highlight_show(char *msg)
void cons_bad_command(char *cmd) void cons_bad_command(char *cmd)
{ {
_win_show_time(0); _win_show_time(0);
wattron(_wins[0].win, A_BOLD);
wprintw(_wins[0].win, "Unknown command: %s\n", cmd); wprintw(_wins[0].win, "Unknown command: %s\n", cmd);
wattroff(_wins[0].win, A_BOLD);
} }
void cons_bad_connect(void) void cons_bad_connect(void)
@@ -396,34 +394,20 @@ static void _win_show_time(int win)
{ {
char tstmp[80]; char tstmp[80];
get_time(tstmp); get_time(tstmp);
wattron(_wins[win].win, COLOR_PAIR(5)); wattron(_wins[win].win, A_BOLD);
wprintw(_wins[win].win, " ["); wprintw(_wins[win].win, "%s - ", tstmp);
wattroff(_wins[win].win, COLOR_PAIR(5)); wattroff(_wins[win].win, A_BOLD);
wprintw(_wins[win].win, "%s", tstmp);
wattron(_wins[win].win, COLOR_PAIR(5));
wprintw(_wins[win].win, "] ");
wattroff(_wins[win].win, COLOR_PAIR(5));
} }
static void _win_show_user(int win, char *user, int colour) static void _win_show_user(int win, char *user, int colour)
{ {
wattron(_wins[win].win, A_DIM);
wprintw(_wins[win].win, "<");
wattroff(_wins[win].win, A_DIM);
if (colour) if (colour)
wattron(_wins[win].win, COLOR_PAIR(2)); wattron(_wins[win].win, COLOR_PAIR(2));
wattron(_wins[win].win, A_BOLD); wattron(_wins[win].win, A_BOLD);
wprintw(_wins[win].win, "%s", user); wprintw(_wins[win].win, "%s: ", user);
if (colour) if (colour)
wattroff(_wins[win].win, COLOR_PAIR(2)); wattroff(_wins[win].win, COLOR_PAIR(2));
wattroff(_wins[win].win, A_BOLD); wattroff(_wins[win].win, A_BOLD);
wattron(_wins[win].win, A_DIM);
wprintw(_wins[win].win, "> ");
wattroff(_wins[win].win, A_DIM);
} }
static void _current_window_refresh() static void _current_window_refresh()