about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-02-19 00:43:35 +0000
committerJames Booth <boothj5@gmail.com>2012-02-19 00:43:35 +0000
commitd151b2d088105e0d7785ac89cea448a0f6cf339c (patch)
treeb4e45bdd0256a68fb342d8c6fd1d9f8ec510586b
parent355f2a68fd7431a9ec5667c1aa6a04d566a21a1c (diff)
downloadprofani-tty-d151b2d088105e0d7785ac89cea448a0f6cf339c.tar.gz
Tarted up console
-rw-r--r--jabber.c10
-rw-r--r--windows.c50
-rw-r--r--windows.h3
3 files changed, 55 insertions, 8 deletions
diff --git a/jabber.c b/jabber.c
index 91d50530..3b7c1dae 100644
--- a/jabber.c
+++ b/jabber.c
@@ -61,11 +61,11 @@ int jabber_connect(char *user, char *passwd)
     int connect_status = xmpp_connect_client(_conn, NULL, 0, _jabber_conn_handler, _ctx);
 
     if (connect_status == 0) {
-        cons_show("Connecting...");
+        cons_good_show("Connecting...");
         _conn_status = CONNECTING;
     }
     else { 
-        cons_show("XMPP connection failure");
+        cons_bad_show("XMPP connection failure");
         _conn_status = DISCONNECTED;
     }
 
@@ -154,7 +154,7 @@ static void _jabber_conn_handler(xmpp_conn_t * const conn,
         sprintf(line, "%s logged in successfully.", xmpp_conn_get_jid(conn));
         title_bar_connected();
 
-        cons_show(line);
+        cons_good_show(line);
         status_bar_print_message(xmpp_conn_get_jid(conn));
         status_bar_refresh();
 
@@ -170,7 +170,7 @@ static void _jabber_conn_handler(xmpp_conn_t * const conn,
         _conn_status = CONNECTED;
     }
     else {
-        cons_show("Login failed.");
+        cons_bad_show("Login failed.");
         log_msg(CONN, "disconnected");
         xmpp_stop(ctx);
         _conn_status = DISCONNECTED;
@@ -189,7 +189,7 @@ static int _roster_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz
         log_msg(CONN, "ERROR: query failed");
     else {
         query = xmpp_stanza_get_child_by_name(stanza, "query");
-        cons_show("Roster:");
+        cons_highlight_show("Roster:");
         for (item = xmpp_stanza_get_children(query); item; 
                 item = xmpp_stanza_get_next(item)) {
             if ((name = xmpp_stanza_get_attribute(item, "name"))) {
diff --git a/windows.c b/windows.c
index 61ffd1db..7b89e6f0 100644
--- a/windows.c
+++ b/windows.c
@@ -24,6 +24,7 @@ void gui_init(void)
         init_pair(3, COLOR_WHITE, COLOR_BLUE);
         init_pair(4, COLOR_CYAN, COLOR_BLUE);
         init_pair(5, COLOR_CYAN, COLOR_BLACK);
+        init_pair(6, COLOR_RED, COLOR_BLACK);
     }
 
     refresh();
@@ -180,8 +181,11 @@ void cons_help(void)
     char tstmp[80];
     get_time(tstmp);
 
-    wprintw(_wins[0].win, 
-        " [%s] Help:\n", tstmp);
+    wprintw(_wins[0].win, " [%s] ", tstmp);
+    wattron(_wins[0].win, A_BOLD);
+    wprintw(_wins[0].win, "Help:\n");
+    wattroff(_wins[0].win, A_BOLD);
+
     wprintw(_wins[0].win, 
         " [%s]   Commands:\n", tstmp);
     wprintw(_wins[0].win, 
@@ -204,6 +208,43 @@ void cons_help(void)
         " [%s]     F2-10                : Chat windows.\n", tstmp);
 }
 
+void cons_good_show(char *msg)
+{
+    char tstmp[80];
+    get_time(tstmp);
+   
+    wprintw(_wins[0].win, " [%s] ", tstmp);
+    wattron(_wins[0].win, A_BOLD);
+    wattron(_wins[0].win, COLOR_PAIR(2));
+    wprintw(_wins[0].win, "%s\n", msg);
+    wattroff(_wins[0].win, A_BOLD);
+    wattroff(_wins[0].win, COLOR_PAIR(2));
+}
+
+void cons_bad_show(char *msg)
+{
+    char tstmp[80];
+    get_time(tstmp);
+   
+    wprintw(_wins[0].win, " [%s] ", tstmp);
+    wattron(_wins[0].win, A_BOLD);
+    wattron(_wins[0].win, COLOR_PAIR(6));
+    wprintw(_wins[0].win, "%s\n", msg);
+    wattroff(_wins[0].win, A_BOLD);
+    wattroff(_wins[0].win, COLOR_PAIR(6));
+}
+
+void cons_highlight_show(char *msg)
+{
+    char tstmp[80];
+    get_time(tstmp);
+   
+    wprintw(_wins[0].win, " [%s] ", tstmp);
+    wattron(_wins[0].win, A_BOLD);
+    wprintw(_wins[0].win, "%s\n", msg);
+    wattroff(_wins[0].win, A_BOLD);
+}
+
 void cons_show(char *msg)
 {
     char tstmp[80];
@@ -252,7 +293,10 @@ static void _create_windows(void)
     char tstmp[80];
     get_time(tstmp);
     
-    wprintw(cons.win, " [%s] Welcome to Profanity.\n", tstmp);
+    wprintw(cons.win, " [%s] ", tstmp);
+    wattron(cons.win, A_BOLD);
+    wprintw(cons.win, "Welcome to Profanity.\n");
+    wattroff(cons.win, A_BOLD);
     touchwin(cons.win);
     wrefresh(cons.win);
     _wins[0] = cons;
diff --git a/windows.h b/windows.h
index 46e26ec8..a5abe763 100644
--- a/windows.h
+++ b/windows.h
@@ -40,6 +40,9 @@ void cons_bad_command(char *cmd);
 void cons_bad_connect(void);
 void cons_bad_message(void);
 void cons_show(char *cmd);
+void cons_good_show(char *cmd);
+void cons_bad_show(char *cmd);
+void cons_highlight_show(char *cmd);
 
 // status bar actions
 void status_bar_refresh(void);