1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 02:33:02 +01:00

bug fix and added wrapping on friends list

This commit is contained in:
Jfreegman 2013-08-05 18:07:08 -04:00
parent 3d0b16c681
commit 9b7dafc16f

View File

@ -58,7 +58,7 @@ void friendlist_onMessage(ToxWindow* self, int num, uint8_t* str, uint16_t len)
for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; i++) { for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; i++) {
if (WINDOW_STATUS[i] == -1) { if (WINDOW_STATUS[i] == -1) {
WINDOW_STATUS[i] = num; WINDOW_STATUS[i] = num;
add_window(new_chat(num_selected), i); add_window(new_chat(num), i);
w_active = i; w_active = i;
break; break;
} }
@ -101,8 +101,9 @@ int friendlist_onFriendAdded(int num) {
static void friendlist_onKey(ToxWindow* self, int key) { static void friendlist_onKey(ToxWindow* self, int key) {
if(key == KEY_UP) { if(key == KEY_UP) {
if(num_selected != 0)
num_selected--; num_selected--;
if (num_selected < 0)
num_selected = num_friends-1;
} }
else if(key == KEY_DOWN) { else if(key == KEY_DOWN) {
if(num_friends != 0) if(num_friends != 0)