1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-29 19:56:07 -04: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,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);

View File

@ -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);
}