diff options
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r-- | testing/toxic/prompt.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index b1d6693f..bc4b8545 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -11,11 +11,12 @@ | |||
11 | #include "../../core/network.h" | 11 | #include "../../core/network.h" |
12 | 12 | ||
13 | #include "windows.h" | 13 | #include "windows.h" |
14 | #include "prompt.h" | ||
14 | 15 | ||
15 | uint8_t pending_requests[MAX_STR_SIZE][CLIENT_ID_SIZE]; // XXX | 16 | uint8_t pending_requests[MAX_STR_SIZE][CLIENT_ID_SIZE]; // XXX |
16 | uint8_t num_requests=0; // XXX | 17 | uint8_t num_requests=0; // XXX |
17 | 18 | ||
18 | extern void on_friendadded(int friendnumber); | 19 | static friendAddedFn *on_friendadded; |
19 | static char prompt_buf[MAX_STR_SIZE] = {0}; | 20 | static char prompt_buf[MAX_STR_SIZE] = {0}; |
20 | static int prompt_buf_pos = 0; | 21 | static int prompt_buf_pos = 0; |
21 | 22 | ||
@@ -87,7 +88,7 @@ void cmd_accept(ToxWindow *self, Messenger *m, char **args) | |||
87 | wprintw(self->window, "Failed to add friend.\n"); | 88 | wprintw(self->window, "Failed to add friend.\n"); |
88 | else { | 89 | else { |
89 | wprintw(self->window, "Friend accepted as: %d.\n", num); | 90 | wprintw(self->window, "Friend accepted as: %d.\n", num); |
90 | on_friendadded(num); | 91 | on_friendadded(m, num); |
91 | } | 92 | } |
92 | } | 93 | } |
93 | 94 | ||
@@ -146,7 +147,7 @@ void cmd_add(ToxWindow *self, Messenger *m, char **args) | |||
146 | break; | 147 | break; |
147 | default: | 148 | default: |
148 | wprintw(self->window, "Friend added as %d.\n", num); | 149 | wprintw(self->window, "Friend added as %d.\n", num); |
149 | on_friendadded(num); | 150 | on_friendadded(m, num); |
150 | break; | 151 | break; |
151 | } | 152 | } |
152 | } | 153 | } |
@@ -428,8 +429,9 @@ static void prompt_onInit(ToxWindow *self, Messenger *m) | |||
428 | wclrtoeol(self->window); | 429 | wclrtoeol(self->window); |
429 | } | 430 | } |
430 | 431 | ||
431 | ToxWindow new_prompt() | 432 | ToxWindow new_prompt(friendAddedFn *f) |
432 | { | 433 | { |
434 | on_friendadded = f; | ||
433 | ToxWindow ret; | 435 | ToxWindow ret; |
434 | memset(&ret, 0, sizeof(ret)); | 436 | memset(&ret, 0, sizeof(ret)); |
435 | ret.onKey = &prompt_onKey; | 437 | ret.onKey = &prompt_onKey; |