1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-03 20:17:46 +02:00

bug fix and remove redundant code

This commit is contained in:
Jfreegman 2013-09-06 00:56:55 -04:00
parent 3ddae51998
commit ba7d01d3c1
2 changed files with 6 additions and 9 deletions

View File

@ -81,7 +81,6 @@ void chat_onConnectionChange(ToxWindow *self, Tox *m, int num, uint8_t status)
StatusBar *statusbar = (StatusBar *) self->s; StatusBar *statusbar = (StatusBar *) self->s;
statusbar->is_online = status == 1 ? true : false; statusbar->is_online = status == 1 ? true : false;
} }
static void chat_onAction(ToxWindow *self, Tox *m, int num, uint8_t *action, uint16_t len) static void chat_onAction(ToxWindow *self, Tox *m, int num, uint8_t *action, uint16_t len)
@ -425,9 +424,6 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
wmove(statusbar->topline, 0, 0); wmove(statusbar->topline, 0, 0);
/* Draw name, status and note in statusbar */ /* Draw name, status and note in statusbar */
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
snprintf(nick, sizeof(nick), "%s", self->name);
if (statusbar->is_online) { if (statusbar->is_online) {
char *status_text = "Unknown"; char *status_text = "Unknown";
int colour = WHITE; int colour = WHITE;
@ -449,17 +445,17 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
break; break;
} }
wattron(statusbar->topline, A_BOLD); wattron(statusbar->topline, A_BOLD);
wprintw(statusbar->topline, "%s", nick); wprintw(statusbar->topline, " %s ", self->name);
wattroff(statusbar->topline, A_BOLD); wattroff(statusbar->topline, A_BOLD);
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD); wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
wprintw(statusbar->topline, " [%s]", status_text); wprintw(statusbar->topline, "[%s]", status_text);
wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD); wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
} else { } else {
wattron(statusbar->topline, A_BOLD); wattron(statusbar->topline, A_BOLD);
wprintw(statusbar->topline, "%s", nick); wprintw(statusbar->topline, " %s ", self->name);
wattroff(statusbar->topline, A_BOLD); wattroff(statusbar->topline, A_BOLD);
wprintw(statusbar->topline, " [Offline]"); wprintw(statusbar->topline, "[Offline]");
} }
if (statusbar->statusmsg[0]) if (statusbar->statusmsg[0])

View File

@ -124,7 +124,8 @@ static void select_friend(Tox *m, wint_t key)
} }
} }
} else if (key == KEY_DOWN) { } else if (key == KEY_DOWN) {
while ((n = (n + 1) % num_friends) != num_selected) { while (++n != num_selected) {
n = n % num_friends;
if (friends[n].active) { if (friends[n].active) {
num_selected = n; num_selected = n;
return; return;