diff options
Diffstat (limited to 'protocols/Tox/tox/include/tox.h')
-rw-r--r-- | protocols/Tox/tox/include/tox.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/protocols/Tox/tox/include/tox.h b/protocols/Tox/tox/include/tox.h index 61cfdf7098..ccb5a83e0f 100644 --- a/protocols/Tox/tox/include/tox.h +++ b/protocols/Tox/tox/include/tox.h @@ -419,9 +419,12 @@ int tox_send_lossless_packet(const Tox *tox, int32_t friendnumber, const uint8_t /* Set the callback for group invites. * - * Function(Tox *tox, int friendnumber, uint8_t *group_public_key, void *userdata) + * Function(Tox *tox, int32_t friendnumber, uint8_t *data, uint16_t length, void *userdata) + * + * data of length is what needs to be passed to join_groupchat(). */ -void tox_callback_group_invite(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, void *), void *userdata); +void tox_callback_group_invite(Tox *tox, void (*function)(Tox *tox, int32_t, const uint8_t *, uint16_t, void *), + void *userdata); /* Set the callback for group messages. * @@ -479,24 +482,25 @@ int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t */ int tox_invite_friend(Tox *tox, int32_t friendnumber, int groupnumber); -/* Join a group (you need to have been invited first.) +/* Join a group (you need to have been invited first.) using data of length obtained + * in the group invite callback. * * returns group number on success * returns -1 on failure. */ -int tox_join_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *friend_group_public_key); +int tox_join_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length); /* send a group message * return 0 on success * return -1 on failure */ -int tox_group_message_send(Tox *tox, int groupnumber, const uint8_t *message, uint32_t length); +int tox_group_message_send(Tox *tox, int groupnumber, const uint8_t *message, uint16_t length); /* send a group action * return 0 on success * return -1 on failure */ -int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint32_t length); +int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint16_t length); /* Return the number of peers in the group chat on success. * return -1 on failure @@ -539,8 +543,8 @@ uint32_t tox_get_chatlist(const Tox *tox, int *out_list, uint32_t list_size); * function(Tox *tox, int32_t friendnumber, uint8_t format, uint8_t *hash, void *userdata) * * where 'format' is the avatar image format (see TOX_AVATAR_FORMAT) and 'hash' is the hash of - * the avatar data for caching purposes and it is exactly TOX_AVATAR_HASH_LENGTH long. If the - * image format is NONE, the hash is zeroed. + * the avatar data for caching purposes and it is exactly TOX_HASH_LENGTH long. If the image + * format is NONE, the hash is zeroed. * */ void tox_callback_avatar_info(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, uint8_t *, void *), @@ -556,12 +560,12 @@ void tox_callback_avatar_info(Tox *tox, void (*function)(Tox *tox, int32_t, uint * * where 'format' is the avatar image format (see TOX_AVATAR_FORMAT); 'hash' is the * locally-calculated cryptographic hash of the avatar data and it is exactly - * TOX_AVATAR_HASH_LENGTH long; 'data' is the avatar image data and 'datalen' is the length + * TOX_HASH_LENGTH long; 'data' is the avatar image data and 'datalen' is the length * of such data. * * If format is NONE, 'data' is NULL, 'datalen' is zero, and the hash is zeroed. The hash is - * always validated locally with the function tox_avatar_hash and ensured to match the image - * data, so this value can be safely used to compare with cached avatars. + * always validated locally with the function tox_hash and ensured to match the image data, + * so this value can be safely used to compare with cached avatars. * * WARNING: users MUST treat all avatar image data received from another peer as untrusted and * potentially malicious. The library only ensures that the data which arrived is the same the @@ -586,6 +590,10 @@ void tox_callback_avatar_data(Tox *tox, void (*function)(Tox *tox, int32_t, uint */ int tox_set_avatar(Tox *tox, uint8_t format, const uint8_t *data, uint32_t length); +/* Unsets the user avatar. + + returns 0 on success (currently always returns 0) */ +int tox_unset_avatar(Tox *tox); /* Get avatar data from the current user. * Copies the current user avatar data to the destination buffer and sets the image format @@ -601,7 +609,7 @@ int tox_set_avatar(Tox *tox, uint8_t format, const uint8_t *data, uint32_t lengt * buf - destination buffer to the image data. Must have at least 'maxlen' bytes; * length - destination pointer to the image data length; * maxlen - length of the destination buffer 'buf'; - * hash - destination pointer to the avatar hash (it must be exactly TOX_AVATAR_HASH_LENGTH bytes long). + * hash - destination pointer to the avatar hash (it must be exactly TOX_HASH_LENGTH bytes long). * * returns 0 on success; * returns -1 on failure. |