diff options
author | mannol <eniz_vukovic@hotmail.com> | 2015-04-17 19:19:58 +0200 |
---|---|---|
committer | mannol <eniz_vukovic@hotmail.com> | 2015-04-17 19:19:58 +0200 |
commit | d1fd3e36a6b58d4cd6b3e2a7ccbed7e1e5d2e2a3 (patch) | |
tree | 6ae0aacc5fba56fc356be615b6f459c95647d597 /testing/irc_syncbot.c | |
parent | 969367b72aebaa2ecfc168cf2e86b20501298c20 (diff) | |
parent | f8087887feaf77577a345ae1be68776459613c03 (diff) |
Updated with upstream
Diffstat (limited to 'testing/irc_syncbot.c')
-rw-r--r-- | testing/irc_syncbot.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c index f7486115..b879e4eb 100644 --- a/testing/irc_syncbot.c +++ b/testing/irc_syncbot.c | |||
@@ -89,7 +89,8 @@ 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 | ||
92 | void callback_friend_message(Tox *tox, int fid, const uint8_t *message, uint16_t length, void *userdata) | 92 | void callback_friend_message(Tox *tox, uint32_t fid, TOX_MESSAGE_TYPE type, const uint8_t *message, size_t length, |
93 | void *userdata) | ||
93 | { | 94 | { |
94 | if (length == 1 && *message == 'c') { | 95 | if (length == 1 && *message == 'c') { |
95 | if (tox_del_groupchat(tox, current_group) == 0) | 96 | if (tox_del_groupchat(tox, current_group) == 0) |
@@ -203,7 +204,7 @@ void send_irc_group(Tox *tox, uint8_t *msg, uint16_t len) | |||
203 | 204 | ||
204 | Tox *init_tox(int argc, char *argv[]) | 205 | Tox *init_tox(int argc, char *argv[]) |
205 | { | 206 | { |
206 | uint8_t ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; /* x */ | 207 | uint8_t ipv6enabled = 1; /* x */ |
207 | int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled); | 208 | int argvoffset = cmdline_parsefor_ipv46(argc, argv, &ipv6enabled); |
208 | 209 | ||
209 | if (argvoffset < 0) | 210 | if (argvoffset < 0) |
@@ -215,12 +216,12 @@ Tox *init_tox(int argc, char *argv[]) | |||
215 | exit(0); | 216 | exit(0); |
216 | } | 217 | } |
217 | 218 | ||
218 | Tox *tox = tox_new(0); | 219 | Tox *tox = tox_new(0, 0, 0, 0); |
219 | 220 | ||
220 | if (!tox) | 221 | if (!tox) |
221 | exit(1); | 222 | exit(1); |
222 | 223 | ||
223 | tox_set_name(tox, (uint8_t *)IRC_NAME, sizeof(IRC_NAME) - 1); | 224 | tox_self_set_name(tox, (uint8_t *)IRC_NAME, sizeof(IRC_NAME) - 1, 0); |
224 | tox_callback_friend_message(tox, &callback_friend_message, 0); | 225 | tox_callback_friend_message(tox, &callback_friend_message, 0); |
225 | tox_callback_group_invite(tox, &callback_group_invite, 0); | 226 | tox_callback_group_invite(tox, &callback_group_invite, 0); |
226 | tox_callback_group_message(tox, ©_groupmessage, 0); | 227 | tox_callback_group_message(tox, ©_groupmessage, 0); |
@@ -228,7 +229,7 @@ Tox *init_tox(int argc, char *argv[]) | |||
228 | 229 | ||
229 | uint16_t port = atoi(argv[argvoffset + 2]); | 230 | uint16_t port = atoi(argv[argvoffset + 2]); |
230 | unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); | 231 | 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); | 232 | tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0); |
232 | free(binary_string); | 233 | free(binary_string); |
233 | 234 | ||
234 | char temp_id[128]; | 235 | char temp_id[128]; |
@@ -239,10 +240,10 @@ Tox *init_tox(int argc, char *argv[]) | |||
239 | } | 240 | } |
240 | 241 | ||
241 | uint8_t *bin_id = hex_string_to_bin(temp_id); | 242 | 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); | 243 | uint32_t num = tox_friend_add(tox, bin_id, (uint8_t *)"Install Gentoo", sizeof("Install Gentoo") - 1, 0); |
243 | free(bin_id); | 244 | free(bin_id); |
244 | 245 | ||
245 | if (num < 0) { | 246 | if (num == UINT32_MAX) { |
246 | printf("\nSomething went wrong when adding friend.\n"); | 247 | printf("\nSomething went wrong when adding friend.\n"); |
247 | exit(1); | 248 | exit(1); |
248 | } | 249 | } |
@@ -342,7 +343,7 @@ int main(int argc, char *argv[]) | |||
342 | } | 343 | } |
343 | } | 344 | } |
344 | 345 | ||
345 | tox_do(tox); | 346 | tox_iterate(tox); |
346 | usleep(1000 * 50); | 347 | usleep(1000 * 50); |
347 | } | 348 | } |
348 | 349 | ||