summaryrefslogtreecommitdiff
path: root/testing/test_avatars.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/test_avatars.c')
-rw-r--r--testing/test_avatars.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/testing/test_avatars.c b/testing/test_avatars.c
index fc7e9d6f..a7bc9cd8 100644
--- a/testing/test_avatars.c
+++ b/testing/test_avatars.c
@@ -222,7 +222,7 @@ static int load_user_avatar(Tox *tox, char *base_dir, int friendnum,
222 } 222 }
223 223
224 *datalen = ret; 224 *datalen = ret;
225 tox_avatar_hash(tox, hash, data, *datalen); 225 tox_hash(tox, hash, data, *datalen);
226 226
227 return 0; 227 return 0;
228} 228}
@@ -305,7 +305,7 @@ static void friend_avatar_info_cb(Tox *tox, int32_t n, uint8_t format, uint8_t *
305 char *base_dir = (char *) ud; 305 char *base_dir = (char *) ud;
306 uint8_t addr[TOX_CLIENT_ID_SIZE]; 306 uint8_t addr[TOX_CLIENT_ID_SIZE];
307 char addr_str[2 * TOX_CLIENT_ID_SIZE + 1]; 307 char addr_str[2 * TOX_CLIENT_ID_SIZE + 1];
308 char hash_str[2 * TOX_AVATAR_HASH_LENGTH + 1]; 308 char hash_str[2 * TOX_HASH_LENGTH + 1];
309 309
310 if (tox_get_client_id(tox, n, addr) == 0) { 310 if (tox_get_client_id(tox, n, addr) == 0) {
311 byte_to_hex_str(addr, TOX_CLIENT_ID_SIZE, addr_str); 311 byte_to_hex_str(addr, TOX_CLIENT_ID_SIZE, addr_str);
@@ -315,7 +315,7 @@ static void friend_avatar_info_cb(Tox *tox, int32_t n, uint8_t format, uint8_t *
315 printf("Receiving avatar information from friend number %u.\n", n); 315 printf("Receiving avatar information from friend number %u.\n", n);
316 } 316 }
317 317
318 byte_to_hex_str(hash, TOX_AVATAR_HASH_LENGTH, hash_str); 318 byte_to_hex_str(hash, TOX_HASH_LENGTH, hash_str);
319 DEBUG("format=%u, hash=%s", format, hash_str); 319 DEBUG("format=%u, hash=%s", format, hash_str);
320 320
321 if (format == TOX_AVATAR_FORMAT_NONE) { 321 if (format == TOX_AVATAR_FORMAT_NONE) {
@@ -333,13 +333,13 @@ static void friend_avatar_info_cb(Tox *tox, int32_t n, uint8_t format, uint8_t *
333 */ 333 */
334 uint32_t cur_av_len; 334 uint32_t cur_av_len;
335 uint8_t cur_av_data[TOX_AVATAR_MAX_DATA_LENGTH]; 335 uint8_t cur_av_data[TOX_AVATAR_MAX_DATA_LENGTH];
336 uint8_t cur_av_hash[TOX_AVATAR_HASH_LENGTH]; 336 uint8_t cur_av_hash[TOX_HASH_LENGTH];
337 int ret; 337 int ret;
338 338
339 ret = load_user_avatar(tox, base_dir, n, format, cur_av_hash, cur_av_data, &cur_av_len); 339 ret = load_user_avatar(tox, base_dir, n, format, cur_av_hash, cur_av_data, &cur_av_len);
340 340
341 if (ret != 0 341 if (ret != 0
342 && memcpy(cur_av_hash, hash, TOX_AVATAR_HASH_LENGTH) != 0) { 342 && memcpy(cur_av_hash, hash, TOX_HASH_LENGTH) != 0) {
343 printf(" -> Cached avatar is outdated. Requesting avatar data.\n"); 343 printf(" -> Cached avatar is outdated. Requesting avatar data.\n");
344 tox_request_avatar_data(tox, n); 344 tox_request_avatar_data(tox, n);
345 } else { 345 } else {
@@ -355,7 +355,7 @@ static void friend_avatar_data_cb(Tox *tox, int32_t n, uint8_t format,
355 char *base_dir = (char *) ud; 355 char *base_dir = (char *) ud;
356 uint8_t addr[TOX_CLIENT_ID_SIZE]; 356 uint8_t addr[TOX_CLIENT_ID_SIZE];
357 char addr_str[2 * TOX_CLIENT_ID_SIZE + 1]; 357 char addr_str[2 * TOX_CLIENT_ID_SIZE + 1];
358 char hash_str[2 * TOX_AVATAR_HASH_LENGTH + 1]; 358 char hash_str[2 * TOX_HASH_LENGTH + 1];
359 359
360 if (tox_get_client_id(tox, n, addr) == 0) { 360 if (tox_get_client_id(tox, n, addr) == 0) {
361 byte_to_hex_str(addr, TOX_CLIENT_ID_SIZE, addr_str); 361 byte_to_hex_str(addr, TOX_CLIENT_ID_SIZE, addr_str);
@@ -365,7 +365,7 @@ static void friend_avatar_data_cb(Tox *tox, int32_t n, uint8_t format,
365 printf("Receiving avatar data from friend number %u.\n", n); 365 printf("Receiving avatar data from friend number %u.\n", n);
366 } 366 }
367 367
368 byte_to_hex_str(hash, TOX_AVATAR_HASH_LENGTH, hash_str); 368 byte_to_hex_str(hash, TOX_HASH_LENGTH, hash_str);
369 DEBUG("format=%u, datalen=%d, hash=%s\n", format, datalen, hash_str); 369 DEBUG("format=%u, datalen=%d, hash=%s\n", format, datalen, hash_str);
370 370
371 delete_user_avatar(tox, base_dir, n); 371 delete_user_avatar(tox, base_dir, n);
@@ -505,14 +505,14 @@ static void print_avatar_info(Tox *tox)
505{ 505{
506 uint8_t format; 506 uint8_t format;
507 uint8_t data[TOX_AVATAR_MAX_DATA_LENGTH]; 507 uint8_t data[TOX_AVATAR_MAX_DATA_LENGTH];
508 uint8_t hash[TOX_AVATAR_HASH_LENGTH]; 508 uint8_t hash[TOX_HASH_LENGTH];
509 uint32_t data_length; 509 uint32_t data_length;
510 char hash_str[2 * TOX_AVATAR_HASH_LENGTH + 1]; 510 char hash_str[2 * TOX_HASH_LENGTH + 1];
511 511
512 int ret = tox_get_self_avatar(tox, &format, data, &data_length, sizeof(data), hash); 512 int ret = tox_get_self_avatar(tox, &format, data, &data_length, sizeof(data), hash);
513 DEBUG("tox_get_self_avatar returned %d", ret); 513 DEBUG("tox_get_self_avatar returned %d", ret);
514 DEBUG("format: %d, data_length: %d", format, data_length); 514 DEBUG("format: %d, data_length: %d", format, data_length);
515 byte_to_hex_str(hash, TOX_AVATAR_HASH_LENGTH, hash_str); 515 byte_to_hex_str(hash, TOX_HASH_LENGTH, hash_str);
516 DEBUG("hash: %s", hash_str); 516 DEBUG("hash: %s", hash_str);
517} 517}
518 518