summaryrefslogtreecommitdiff
path: root/testing/toxic/friendlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic/friendlist.c')
-rw-r--r--testing/toxic/friendlist.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c
index 56061cf9..e7504fbf 100644
--- a/testing/toxic/friendlist.c
+++ b/testing/toxic/friendlist.c
@@ -11,12 +11,9 @@
11#include "../../core/network.h" 11#include "../../core/network.h"
12 12
13#include "windows.h" 13#include "windows.h"
14#include "friendlist.h"
14 15
15extern char WINDOW_STATUS[TOXWINDOWS_MAX_NUM]; 16static char * WINDOW_STATUS;
16extern int add_window(ToxWindow w, int n);
17extern ToxWindow new_chat(Messenger *m, int friendnum);
18
19extern int active_window;
20 17
21typedef struct { 18typedef struct {
22 uint8_t name[MAX_NAME_LENGTH]; 19 uint8_t name[MAX_NAME_LENGTH];
@@ -54,8 +51,7 @@ void friendlist_onMessage(ToxWindow *self, Messenger *m, int num, uint8_t *str,
54 for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; ++i) { 51 for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; ++i) {
55 if (WINDOW_STATUS[i] == -1) { 52 if (WINDOW_STATUS[i] == -1) {
56 WINDOW_STATUS[i] = num; 53 WINDOW_STATUS[i] = num;
57 add_window(new_chat(m, num), i); 54 add_window(m, new_chat(m, num), i);
58 active_window = i;
59 break; 55 break;
60 } 56 }
61 } 57 }
@@ -111,7 +107,7 @@ static void friendlist_onKey(ToxWindow *self, Messenger *m, int key)
111 int i; 107 int i;
112 for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; ++i) { 108 for (i = N_DEFAULT_WINS; i < MAX_WINDOW_SLOTS; ++i) {
113 if (WINDOW_STATUS[i] == num_selected) { 109 if (WINDOW_STATUS[i] == num_selected) {
114 active_window = i; 110 set_active_window(i);
115 break; 111 break;
116 } 112 }
117 } 113 }
@@ -121,8 +117,7 @@ static void friendlist_onKey(ToxWindow *self, Messenger *m, int key)
121 if (WINDOW_STATUS[i] == -1) { 117 if (WINDOW_STATUS[i] == -1) {
122 WINDOW_STATUS[i] = num_selected; 118 WINDOW_STATUS[i] = num_selected;
123 friends[num_selected].chatwin = num_selected; 119 friends[num_selected].chatwin = num_selected;
124 add_window(new_chat(m, num_selected), i); 120 add_window(m, new_chat(m, num_selected), i);
125 active_window = i;
126 break; 121 break;
127 } 122 }
128 } 123 }
@@ -169,7 +164,8 @@ static void friendlist_onInit(ToxWindow *self, Messenger *m)
169 164
170} 165}
171 166
172ToxWindow new_friendlist() { 167ToxWindow new_friendlist(char * ws) {
168 WINDOW_STATUS = ws;
173 ToxWindow ret; 169 ToxWindow ret;
174 memset(&ret, 0, sizeof(ret)); 170 memset(&ret, 0, sizeof(ret));
175 171