diff options
author | James Booth <boothj5@gmail.com> | 2012-10-28 02:52:52 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-10-28 02:52:52 +0000 |
commit | 6318cd91ba0fee532490672a3995567b18b58599 (patch) | |
tree | dd46fb812cdaeb2619880baeb24afcd9b50f5307 /src | |
parent | e4c389cc51c6bf08836308bb4c3e4fa715a1fe65 (diff) | |
download | profani-tty-6318cd91ba0fee532490672a3995567b18b58599.tar.gz |
Added /me handling in logs
Diffstat (limited to 'src')
-rw-r--r-- | src/chat_log.c | 12 | ||||
-rw-r--r-- | src/windows.c | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/chat_log.c b/src/chat_log.c index 2e53dfc7..5ea40911 100644 --- a/src/chat_log.c +++ b/src/chat_log.c @@ -80,9 +80,17 @@ chat_log_chat(const gchar * const login, gchar *other, FILE *logp = fopen(dated_log->filename, "a"); if (direction == IN) { - fprintf(logp, "%s - %s: %s\n", date_fmt, other_copy, msg); + if (strncmp(msg, "/me ", 4) == 0) { + fprintf(logp, "%s - *%s %s\n", date_fmt, other_copy, msg + 4); + } else { + fprintf(logp, "%s - %s: %s\n", date_fmt, other_copy, msg); + } } else { - fprintf(logp, "%s - me: %s\n", date_fmt, msg); + if (strncmp(msg, "/me ", 4) == 0) { + fprintf(logp, "%s - *me %s\n", date_fmt, msg + 4); + } else { + fprintf(logp, "%s - me: %s\n", date_fmt, msg); + } } fflush(logp); int result = fclose(logp); diff --git a/src/windows.c b/src/windows.c index 6aea74ca..f1c8f0fe 100644 --- a/src/windows.c +++ b/src/windows.c @@ -440,8 +440,16 @@ win_show_outgoing_msg(const char * const from, const char * const to, } _win_show_time(win); - _win_show_user(win, from, 0); - _win_show_message(win, message); + if (strncmp(message, "/me ", 4) == 0) { + wattron(win, COLOUR_ONLINE); + wprintw(win, "*%s ", from); + wprintw(win, message + 4); + wprintw(win, "\n"); + wattroff(win, COLOUR_ONLINE); + } else { + _win_show_user(win, from, 1); + _win_show_message(win, message); + } _win_switch_if_active(win_index); } |