1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added /me handling in logs

This commit is contained in:
James Booth 2012-10-28 02:52:52 +00:00
parent e4c389cc51
commit 6318cd91ba
2 changed files with 20 additions and 4 deletions

View File

@ -80,10 +80,18 @@ chat_log_chat(const gchar * const login, gchar *other,
FILE *logp = fopen(dated_log->filename, "a"); FILE *logp = fopen(dated_log->filename, "a");
if (direction == IN) { if (direction == IN) {
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); fprintf(logp, "%s - %s: %s\n", date_fmt, other_copy, msg);
}
} else {
if (strncmp(msg, "/me ", 4) == 0) {
fprintf(logp, "%s - *me %s\n", date_fmt, msg + 4);
} else { } else {
fprintf(logp, "%s - me: %s\n", date_fmt, msg); fprintf(logp, "%s - me: %s\n", date_fmt, msg);
} }
}
fflush(logp); fflush(logp);
int result = fclose(logp); int result = fclose(logp);
if (result == EOF) { if (result == EOF) {

View File

@ -440,8 +440,16 @@ win_show_outgoing_msg(const char * const from, const char * const to,
} }
_win_show_time(win); _win_show_time(win);
_win_show_user(win, from, 0); 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_show_message(win, message);
}
_win_switch_if_active(win_index); _win_switch_if_active(win_index);
} }