diff --git a/core/Messenger.c b/core/Messenger.c index 5532c9cc..4e994a15 100644 --- a/core/Messenger.c +++ b/core/Messenger.c @@ -116,8 +116,8 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length) return FAERR_ALREADYSENT; uint32_t i; - for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ - if(friendlist[i].status == NOFRIEND) { + for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ + if (friendlist[i].status == NOFRIEND) { DHT_addfriend(client_id); friendlist[i].status = FRIEND_ADDED; friendlist[i].crypt_connection_id = -1; @@ -141,7 +141,7 @@ int m_addfriend_norequest(uint8_t * client_id) if (getfriend_id(client_id) != -1) return -1; uint32_t i; - for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ + for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ if(friendlist[i].status == NOFRIEND) { DHT_addfriend(client_id); friendlist[i].status = FRIEND_REQUESTED; diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 1ba8b6c9..44430653 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c @@ -249,6 +249,7 @@ static void load_data(char *path) static void draw_bar() { static int odd = 0; + int blinkrate = 30; attron(COLOR_PAIR(4)); mvhline(LINES - 2, 0, '_', COLS); @@ -266,14 +267,13 @@ static void draw_bar() if (i == active_window) attron(A_BOLD); - odd = (odd+1) % 10; - if (windows[i].blink && (odd < 5)) { + odd = (odd+1) % blinkrate; + if (windows[i].blink && (odd < (blinkrate/2))) { attron(COLOR_PAIR(3)); } - printw(" %s", windows[i].title); if (windows[i].blink && (odd < 5)) { - attron(COLOR_PAIR(3)); + attroff(COLOR_PAIR(3)); } if (i == active_window) { attroff(A_BOLD); @@ -375,9 +375,8 @@ int main(int argc, char *argv[]) ch = getch(); if (ch == '\t' || ch == KEY_BTAB) set_active_window(ch); - else if (ch != ERR) { + else if (ch != ERR) a->onKey(a, ch); - } } return 0; }