diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/Messenger_test.c | 8 | ||||
-rw-r--r-- | testing/nTox.c | 16 | ||||
-rw-r--r-- | testing/toxic/main.c | 20 |
3 files changed, 22 insertions, 22 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 51542c6d..fa5d6890 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -55,7 +55,7 @@ | |||
55 | * networking_requesthandler and so cannot take a Messenger * */ | 55 | * networking_requesthandler and so cannot take a Messenger * */ |
56 | static Messenger *m; | 56 | static Messenger *m; |
57 | 57 | ||
58 | void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | 58 | void print_request(uint8_t * public_key, uint8_t * data, uint16_t length, void* userdata) |
59 | { | 59 | { |
60 | printf("Friend request received from: \n"); | 60 | printf("Friend request received from: \n"); |
61 | printf("ClientID: "); | 61 | printf("ClientID: "); |
@@ -80,7 +80,7 @@ void print_request(uint8_t * public_key, uint8_t * data, uint16_t length) | |||
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void print_message(Messenger *m, int friendnumber, uint8_t * string, uint16_t length) | 83 | void print_message(Messenger *m, int friendnumber, uint8_t * string, uint16_t length, void* userdata) |
84 | { | 84 | { |
85 | printf("Message with length %u received from %u: %s \n", length, friendnumber, string); | 85 | printf("Message with length %u received from %u: %s \n", length, friendnumber, string); |
86 | m_sendmessage(m, friendnumber, (uint8_t*)"Test1", 6); | 86 | m_sendmessage(m, friendnumber, (uint8_t*)"Test1", 6); |
@@ -114,8 +114,8 @@ int main(int argc, char *argv[]) | |||
114 | fclose(file); | 114 | fclose(file); |
115 | 115 | ||
116 | } | 116 | } |
117 | m_callback_friendrequest(m, print_request); | 117 | m_callback_friendrequest(m, print_request, NULL); |
118 | m_callback_friendmessage(m, print_message); | 118 | m_callback_friendmessage(m, print_message, NULL); |
119 | 119 | ||
120 | printf("OUR ID: "); | 120 | printf("OUR ID: "); |
121 | uint32_t i; | 121 | uint32_t i; |
diff --git a/testing/nTox.c b/testing/nTox.c index 1322067e..59d1cbf6 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -336,7 +336,7 @@ void do_refresh() | |||
336 | refresh(); | 336 | refresh(); |
337 | } | 337 | } |
338 | 338 | ||
339 | void print_request(uint8_t *public_key, uint8_t *data, uint16_t length) | 339 | void print_request(uint8_t *public_key, uint8_t *data, uint16_t length, void* userdata) |
340 | { | 340 | { |
341 | new_lines("[i] received friend request with message:"); | 341 | new_lines("[i] received friend request with message:"); |
342 | new_lines((char *)data); | 342 | new_lines((char *)data); |
@@ -349,12 +349,12 @@ void print_request(uint8_t *public_key, uint8_t *data, uint16_t length) | |||
349 | do_refresh(); | 349 | do_refresh(); |
350 | } | 350 | } |
351 | 351 | ||
352 | void print_message(Messenger *m, int friendnumber, uint8_t * string, uint16_t length) | 352 | void print_message(Messenger *m, int friendnumber, uint8_t * string, uint16_t length, void* userdata) |
353 | { | 353 | { |
354 | new_lines(format_message(m, (char*)string, friendnumber)); | 354 | new_lines(format_message(m, (char*)string, friendnumber)); |
355 | } | 355 | } |
356 | 356 | ||
357 | void print_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | 357 | void print_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void* userdata) |
358 | { | 358 | { |
359 | char name[MAX_NAME_LENGTH]; | 359 | char name[MAX_NAME_LENGTH]; |
360 | if(getname(m, friendnumber, (uint8_t*)name) != -1) { | 360 | if(getname(m, friendnumber, (uint8_t*)name) != -1) { |
@@ -364,7 +364,7 @@ void print_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t | |||
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | void print_statuschange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | 367 | void print_statuschange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void* userdata) |
368 | { | 368 | { |
369 | char name[MAX_NAME_LENGTH]; | 369 | char name[MAX_NAME_LENGTH]; |
370 | if(getname(m, friendnumber, (uint8_t*)name) != -1) { | 370 | if(getname(m, friendnumber, (uint8_t*)name) != -1) { |
@@ -467,10 +467,10 @@ int main(int argc, char *argv[]) | |||
467 | 467 | ||
468 | load_key(m, filename); | 468 | load_key(m, filename); |
469 | 469 | ||
470 | m_callback_friendrequest(m, print_request); | 470 | m_callback_friendrequest(m, print_request, NULL); |
471 | m_callback_friendmessage(m, print_message); | 471 | m_callback_friendmessage(m, print_message, NULL); |
472 | m_callback_namechange(m, print_nickchange); | 472 | m_callback_namechange(m, print_nickchange, NULL); |
473 | m_callback_statusmessage(m, print_statuschange); | 473 | m_callback_statusmessage(m, print_statuschange, NULL); |
474 | 474 | ||
475 | initscr(); | 475 | initscr(); |
476 | noecho(); | 476 | noecho(); |
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index b6eadf2e..397f9391 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -46,7 +46,7 @@ int w_num; | |||
46 | int active_window; | 46 | int active_window; |
47 | 47 | ||
48 | /* CALLBACKS START */ | 48 | /* CALLBACKS START */ |
49 | void on_request(uint8_t *public_key, uint8_t *data, uint16_t length) | 49 | void on_request(uint8_t *public_key, uint8_t *data, uint16_t length, void* userdata) |
50 | { | 50 | { |
51 | int n = add_req(public_key); | 51 | int n = add_req(public_key); |
52 | wprintw(prompt->window, "\nFriend request from:\n"); | 52 | wprintw(prompt->window, "\nFriend request from:\n"); |
@@ -65,7 +65,7 @@ void on_request(uint8_t *public_key, uint8_t *data, uint16_t length) | |||
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | void on_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | 68 | void on_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void* userdata) |
69 | { | 69 | { |
70 | int i; | 70 | int i; |
71 | for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { | 71 | for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { |
@@ -74,7 +74,7 @@ void on_message(Messenger *m, int friendnumber, uint8_t *string, uint16_t length | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | void on_action(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | 77 | void on_action(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void* userdata) |
78 | { | 78 | { |
79 | int i; | 79 | int i; |
80 | for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { | 80 | for (i = 0; i < MAX_WINDOW_SLOTS; ++i) { |
@@ -83,7 +83,7 @@ void on_action(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | void on_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | 86 | void on_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void* userdata) |
87 | { | 87 | { |
88 | wprintw(prompt->window, "\n(nickchange) %d: %s\n", friendnumber, string); | 88 | wprintw(prompt->window, "\n(nickchange) %d: %s\n", friendnumber, string); |
89 | int i; | 89 | int i; |
@@ -93,7 +93,7 @@ void on_nickchange(Messenger *m, int friendnumber, uint8_t *string, uint16_t len | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | void on_statuschange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length) | 96 | void on_statuschange(Messenger *m, int friendnumber, uint8_t *string, uint16_t length, void* userdata) |
97 | { | 97 | { |
98 | wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); | 98 | wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); |
99 | int i; | 99 | int i; |
@@ -134,11 +134,11 @@ static void init_tox() | |||
134 | m = initMessenger(); | 134 | m = initMessenger(); |
135 | 135 | ||
136 | /* Callbacks */ | 136 | /* Callbacks */ |
137 | m_callback_friendrequest(m, on_request); | 137 | m_callback_friendrequest(m, on_request, NULL); |
138 | m_callback_friendmessage(m, on_message); | 138 | m_callback_friendmessage(m, on_message, NULL); |
139 | m_callback_namechange(m, on_nickchange); | 139 | m_callback_namechange(m, on_nickchange, NULL); |
140 | m_callback_statusmessage(m, on_statuschange); | 140 | m_callback_statusmessage(m, on_statuschange, NULL); |
141 | m_callback_action(m, on_action); | 141 | m_callback_action(m, on_action, NULL); |
142 | } | 142 | } |
143 | 143 | ||
144 | #define MAXLINE 90 /* Approx max number of chars in a sever line (IP + port + key) */ | 144 | #define MAXLINE 90 /* Approx max number of chars in a sever line (IP + port + key) */ |