summaryrefslogtreecommitdiff
path: root/testing/toxic/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/toxic/prompt.c')
-rw-r--r--testing/toxic/prompt.c10
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
15uint8_t pending_requests[MAX_STR_SIZE][CLIENT_ID_SIZE]; // XXX 16uint8_t pending_requests[MAX_STR_SIZE][CLIENT_ID_SIZE]; // XXX
16uint8_t num_requests=0; // XXX 17uint8_t num_requests=0; // XXX
17 18
18extern void on_friendadded(int friendnumber); 19static friendAddedFn *on_friendadded;
19static char prompt_buf[MAX_STR_SIZE] = {0}; 20static char prompt_buf[MAX_STR_SIZE] = {0};
20static int prompt_buf_pos = 0; 21static 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
431ToxWindow new_prompt() 432ToxWindow 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;