summaryrefslogtreecommitdiff
path: root/testing/toxic/windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic/windows.c')
-rw-r--r--testing/toxic/windows.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/testing/toxic/windows.c b/testing/toxic/windows.c
index a8efa066..80d64287 100644
--- a/testing/toxic/windows.c
+++ b/testing/toxic/windows.c
@@ -6,7 +6,7 @@
6extern char *DATA_FILE; 6extern char *DATA_FILE;
7extern int store_data(Messenger *m, char *path); 7extern int store_data(Messenger *m, char *path);
8 8
9static ToxWindow windows[MAX_WINDOW_SLOTS]; 9static ToxWindow windows[MAX_WINDOWS_NUM];
10static ToxWindow *active_window; 10static ToxWindow *active_window;
11static ToxWindow *prompt; 11static ToxWindow *prompt;
12static Messenger *m; 12static Messenger *m;
@@ -26,7 +26,7 @@ void on_request(uint8_t *public_key, uint8_t *data, uint16_t length, void *userd
26 wprintw(prompt->window, "\nWith the message: %s\n", data); 26 wprintw(prompt->window, "\nWith the message: %s\n", data);
27 wprintw(prompt->window, "\nUse \"accept %d\" to accept it.\n", n); 27 wprintw(prompt->window, "\nUse \"accept %d\" to accept it.\n", n);
28 28
29 for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { 29 for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
30 if (windows[i].onFriendRequest != NULL) 30 if (windows[i].onFriendRequest != NULL)
31 windows[i].onFriendRequest(&windows[i], public_key, data, length); 31 windows[i].onFriendRequest(&windows[i], public_key, data, length);
32 } 32 }
@@ -36,7 +36,7 @@ void on_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t length
36{ 36{
37 int i; 37 int i;
38 38
39 for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { 39 for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
40 if (windows[i].onMessage != NULL) 40 if (windows[i].onMessage != NULL)
41 windows[i].onMessage(&windows[i], m, friendnumber, string, length); 41 windows[i].onMessage(&windows[i], m, friendnumber, string, length);
42 } 42 }
@@ -46,7 +46,7 @@ void on_action(Messenger *m, int friendnumber, uint8_t *string, uint16_t length,
46{ 46{
47 int i; 47 int i;
48 48
49 for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { 49 for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
50 if (windows[i].onAction != NULL) 50 if (windows[i].onAction != NULL)
51 windows[i].onAction(&windows[i], m, friendnumber, string, length); 51 windows[i].onAction(&windows[i], m, friendnumber, string, length);
52 } 52 }
@@ -57,7 +57,7 @@ void on_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t len
57 wprintw(prompt->window, "\n(nickchange) %d: %s\n", friendnumber, string); 57 wprintw(prompt->window, "\n(nickchange) %d: %s\n", friendnumber, string);
58 int i; 58 int i;
59 59
60 for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { 60 for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
61 if (windows[i].onNickChange != NULL) 61 if (windows[i].onNickChange != NULL)
62 windows[i].onNickChange(&windows[i], friendnumber, string, length); 62 windows[i].onNickChange(&windows[i], friendnumber, string, length);
63 } 63 }
@@ -68,7 +68,7 @@ void on_statuschange(Messenger *m, int friendnumber, uint8_t *string, uint16_t l
68 wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); 68 wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string);
69 int i; 69 int i;
70 70
71 for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { 71 for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
72 if (windows[i].onStatusChange != NULL) 72 if (windows[i].onStatusChange != NULL)
73 windows[i].onStatusChange(&windows[i], friendnumber, string, length); 73 windows[i].onStatusChange(&windows[i], friendnumber, string, length);
74 } 74 }
@@ -90,7 +90,7 @@ int add_window(Messenger *m, ToxWindow w)
90 return -1; 90 return -1;
91 91
92 int i; 92 int i;
93 for(i = 0; i < MAX_WINDOW_SLOTS; i++) { 93 for(i = 0; i < MAX_WINDOWS_NUM; i++) {
94 if (windows[i].window) 94 if (windows[i].window)
95 continue; 95 continue;
96 96
@@ -124,7 +124,7 @@ void del_window(ToxWindow *w)
124/* Shows next window when tab or back-tab is pressed */ 124/* Shows next window when tab or back-tab is pressed */
125void set_next_window(int ch) 125void set_next_window(int ch)
126{ 126{
127 ToxWindow *end = windows+MAX_WINDOW_SLOTS-1; 127 ToxWindow *end = windows+MAX_WINDOWS_NUM-1;
128 ToxWindow *inf = active_window; 128 ToxWindow *inf = active_window;
129 while(true) { 129 while(true) {
130 if (ch == '\t') { 130 if (ch == '\t') {
@@ -146,7 +146,7 @@ void set_next_window(int ch)
146 146
147void set_active_window(int index) 147void set_active_window(int index)
148{ 148{
149 if (index < 0 || index >= MAX_WINDOW_SLOTS) 149 if (index < 0 || index >= MAX_WINDOWS_NUM)
150 return; 150 return;
151 151
152 active_window = windows+index; 152 active_window = windows+index;
@@ -187,7 +187,7 @@ static void draw_bar()
187 187
188 int i; 188 int i;
189 189
190 for (i = 0; i < (MAX_WINDOW_SLOTS); ++i) { 190 for (i = 0; i < (MAX_WINDOWS_NUM); ++i) {
191 if (windows[i].window) { 191 if (windows[i].window) {
192 if (windows+i == active_window) 192 if (windows+i == active_window)
193 attron(A_BOLD); 193 attron(A_BOLD);