1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-26 20:57:48 +02:00

a few aesthetic changes

This commit is contained in:
Jfreegman 2013-12-08 05:45:23 -05:00
parent df57adcc6d
commit 5fc14a48db
2 changed files with 6 additions and 10 deletions

View File

@ -100,7 +100,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
/* check if message contains own name and alert appropriately */ /* check if message contains own name and alert appropriately */
int alert_type = WINDOW_ALERT_1; int alert_type = WINDOW_ALERT_1;
bool beep = false; bool beep = false;
int msg_clr = WHITE; int nick_clr = CYAN;
uint8_t selfnick[TOX_MAX_NAME_LENGTH] = {'\0'}; uint8_t selfnick[TOX_MAX_NAME_LENGTH] = {'\0'};
tox_get_self_name(m, selfnick, TOX_MAX_NAME_LENGTH); tox_get_self_name(m, selfnick, TOX_MAX_NAME_LENGTH);
@ -110,7 +110,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
if (nick_match) { if (nick_match) {
alert_type = WINDOW_ALERT_0; alert_type = WINDOW_ALERT_0;
beep = true; beep = true;
msg_clr = RED; nick_clr = RED;
} }
alert_window(self, alert_type, beep); alert_window(self, alert_type, beep);
@ -120,18 +120,16 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
nick[TOXIC_MAX_NAME_LENGTH] = '\0'; /* enforce client max name length */ nick[TOXIC_MAX_NAME_LENGTH] = '\0'; /* enforce client max name length */
print_time(ctx->history); print_time(ctx->history);
wattron(ctx->history, COLOR_PAIR(CYAN)); wattron(ctx->history, COLOR_PAIR(nick_clr));
wprintw(ctx->history, "%s: ", nick); wprintw(ctx->history, "%s: ", nick);
wattroff(ctx->history, COLOR_PAIR(CYAN)); wattroff(ctx->history, COLOR_PAIR(nick_clr));
if (msg[0] == '>' && !nick_match) { if (msg[0] == '>') {
wattron(ctx->history, COLOR_PAIR(GREEN)); wattron(ctx->history, COLOR_PAIR(GREEN));
wprintw(ctx->history, "%s\n", msg); wprintw(ctx->history, "%s\n", msg);
wattroff(ctx->history, COLOR_PAIR(GREEN)); wattroff(ctx->history, COLOR_PAIR(GREEN));
} else { } else {
wattron(ctx->history, COLOR_PAIR(msg_clr));
wprintw(ctx->history, "%s\n", msg); wprintw(ctx->history, "%s\n", msg);
wattroff(ctx->history, COLOR_PAIR(msg_clr));
} }
} }
@ -205,12 +203,10 @@ static void groupchat_onGroupNamelistChange(ToxWindow *self, Tox *m, int groupnu
wattroff(ctx->history, COLOR_PAIR(GREEN)); wattroff(ctx->history, COLOR_PAIR(GREEN));
break; break;
case TOX_CHAT_CHANGE_PEER_DEL: case TOX_CHAT_CHANGE_PEER_DEL:
wattron(ctx->history, COLOR_PAIR(RED));
wattron(ctx->history, A_BOLD); wattron(ctx->history, A_BOLD);
wprintw(ctx->history, "* %s", oldpeername); wprintw(ctx->history, "* %s", oldpeername);
wattroff(ctx->history, A_BOLD); wattroff(ctx->history, A_BOLD);
wprintw(ctx->history, " has left the room\n"); wprintw(ctx->history, " has left the room\n");
wattroff(ctx->history, COLOR_PAIR(RED));
if (groupchats[self->num].side_pos > 0) if (groupchats[self->num].side_pos > 0)
--groupchats[self->num].side_pos; --groupchats[self->num].side_pos;

View File

@ -74,4 +74,4 @@ void reset_buf(wchar_t *buf, size_t *pos, size_t *len);
in the list, and size is the size of each item in the list. in the list, and size is the size of each item in the list.
Returns the difference between the old len and new len of buf on success, -1 if error */ Returns the difference between the old len and new len of buf on success, -1 if error */
int complete_line(wchar_t *buf, size_t *pos, size_t *len, const uint8_t *list, int n_items, int size); int complete_line(wchar_t *buf, size_t *pos, size_t *len, const uint8_t *list, int n_items, int size);