summaryrefslogtreecommitdiff
path: root/testing/irc_syncbot.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/irc_syncbot.c')
-rw-r--r--testing/irc_syncbot.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c
index f7486115..df9e964c 100644
--- a/testing/irc_syncbot.c
+++ b/testing/irc_syncbot.c
@@ -89,7 +89,7 @@ static void callback_group_invite(Tox *tox, int fid, uint8_t type, const uint8_t
89 current_group = tox_join_groupchat(tox, fid, data, length); 89 current_group = tox_join_groupchat(tox, fid, data, length);
90} 90}
91 91
92void callback_friend_message(Tox *tox, int fid, const uint8_t *message, uint16_t length, void *userdata) 92void callback_friend_message(Tox *tox, uint32_t fid, const uint8_t *message, size_t length, void *userdata)
93{ 93{
94 if (length == 1 && *message == 'c') { 94 if (length == 1 && *message == 'c') {
95 if (tox_del_groupchat(tox, current_group) == 0) 95 if (tox_del_groupchat(tox, current_group) == 0)
@@ -203,7 +203,7 @@ void send_irc_group(Tox *tox, uint8_t *msg, uint16_t len)
203 203
204Tox *init_tox(int argc, char *argv[]) 204Tox *init_tox(int argc, char *argv[])
205{ 205{
206 uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ 206 uint8_t ipv6enabled = 1; /* x */
207 int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled); 207 int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled);
208 208
209 if (argvoffset < 0) 209 if (argvoffset < 0)
@@ -215,12 +215,12 @@ Tox *init_tox(int argc, char *argv[])
215 exit(0); 215 exit(0);
216 } 216 }
217 217
218 Tox *tox = tox_new(0); 218 Tox *tox = tox_new(0, 0, 0, 0);
219 219
220 if (!tox) 220 if (!tox)
221 exit(1); 221 exit(1);
222 222
223 tox_set_name(tox, (uint8_t *)IRC_NAME, sizeof(IRC_NAME) - 1); 223 tox_self_set_name(tox, (uint8_t *)IRC_NAME, sizeof(IRC_NAME) - 1, 0);
224 tox_callback_friend_message(tox, &callback_friend_message, 0); 224 tox_callback_friend_message(tox, &callback_friend_message, 0);
225 tox_callback_group_invite(tox, &callback_group_invite, 0); 225 tox_callback_group_invite(tox, &callback_group_invite, 0);
226 tox_callback_group_message(tox, &copy_groupmessage, 0); 226 tox_callback_group_message(tox, &copy_groupmessage, 0);
@@ -228,7 +228,7 @@ Tox *init_tox(int argc, char *argv[])
228 228
229 uint16_t port = atoi(argv[argvoffset + 2]); 229 uint16_t port = atoi(argv[argvoffset + 2]);
230 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); 230 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
231 int res = tox_bootstrap_from_address(tox, argv[argvoffset + 1], port, binary_string); 231 tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0);
232 free(binary_string); 232 free(binary_string);
233 233
234 char temp_id[128]; 234 char temp_id[128];
@@ -239,10 +239,10 @@ Tox *init_tox(int argc, char *argv[])
239 } 239 }
240 240
241 uint8_t *bin_id = hex_string_to_bin(temp_id); 241 uint8_t *bin_id = hex_string_to_bin(temp_id);
242 int num = tox_add_friend(tox, bin_id, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo") - 1); 242 uint32_t num = tox_friend_add(tox, bin_id, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo") - 1, 0);
243 free(bin_id); 243 free(bin_id);
244 244
245 if (num < 0) { 245 if (num == UINT32_MAX) {
246 printf("\nSomething went wrong when adding friend.\n"); 246 printf("\nSomething went wrong when adding friend.\n");
247 exit(1); 247 exit(1);
248 } 248 }
@@ -342,7 +342,7 @@ int main(int argc, char *argv[])
342 } 342 }
343 } 343 }
344 344
345 tox_do(tox); 345 tox_iteration(tox);
346 usleep(1000 * 50); 346 usleep(1000 * 50);
347 } 347 }
348 348