summaryrefslogtreecommitdiff
path: root/testing/toxic/friendlist.c
diff options
context:
space:
mode:
authorJfreegman <Jfreegman@gmail.com>2013-08-05 18:07:08 -0400
committerJfreegman <Jfreegman@gmail.com>2013-08-05 18:07:08 -0400
commit3f712d2650937c78735375f9695d73a8dbc95a91 (patch)
treea1c2a14fcfa2d0af31888fb28ff9bc423565eb51 /testing/toxic/friendlist.c
parent16a74ffaf991ffed364fce823c1689eb68b26bc9 (diff)
bug fix and added wrapping on friends list
Diffstat (limited to 'testing/toxic/friendlist.c')
-rw-r--r--testing/toxic/friendlist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c
index 647f563d..a1f9851e 100644
--- a/testing/toxic/friendlist.c
+++ b/testing/toxic/friendlist.c
@@ -58,11 +58,11 @@ void friendlist_onMessage(ToxWindow* self, int num, uint8_t* str, uint16_t len)
58 for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; i++) { 58 for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; i++) {
59 if (WINDOW_STATUS[i] == -1) { 59 if (WINDOW_STATUS[i] == -1) {
60 WINDOW_STATUS[i] = num; 60 WINDOW_STATUS[i] = num;
61 add_window(new_chat(num_selected), i); 61 add_window(new_chat(num), i);
62 w_active = i; 62 w_active = i;
63 break; 63 break;
64 }
65 } 64 }
65 }
66 } 66 }
67} 67}
68 68
@@ -101,8 +101,9 @@ int friendlist_onFriendAdded(int num) {
101 101
102static void friendlist_onKey(ToxWindow* self, int key) { 102static void friendlist_onKey(ToxWindow* self, int key) {
103 if(key == KEY_UP) { 103 if(key == KEY_UP) {
104 if(num_selected != 0) 104 num_selected--;
105 num_selected--; 105 if (num_selected < 0)
106 num_selected = num_friends-1;
106 } 107 }
107 else if(key == KEY_DOWN) { 108 else if(key == KEY_DOWN) {
108 if(num_friends != 0) 109 if(num_friends != 0)