diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | input_bar.c | 14 | ||||
-rw-r--r-- | input_win.c | 4 | ||||
-rw-r--r-- | profanity.c | 2 | ||||
-rw-r--r-- | windows.c | 4 | ||||
-rw-r--r-- | windows.h | 4 |
6 files changed, 25 insertions, 5 deletions
diff --git a/Makefile b/Makefile index dfcef035..7366a54a 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ profanity: $(OBJS) log.o: log.h windows.o: windows.h util.h title_bar.o: windows.h -input_bar.o: windows.h +input_bar.o: windows.h util.h input_win.o: windows.h jabber.o: jabber.h log.h windows.h profanity.o: log.h windows.h jabber.h command.h diff --git a/input_bar.c b/input_bar.c index 3d44e69b..a774f4e8 100644 --- a/input_bar.c +++ b/input_bar.c @@ -1,5 +1,6 @@ #include <ncurses.h> #include "windows.h" +#include "util.h" static WINDOW *inp_bar; @@ -30,7 +31,18 @@ void inp_bar_active(int win) void inp_bar_print_message(char *msg) { - mvwprintw(inp_bar, 0, 0, msg); + mvwprintw(inp_bar, 0, 9, msg); wrefresh(inp_bar); } +void inp_bar_update_time(void) +{ + char bar_time[8]; + char tstmp[80]; + get_time(tstmp); + sprintf(bar_time, "[%s]", tstmp); + + mvwprintw(inp_bar, 0, 1, bar_time); + wrefresh(inp_bar); + inp_put_back(); +} diff --git a/input_win.c b/input_win.c index 76ec2829..22154065 100644 --- a/input_win.c +++ b/input_win.c @@ -82,3 +82,7 @@ void inp_get_password(char *passwd) echo(); } +void inp_put_back(void) +{ + wrefresh(inp_win); +} diff --git a/profanity.c b/profanity.c index 2002810d..d627747a 100644 --- a/profanity.c +++ b/profanity.c @@ -57,6 +57,8 @@ static void profanity_event_loop(int *ch, char *cmd, int *size) { usleep(1); + inp_bar_update_time(); + // handle incoming messages jabber_process_events(); diff --git a/windows.c b/windows.c index 161319a4..60c4201a 100644 --- a/windows.c +++ b/windows.c @@ -86,7 +86,7 @@ void show_incomming_msg(char *from, char *message) char tstmp[80]; get_time(tstmp); - sprintf(line, " [%s] %s: %s\n", tstmp, short_from, message); + sprintf(line, " [%s] <%s> %s\n", tstmp, short_from, message); // find the chat window for sender int i; @@ -136,7 +136,7 @@ void show_outgoing_msg(char *from, char *to, char *message) char line[100]; char tstmp[80]; get_time(tstmp); - sprintf(line, " [%s] %s: %s\n", tstmp, from, message); + sprintf(line, " [%s] <%s> %s\n", tstmp, from, message); // find the chat window for recipient int i; diff --git a/windows.h b/windows.h index a9a20188..038004d7 100644 --- a/windows.h +++ b/windows.h @@ -14,16 +14,18 @@ void create_input_bar(void); void create_input_window(void); // input bar actions +void inp_bar_print_message(char *msg); void inp_bar_inactive(int win); void inp_bar_active(int win); +void inp_bar_update_time(void); // input window actions void inp_get_command_str(char *cmd); void inp_poll_char(int *ch, char command[], int *size); void inp_clear(void); +void inp_put_back(void); void inp_non_block(void); void inp_get_password(char *passwd); -void inp_bar_print_message(char *msg); void gui_init(void); void gui_close(void); |