diff options
author | AZ Huang <aitjcize@gmail.com> | 2013-11-29 23:12:07 +0800 |
---|---|---|
committer | AZ Huang <aitjcize@gmail.com> | 2013-11-29 23:12:07 +0800 |
commit | 8419d3469a843684ba51a774663db848cfaab615 (patch) | |
tree | f6c6402f90184064be28926f5dbdc37640aefaee /toxcore | |
parent | 6e691a3c34ba41f38cf69fb9c9e1daea2762ebd1 (diff) |
Fix API name consistency.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/tox.c | 74 | ||||
-rw-r--r-- | toxcore/tox.h | 86 |
2 files changed, 80 insertions, 80 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c index f4e65ec8..2066b685 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -37,7 +37,7 @@ typedef struct Messenger Tox; | |||
37 | * Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] | 37 | * Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] |
38 | * | 38 | * |
39 | */ | 39 | */ |
40 | void tox_getaddress(Tox *tox, uint8_t *address) | 40 | void tox_add_address(Tox *tox, uint8_t *address) |
41 | { | 41 | { |
42 | Messenger *m = tox; | 42 | Messenger *m = tox; |
43 | getaddress(m, address); | 43 | getaddress(m, address); |
@@ -60,7 +60,7 @@ void tox_getaddress(Tox *tox, uint8_t *address) | |||
60 | * (the nospam for that friend was set to the new one). | 60 | * (the nospam for that friend was set to the new one). |
61 | * return FAERR_NOMEM if increasing the friend list size fails. | 61 | * return FAERR_NOMEM if increasing the friend list size fails. |
62 | */ | 62 | */ |
63 | int tox_addfriend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length) | 63 | int tox_add_friend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length) |
64 | { | 64 | { |
65 | Messenger *m = tox; | 65 | Messenger *m = tox; |
66 | return m_addfriend(m, address, data, length); | 66 | return m_addfriend(m, address, data, length); |
@@ -71,7 +71,7 @@ int tox_addfriend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length) | |||
71 | * return the friend number if success. | 71 | * return the friend number if success. |
72 | * return -1 if failure. | 72 | * return -1 if failure. |
73 | */ | 73 | */ |
74 | int tox_addfriend_norequest(Tox *tox, uint8_t *client_id) | 74 | int tox_add_friend_norequest(Tox *tox, uint8_t *client_id) |
75 | { | 75 | { |
76 | Messenger *m = tox; | 76 | Messenger *m = tox; |
77 | return m_addfriend_norequest(m, client_id); | 77 | return m_addfriend_norequest(m, client_id); |
@@ -80,7 +80,7 @@ int tox_addfriend_norequest(Tox *tox, uint8_t *client_id) | |||
80 | /* return the friend id associated to that client id. | 80 | /* return the friend id associated to that client id. |
81 | * return -1 if no such friend. | 81 | * return -1 if no such friend. |
82 | */ | 82 | */ |
83 | int tox_getfriend_id(Tox *tox, uint8_t *client_id) | 83 | int tox_get_friend_id(Tox *tox, uint8_t *client_id) |
84 | { | 84 | { |
85 | Messenger *m = tox; | 85 | Messenger *m = tox; |
86 | return getfriend_id(m, client_id); | 86 | return getfriend_id(m, client_id); |
@@ -92,14 +92,14 @@ int tox_getfriend_id(Tox *tox, uint8_t *client_id) | |||
92 | * return 0 if success. | 92 | * return 0 if success. |
93 | * return -1 if failure. | 93 | * return -1 if failure. |
94 | */ | 94 | */ |
95 | int tox_getclient_id(Tox *tox, int friend_id, uint8_t *client_id) | 95 | int tox_get_client_id(Tox *tox, int friend_id, uint8_t *client_id) |
96 | { | 96 | { |
97 | Messenger *m = tox; | 97 | Messenger *m = tox; |
98 | return getclient_id(m, friend_id, client_id); | 98 | return getclient_id(m, friend_id, client_id); |
99 | } | 99 | } |
100 | 100 | ||
101 | /* Remove a friend. */ | 101 | /* Remove a friend. */ |
102 | int tox_delfriend(Tox *tox, int friendnumber) | 102 | int tox_del_friend(Tox *tox, int friendnumber) |
103 | { | 103 | { |
104 | Messenger *m = tox; | 104 | Messenger *m = tox; |
105 | return m_delfriend(m, friendnumber); | 105 | return m_delfriend(m, friendnumber); |
@@ -111,7 +111,7 @@ int tox_delfriend(Tox *tox, int friendnumber) | |||
111 | * return 0 if friend is not connected to us (Offline). | 111 | * return 0 if friend is not connected to us (Offline). |
112 | * return -1 on failure. | 112 | * return -1 on failure. |
113 | */ | 113 | */ |
114 | int tox_get_friend_connectionstatus(Tox *tox, int friendnumber) | 114 | int tox_get_friend_connection_status(Tox *tox, int friendnumber) |
115 | { | 115 | { |
116 | Messenger *m = tox; | 116 | Messenger *m = tox; |
117 | return m_get_friend_connectionstatus(m, friendnumber); | 117 | return m_get_friend_connectionstatus(m, friendnumber); |
@@ -137,13 +137,13 @@ int tox_friend_exists(Tox *tox, int friendnumber) | |||
137 | * m_sendmessage_withid will send a message with the id of your choosing, | 137 | * m_sendmessage_withid will send a message with the id of your choosing, |
138 | * however we can generate an id for you by calling plain m_sendmessage. | 138 | * however we can generate an id for you by calling plain m_sendmessage. |
139 | */ | 139 | */ |
140 | uint32_t tox_sendmessage(Tox *tox, int friendnumber, uint8_t *message, uint32_t length) | 140 | uint32_t tox_send_message(Tox *tox, int friendnumber, uint8_t *message, uint32_t length) |
141 | { | 141 | { |
142 | Messenger *m = tox; | 142 | Messenger *m = tox; |
143 | return m_sendmessage(m, friendnumber, message, length); | 143 | return m_sendmessage(m, friendnumber, message, length); |
144 | } | 144 | } |
145 | 145 | ||
146 | uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) | 146 | uint32_t tox_send_message_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) |
147 | { | 147 | { |
148 | Messenger *m = tox; | 148 | Messenger *m = tox; |
149 | return m_sendmessage_withid(m, friendnumber, theid, message, length); | 149 | return m_sendmessage_withid(m, friendnumber, theid, message, length); |
@@ -159,13 +159,13 @@ uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint | |||
159 | * m_sendaction_withid will send an action message with the id of your choosing, | 159 | * m_sendaction_withid will send an action message with the id of your choosing, |
160 | * however we can generate an id for you by calling plain m_sendaction. | 160 | * however we can generate an id for you by calling plain m_sendaction. |
161 | */ | 161 | */ |
162 | uint32_t tox_sendaction(Tox *tox, int friendnumber, uint8_t *action, uint32_t length) | 162 | uint32_t tox_send_action(Tox *tox, int friendnumber, uint8_t *action, uint32_t length) |
163 | { | 163 | { |
164 | Messenger *m = tox; | 164 | Messenger *m = tox; |
165 | return m_sendaction(m, friendnumber, action, length); | 165 | return m_sendaction(m, friendnumber, action, length); |
166 | } | 166 | } |
167 | 167 | ||
168 | uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length) | 168 | uint32_t tox_send_action_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length) |
169 | { | 169 | { |
170 | Messenger *m = tox; | 170 | Messenger *m = tox; |
171 | return m_sendaction_withid(m, friendnumber, theid, action, length); | 171 | return m_sendaction_withid(m, friendnumber, theid, action, length); |
@@ -179,7 +179,7 @@ uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8 | |||
179 | * return 0 if success. | 179 | * return 0 if success. |
180 | * return -1 if failure. | 180 | * return -1 if failure. |
181 | */ | 181 | */ |
182 | int tox_setname(Tox *tox, uint8_t *name, uint16_t length) | 182 | int tox_set_name(Tox *tox, uint8_t *name, uint16_t length) |
183 | { | 183 | { |
184 | Messenger *m = tox; | 184 | Messenger *m = tox; |
185 | return setname(m, name, length); | 185 | return setname(m, name, length); |
@@ -193,7 +193,7 @@ int tox_setname(Tox *tox, uint8_t *name, uint16_t length) | |||
193 | * return length of the name. | 193 | * return length of the name. |
194 | * return 0 on error. | 194 | * return 0 on error. |
195 | */ | 195 | */ |
196 | uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen) | 196 | uint16_t tox_get_self_name(Tox *tox, uint8_t *name, uint16_t nlen) |
197 | { | 197 | { |
198 | Messenger *m = tox; | 198 | Messenger *m = tox; |
199 | return getself_name(m, name, nlen); | 199 | return getself_name(m, name, nlen); |
@@ -205,7 +205,7 @@ uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen) | |||
205 | * return length of name (with the NULL terminator) if success. | 205 | * return length of name (with the NULL terminator) if success. |
206 | * return -1 if failure. | 206 | * return -1 if failure. |
207 | */ | 207 | */ |
208 | int tox_getname(Tox *tox, int friendnumber, uint8_t *name) | 208 | int tox_get_name(Tox *tox, int friendnumber, uint8_t *name) |
209 | { | 209 | { |
210 | Messenger *m = tox; | 210 | Messenger *m = tox; |
211 | return getname(m, friendnumber, name); | 211 | return getname(m, friendnumber, name); |
@@ -216,7 +216,7 @@ int tox_getname(Tox *tox, int friendnumber, uint8_t *name) | |||
216 | * | 216 | * |
217 | * return 0 on success, -1 on failure. | 217 | * return 0 on success, -1 on failure. |
218 | */ | 218 | */ |
219 | int tox_set_statusmessage(Tox *tox, uint8_t *status, uint16_t length) | 219 | int tox_set_status_message(Tox *tox, uint8_t *status, uint16_t length) |
220 | { | 220 | { |
221 | Messenger *m = tox; | 221 | Messenger *m = tox; |
222 | return m_set_statusmessage(m, status, length); | 222 | return m_set_statusmessage(m, status, length); |
@@ -231,7 +231,7 @@ int tox_set_userstatus(Tox *tox, TOX_USERSTATUS status) | |||
231 | /* return the length of friendnumber's status message, including null. | 231 | /* return the length of friendnumber's status message, including null. |
232 | * Pass it into malloc. | 232 | * Pass it into malloc. |
233 | */ | 233 | */ |
234 | int tox_get_statusmessage_size(Tox *tox, int friendnumber) | 234 | int tox_get_status_message_size(Tox *tox, int friendnumber) |
235 | { | 235 | { |
236 | Messenger *m = tox; | 236 | Messenger *m = tox; |
237 | return m_get_statusmessage_size(m, friendnumber); | 237 | return m_get_statusmessage_size(m, friendnumber); |
@@ -241,13 +241,13 @@ int tox_get_statusmessage_size(Tox *tox, int friendnumber) | |||
241 | * Get the size you need to allocate from m_get_statusmessage_size. | 241 | * Get the size you need to allocate from m_get_statusmessage_size. |
242 | * The self variant will copy our own status message. | 242 | * The self variant will copy our own status message. |
243 | */ | 243 | */ |
244 | int tox_copy_statusmessage(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen) | 244 | int tox_get_status_message(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen) |
245 | { | 245 | { |
246 | Messenger *m = tox; | 246 | Messenger *m = tox; |
247 | return m_copy_statusmessage(m, friendnumber, buf, maxlen); | 247 | return m_copy_statusmessage(m, friendnumber, buf, maxlen); |
248 | } | 248 | } |
249 | 249 | ||
250 | int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen) | 250 | int tox_get_self_status_message(Tox *tox, uint8_t *buf, uint32_t maxlen) |
251 | { | 251 | { |
252 | Messenger *m = tox; | 252 | Messenger *m = tox; |
253 | return m_copy_self_statusmessage(m, buf, maxlen); | 253 | return m_copy_self_statusmessage(m, buf, maxlen); |
@@ -258,13 +258,13 @@ int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen) | |||
258 | * As above, the self variant will return our own USERSTATUS. | 258 | * As above, the self variant will return our own USERSTATUS. |
259 | * If friendnumber is invalid, this shall return USERSTATUS_INVALID. | 259 | * If friendnumber is invalid, this shall return USERSTATUS_INVALID. |
260 | */ | 260 | */ |
261 | TOX_USERSTATUS tox_get_userstatus(Tox *tox, int friendnumber) | 261 | TOX_USERSTATUS tox_get_user_status(Tox *tox, int friendnumber) |
262 | { | 262 | { |
263 | Messenger *m = tox; | 263 | Messenger *m = tox; |
264 | return (TOX_USERSTATUS)m_get_userstatus(m, friendnumber); | 264 | return (TOX_USERSTATUS)m_get_userstatus(m, friendnumber); |
265 | } | 265 | } |
266 | 266 | ||
267 | TOX_USERSTATUS tox_get_selfuserstatus(Tox *tox) | 267 | TOX_USERSTATUS tox_get_self_user_status(Tox *tox) |
268 | { | 268 | { |
269 | Messenger *m = tox; | 269 | Messenger *m = tox; |
270 | return (TOX_USERSTATUS)m_get_self_userstatus(m); | 270 | return (TOX_USERSTATUS)m_get_self_userstatus(m); |
@@ -294,7 +294,7 @@ uint32_t tox_count_friendlist(Tox *tox) | |||
294 | * Otherwise, returns the number of elements copied. | 294 | * Otherwise, returns the number of elements copied. |
295 | * If the array was too small, the contents | 295 | * If the array was too small, the contents |
296 | * of out_list will be truncated to list_size. */ | 296 | * of out_list will be truncated to list_size. */ |
297 | uint32_t tox_copy_friendlist(Tox *tox, int *out_list, uint32_t list_size) | 297 | uint32_t tox_get_friendlist(Tox *tox, int *out_list, uint32_t list_size) |
298 | { | 298 | { |
299 | Messenger *m = tox; | 299 | Messenger *m = tox; |
300 | return copy_friendlist(m, out_list, list_size); | 300 | return copy_friendlist(m, out_list, list_size); |
@@ -303,7 +303,7 @@ uint32_t tox_copy_friendlist(Tox *tox, int *out_list, uint32_t list_size) | |||
303 | /* Set the function that will be executed when a friend request is received. | 303 | /* Set the function that will be executed when a friend request is received. |
304 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) | 304 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) |
305 | */ | 305 | */ |
306 | void tox_callback_friendrequest(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata) | 306 | void tox_callback_friend_request(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata) |
307 | { | 307 | { |
308 | Messenger *m = tox; | 308 | Messenger *m = tox; |
309 | m_callback_friendrequest(m, function, userdata); | 309 | m_callback_friendrequest(m, function, userdata); |
@@ -313,7 +313,7 @@ void tox_callback_friendrequest(Tox *tox, void (*function)(uint8_t *, uint8_t *, | |||
313 | /* Set the function that will be executed when a message from a friend is received. | 313 | /* Set the function that will be executed when a message from a friend is received. |
314 | * Function format is: function(int friendnumber, uint8_t * message, uint32_t length) | 314 | * Function format is: function(int friendnumber, uint8_t * message, uint32_t length) |
315 | */ | 315 | */ |
316 | void tox_callback_friendmessage(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), | 316 | void tox_callback_friend_message(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), |
317 | void *userdata) | 317 | void *userdata) |
318 | { | 318 | { |
319 | Messenger *m = tox; | 319 | Messenger *m = tox; |
@@ -333,7 +333,7 @@ void tox_callback_action(Tox *tox, void (*function)(Messenger *tox, int, uint8_t | |||
333 | * function(int friendnumber, uint8_t *newname, uint16_t length) | 333 | * function(int friendnumber, uint8_t *newname, uint16_t length) |
334 | * You are not responsible for freeing newname. | 334 | * You are not responsible for freeing newname. |
335 | */ | 335 | */ |
336 | void tox_callback_namechange(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), | 336 | void tox_callback_name_change(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), |
337 | void *userdata) | 337 | void *userdata) |
338 | { | 338 | { |
339 | Messenger *m = tox; | 339 | Messenger *m = tox; |
@@ -344,7 +344,7 @@ void tox_callback_namechange(Tox *tox, void (*function)(Messenger *tox, int, uin | |||
344 | * function(int friendnumber, uint8_t *newstatus, uint16_t length) | 344 | * function(int friendnumber, uint8_t *newstatus, uint16_t length) |
345 | * You are not responsible for freeing newstatus. | 345 | * You are not responsible for freeing newstatus. |
346 | */ | 346 | */ |
347 | void tox_callback_statusmessage(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), | 347 | void tox_callback_status_message(Tox *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), |
348 | void *userdata) | 348 | void *userdata) |
349 | { | 349 | { |
350 | Messenger *m = tox; | 350 | Messenger *m = tox; |
@@ -354,7 +354,7 @@ void tox_callback_statusmessage(Tox *tox, void (*function)(Messenger *tox, int, | |||
354 | /* Set the callback for status type changes. | 354 | /* Set the callback for status type changes. |
355 | * function(int friendnumber, USERSTATUS kind) | 355 | * function(int friendnumber, USERSTATUS kind) |
356 | */ | 356 | */ |
357 | void tox_callback_userstatus(Tox *tox, void (*_function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata) | 357 | void tox_callback_user_status(Tox *tox, void (*_function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata) |
358 | { | 358 | { |
359 | Messenger *m = tox; | 359 | Messenger *m = tox; |
360 | typedef void (*function_type)(Messenger *, int, USERSTATUS, void *); | 360 | typedef void (*function_type)(Messenger *, int, USERSTATUS, void *); |
@@ -388,7 +388,7 @@ void tox_callback_read_receipt(Tox *tox, void (*function)(Messenger *tox, int, u | |||
388 | * being previously online" part. It's assumed that when adding friends, | 388 | * being previously online" part. It's assumed that when adding friends, |
389 | * their connection status is offline. | 389 | * their connection status is offline. |
390 | */ | 390 | */ |
391 | void tox_callback_connectionstatus(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, void *), void *userdata) | 391 | void tox_callback_connection_status(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, void *), void *userdata) |
392 | { | 392 | { |
393 | Messenger *m = tox; | 393 | Messenger *m = tox; |
394 | m_callback_connectionstatus(m, function, userdata); | 394 | m_callback_connectionstatus(m, function, userdata); |
@@ -422,7 +422,7 @@ void tox_callback_group_message(Tox *tox, void (*function)(Messenger *tox, int, | |||
422 | * Function(Tox *tox, int groupnumber, void *userdata) | 422 | * Function(Tox *tox, int groupnumber, void *userdata) |
423 | */ | 423 | */ |
424 | 424 | ||
425 | void tox_callback_group_namelistchange(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata) | 425 | void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata) |
426 | { | 426 | { |
427 | Messenger *m = tox; | 427 | Messenger *m = tox; |
428 | m_callback_group_namelistchange(m, function, userdata); | 428 | m_callback_group_namelistchange(m, function, userdata); |
@@ -507,7 +507,7 @@ int tox_group_number_peers(Tox *tox, int groupnumber) | |||
507 | * | 507 | * |
508 | * return -1 on failure. | 508 | * return -1 on failure. |
509 | */ | 509 | */ |
510 | int tox_group_copy_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length) | 510 | int tox_group_get_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length) |
511 | { | 511 | { |
512 | Messenger *m = tox; | 512 | Messenger *m = tox; |
513 | return group_names(m, groupnumber, names, length); | 513 | return group_names(m, groupnumber, names, length); |
@@ -527,7 +527,7 @@ uint32_t tox_count_chatlist(Tox *tox) | |||
527 | * Otherwise, returns the number of elements copied. | 527 | * Otherwise, returns the number of elements copied. |
528 | * If the array was too small, the contents | 528 | * If the array was too small, the contents |
529 | * of out_list will be truncated to list_size. */ | 529 | * of out_list will be truncated to list_size. */ |
530 | uint32_t tox_copy_chatlist(Tox *tox, int *out_list, uint32_t list_size) | 530 | uint32_t tox_get_chatlist(Tox *tox, int *out_list, uint32_t list_size) |
531 | { | 531 | { |
532 | Messenger *m = tox; | 532 | Messenger *m = tox; |
533 | return copy_chatlist(m, out_list, list_size); | 533 | return copy_chatlist(m, out_list, list_size); |
@@ -541,7 +541,7 @@ uint32_t tox_copy_chatlist(Tox *tox, int *out_list, uint32_t list_size) | |||
541 | * | 541 | * |
542 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) | 542 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) |
543 | */ | 543 | */ |
544 | void tox_callback_file_sendrequest(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, uint64_t, uint8_t *, | 544 | void tox_callback_file_send_request(Tox *tox, void (*function)(Messenger *tox, int, uint8_t, uint64_t, uint8_t *, |
545 | uint16_t, | 545 | uint16_t, |
546 | void *), void *userdata) | 546 | void *), void *userdata) |
547 | { | 547 | { |
@@ -577,7 +577,7 @@ void tox_callback_file_data(Tox *tox, void (*function)(Messenger *tox, int, uint | |||
577 | * return file number on success | 577 | * return file number on success |
578 | * return -1 on failure | 578 | * return -1 on failure |
579 | */ | 579 | */ |
580 | int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length) | 580 | int tox_new_file_sender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length) |
581 | { | 581 | { |
582 | Messenger *m = tox; | 582 | Messenger *m = tox; |
583 | return new_filesender(m, friendnumber, filesize, filename, filename_length); | 583 | return new_filesender(m, friendnumber, filesize, filename, filename_length); |
@@ -588,7 +588,7 @@ int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *f | |||
588 | * return 0 on success | 588 | * return 0 on success |
589 | * return -1 on failure | 589 | * return -1 on failure |
590 | */ | 590 | */ |
591 | int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, | 591 | int tox_file_send_control(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, |
592 | uint8_t *data, uint16_t length) | 592 | uint8_t *data, uint16_t length) |
593 | { | 593 | { |
594 | Messenger *m = tox; | 594 | Messenger *m = tox; |
@@ -599,18 +599,18 @@ int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8 | |||
599 | * return 0 on success | 599 | * return 0 on success |
600 | * return -1 on failure | 600 | * return -1 on failure |
601 | */ | 601 | */ |
602 | int tox_file_senddata(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length) | 602 | int tox_file_send_data(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length) |
603 | { | 603 | { |
604 | Messenger *m = tox; | 604 | Messenger *m = tox; |
605 | return file_data(m, friendnumber, filenumber, data, length); | 605 | return file_data(m, friendnumber, filenumber, data, length); |
606 | } | 606 | } |
607 | 607 | ||
608 | /* Returns the recommended/maximum size of the filedata you send with tox_file_senddata() | 608 | /* Returns the recommended/maximum size of the filedata you send with tox_file_send_data() |
609 | * | 609 | * |
610 | * return size on success | 610 | * return size on success |
611 | * return -1 on failure (currently will never return -1) | 611 | * return -1 on failure (currently will never return -1) |
612 | */ | 612 | */ |
613 | int tox_filedata_size(Tox *tox, int friendnumber) | 613 | int tox_file_data_size(Tox *tox, int friendnumber) |
614 | { | 614 | { |
615 | return MAX_DATA_SIZE - crypto_box_MACBYTES - 3; | 615 | return MAX_DATA_SIZE - crypto_box_MACBYTES - 3; |
616 | } | 616 | } |
@@ -622,7 +622,7 @@ int tox_filedata_size(Tox *tox, int friendnumber) | |||
622 | * return number of bytes remaining to be sent/received on success | 622 | * return number of bytes remaining to be sent/received on success |
623 | * return 0 on failure | 623 | * return 0 on failure |
624 | */ | 624 | */ |
625 | uint64_t tox_file_dataremaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive) | 625 | uint64_t tox_file_data_remaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive) |
626 | { | 626 | { |
627 | Messenger *m = tox; | 627 | Messenger *m = tox; |
628 | return file_dataremaining(m, friendnumber, filenumber, send_receive); | 628 | return file_dataremaining(m, friendnumber, filenumber, send_receive); |
diff --git a/toxcore/tox.h b/toxcore/tox.h index ea373488..b24374a9 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -129,7 +129,7 @@ typedef struct Tox Tox; | |||
129 | /* return FRIEND_ADDRESS_SIZE byte address to give to others. | 129 | /* return FRIEND_ADDRESS_SIZE byte address to give to others. |
130 | * format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] | 130 | * format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] |
131 | */ | 131 | */ |
132 | void tox_getaddress(Tox *tox, uint8_t *address); | 132 | void tox_add_address(Tox *tox, uint8_t *address); |
133 | 133 | ||
134 | /* Add a friend. | 134 | /* Add a friend. |
135 | * Set the data that will be sent along with friend request. | 135 | * Set the data that will be sent along with friend request. |
@@ -147,28 +147,28 @@ void tox_getaddress(Tox *tox, uint8_t *address); | |||
147 | * (the nospam for that friend was set to the new one). | 147 | * (the nospam for that friend was set to the new one). |
148 | * return TOX_FAERR_NOMEM if increasing the friend list size fails. | 148 | * return TOX_FAERR_NOMEM if increasing the friend list size fails. |
149 | */ | 149 | */ |
150 | int tox_addfriend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length); | 150 | int tox_add_friend(Tox *tox, uint8_t *address, uint8_t *data, uint16_t length); |
151 | 151 | ||
152 | 152 | ||
153 | /* Add a friend without sending a friendrequest. | 153 | /* Add a friend without sending a friendrequest. |
154 | * return the friend number if success. | 154 | * return the friend number if success. |
155 | * return -1 if failure. | 155 | * return -1 if failure. |
156 | */ | 156 | */ |
157 | int tox_addfriend_norequest(Tox *tox, uint8_t *client_id); | 157 | int tox_add_friend_norequest(Tox *tox, uint8_t *client_id); |
158 | 158 | ||
159 | /* return the friend id associated to that client id. | 159 | /* return the friend id associated to that client id. |
160 | return -1 if no such friend */ | 160 | return -1 if no such friend */ |
161 | int tox_getfriend_id(Tox *tox, uint8_t *client_id); | 161 | int tox_get_friend_id(Tox *tox, uint8_t *client_id); |
162 | 162 | ||
163 | /* Copies the public key associated to that friend id into client_id buffer. | 163 | /* Copies the public key associated to that friend id into client_id buffer. |
164 | * Make sure that client_id is of size CLIENT_ID_SIZE. | 164 | * Make sure that client_id is of size CLIENT_ID_SIZE. |
165 | * return 0 if success. | 165 | * return 0 if success. |
166 | * return -1 if failure. | 166 | * return -1 if failure. |
167 | */ | 167 | */ |
168 | int tox_getclient_id(Tox *tox, int friend_id, uint8_t *client_id); | 168 | int tox_get_client_id(Tox *tox, int friend_id, uint8_t *client_id); |
169 | 169 | ||
170 | /* Remove a friend. */ | 170 | /* Remove a friend. */ |
171 | int tox_delfriend(Tox *tox, int friendnumber); | 171 | int tox_del_friend(Tox *tox, int friendnumber); |
172 | 172 | ||
173 | /* Checks friend's connecting status. | 173 | /* Checks friend's connecting status. |
174 | * | 174 | * |
@@ -176,7 +176,7 @@ int tox_delfriend(Tox *tox, int friendnumber); | |||
176 | * return 0 if friend is not connected to us (Offline). | 176 | * return 0 if friend is not connected to us (Offline). |
177 | * return -1 on failure. | 177 | * return -1 on failure. |
178 | */ | 178 | */ |
179 | int tox_get_friend_connectionstatus(Tox *tox, int friendnumber); | 179 | int tox_get_friend_connection_status(Tox *tox, int friendnumber); |
180 | 180 | ||
181 | /* Checks if there exists a friend with given friendnumber. | 181 | /* Checks if there exists a friend with given friendnumber. |
182 | * | 182 | * |
@@ -195,8 +195,8 @@ int tox_friend_exists(Tox *tox, int friendnumber); | |||
195 | * m_sendmessage_withid will send a message with the id of your choosing, | 195 | * m_sendmessage_withid will send a message with the id of your choosing, |
196 | * however we can generate an id for you by calling plain m_sendmessage. | 196 | * however we can generate an id for you by calling plain m_sendmessage. |
197 | */ | 197 | */ |
198 | uint32_t tox_sendmessage(Tox *tox, int friendnumber, uint8_t *message, uint32_t length); | 198 | uint32_t tox_send_message(Tox *tox, int friendnumber, uint8_t *message, uint32_t length); |
199 | uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length); | 199 | uint32_t tox_send_message_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length); |
200 | 200 | ||
201 | /* Send an action to an online friend. | 201 | /* Send an action to an online friend. |
202 | * | 202 | * |
@@ -208,8 +208,8 @@ uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint | |||
208 | * m_sendaction_withid will send an action message with the id of your choosing, | 208 | * m_sendaction_withid will send an action message with the id of your choosing, |
209 | * however we can generate an id for you by calling plain m_sendaction. | 209 | * however we can generate an id for you by calling plain m_sendaction. |
210 | */ | 210 | */ |
211 | uint32_t tox_sendaction(Tox *tox, int friendnumber, uint8_t *action, uint32_t length); | 211 | uint32_t tox_send_action(Tox *tox, int friendnumber, uint8_t *action, uint32_t length); |
212 | uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length); | 212 | uint32_t tox_send_action_withid(Tox *tox, int friendnumber, uint32_t theid, uint8_t *action, uint32_t length); |
213 | 213 | ||
214 | /* Set our nickname. | 214 | /* Set our nickname. |
215 | * name must be a string of maximum MAX_NAME_LENGTH length. | 215 | * name must be a string of maximum MAX_NAME_LENGTH length. |
@@ -219,7 +219,7 @@ uint32_t tox_sendaction_withid(Tox *tox, int friendnumber, uint32_t theid, uint8 | |||
219 | * return 0 if success. | 219 | * return 0 if success. |
220 | * return -1 if failure. | 220 | * return -1 if failure. |
221 | */ | 221 | */ |
222 | int tox_setname(Tox *tox, uint8_t *name, uint16_t length); | 222 | int tox_set_name(Tox *tox, uint8_t *name, uint16_t length); |
223 | 223 | ||
224 | /* | 224 | /* |
225 | * Get your nickname. | 225 | * Get your nickname. |
@@ -230,7 +230,7 @@ int tox_setname(Tox *tox, uint8_t *name, uint16_t length); | |||
230 | * return length of name. | 230 | * return length of name. |
231 | * return 0 on error. | 231 | * return 0 on error. |
232 | */ | 232 | */ |
233 | uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen); | 233 | uint16_t tox_get_self_name(Tox *tox, uint8_t *name, uint16_t nlen); |
234 | 234 | ||
235 | /* Get name of friendnumber and put it in name. | 235 | /* Get name of friendnumber and put it in name. |
236 | * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. | 236 | * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. |
@@ -238,7 +238,7 @@ uint16_t tox_getselfname(Tox *tox, uint8_t *name, uint16_t nlen); | |||
238 | * return length of name (with the NULL terminator) if success. | 238 | * return length of name (with the NULL terminator) if success. |
239 | * return -1 if failure. | 239 | * return -1 if failure. |
240 | */ | 240 | */ |
241 | int tox_getname(Tox *tox, int friendnumber, uint8_t *name); | 241 | int tox_get_name(Tox *tox, int friendnumber, uint8_t *name); |
242 | 242 | ||
243 | /* Set our user status. | 243 | /* Set our user status. |
244 | * You are responsible for freeing status after. | 244 | * You are responsible for freeing status after. |
@@ -246,13 +246,13 @@ int tox_getname(Tox *tox, int friendnumber, uint8_t *name); | |||
246 | * returns 0 on success. | 246 | * returns 0 on success. |
247 | * returns -1 on failure. | 247 | * returns -1 on failure. |
248 | */ | 248 | */ |
249 | int tox_set_statusmessage(Tox *tox, uint8_t *status, uint16_t length); | 249 | int tox_set_status_message(Tox *tox, uint8_t *status, uint16_t length); |
250 | int tox_set_userstatus(Tox *tox, TOX_USERSTATUS status); | 250 | int tox_set_userstatus(Tox *tox, TOX_USERSTATUS status); |
251 | 251 | ||
252 | /* return the length of friendnumber's status message, including null. | 252 | /* return the length of friendnumber's status message, including null. |
253 | * Pass it into malloc | 253 | * Pass it into malloc |
254 | */ | 254 | */ |
255 | int tox_get_statusmessage_size(Tox *tox, int friendnumber); | 255 | int tox_get_status_message_size(Tox *tox, int friendnumber); |
256 | 256 | ||
257 | /* Copy friendnumber's status message into buf, truncating if size is over maxlen. | 257 | /* Copy friendnumber's status message into buf, truncating if size is over maxlen. |
258 | * Get the size you need to allocate from m_get_statusmessage_size. | 258 | * Get the size you need to allocate from m_get_statusmessage_size. |
@@ -261,16 +261,16 @@ int tox_get_statusmessage_size(Tox *tox, int friendnumber); | |||
261 | * returns the length of the copied data on success | 261 | * returns the length of the copied data on success |
262 | * retruns -1 on failure. | 262 | * retruns -1 on failure. |
263 | */ | 263 | */ |
264 | int tox_copy_statusmessage(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen); | 264 | int tox_get_status_message(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen); |
265 | int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen); | 265 | int tox_get_self_status_message(Tox *tox, uint8_t *buf, uint32_t maxlen); |
266 | 266 | ||
267 | /* return one of USERSTATUS values. | 267 | /* return one of USERSTATUS values. |
268 | * Values unknown to your application should be represented as USERSTATUS_NONE. | 268 | * Values unknown to your application should be represented as USERSTATUS_NONE. |
269 | * As above, the self variant will return our own USERSTATUS. | 269 | * As above, the self variant will return our own USERSTATUS. |
270 | * If friendnumber is invalid, this shall return USERSTATUS_INVALID. | 270 | * If friendnumber is invalid, this shall return USERSTATUS_INVALID. |
271 | */ | 271 | */ |
272 | TOX_USERSTATUS tox_get_userstatus(Tox *tox, int friendnumber); | 272 | TOX_USERSTATUS tox_get_user_status(Tox *tox, int friendnumber); |
273 | TOX_USERSTATUS tox_get_selfuserstatus(Tox *tox); | 273 | TOX_USERSTATUS tox_get_self_user_status(Tox *tox); |
274 | 274 | ||
275 | /* Sets whether we send read receipts for friendnumber. | 275 | /* Sets whether we send read receipts for friendnumber. |
276 | * This function is not lazy, and it will fail if yesno is not (0 or 1). | 276 | * This function is not lazy, and it will fail if yesno is not (0 or 1). |
@@ -287,17 +287,17 @@ uint32_t tox_count_friendlist(Tox *tox); | |||
287 | * Otherwise, returns the number of elements copied. | 287 | * Otherwise, returns the number of elements copied. |
288 | * If the array was too small, the contents | 288 | * If the array was too small, the contents |
289 | * of out_list will be truncated to list_size. */ | 289 | * of out_list will be truncated to list_size. */ |
290 | uint32_t tox_copy_friendlist(Tox *tox, int *out_list, uint32_t list_size); | 290 | uint32_t tox_get_friendlist(Tox *tox, int *out_list, uint32_t list_size); |
291 | 291 | ||
292 | /* Set the function that will be executed when a friend request is received. | 292 | /* Set the function that will be executed when a friend request is received. |
293 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) | 293 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length) |
294 | */ | 294 | */ |
295 | void tox_callback_friendrequest(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata); | 295 | void tox_callback_friend_request(Tox *tox, void (*function)(uint8_t *, uint8_t *, uint16_t, void *), void *userdata); |
296 | 296 | ||
297 | /* Set the function that will be executed when a message from a friend is received. | 297 | /* Set the function that will be executed when a message from a friend is received. |
298 | * Function format is: function(int friendnumber, uint8_t * message, uint32_t length) | 298 | * Function format is: function(int friendnumber, uint8_t * message, uint32_t length) |
299 | */ | 299 | */ |
300 | void tox_callback_friendmessage(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), | 300 | void tox_callback_friend_message(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), |
301 | void *userdata); | 301 | void *userdata); |
302 | 302 | ||
303 | /* Set the function that will be executed when an action from a friend is received. | 303 | /* Set the function that will be executed when an action from a friend is received. |
@@ -309,20 +309,20 @@ void tox_callback_action(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, ui | |||
309 | * function(int friendnumber, uint8_t *newname, uint16_t length) | 309 | * function(int friendnumber, uint8_t *newname, uint16_t length) |
310 | * You are not responsible for freeing newname | 310 | * You are not responsible for freeing newname |
311 | */ | 311 | */ |
312 | void tox_callback_namechange(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), | 312 | void tox_callback_name_change(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), |
313 | void *userdata); | 313 | void *userdata); |
314 | 314 | ||
315 | /* Set the callback for status message changes. | 315 | /* Set the callback for status message changes. |
316 | * function(int friendnumber, uint8_t *newstatus, uint16_t length) | 316 | * function(int friendnumber, uint8_t *newstatus, uint16_t length) |
317 | * You are not responsible for freeing newstatus. | 317 | * You are not responsible for freeing newstatus. |
318 | */ | 318 | */ |
319 | void tox_callback_statusmessage(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), | 319 | void tox_callback_status_message(Tox *tox, void (*function)(Tox *tox, int, uint8_t *, uint16_t, void *), |
320 | void *userdata); | 320 | void *userdata); |
321 | 321 | ||
322 | /* Set the callback for status type changes. | 322 | /* Set the callback for status type changes. |
323 | * function(int friendnumber, USERSTATUS kind) | 323 | * function(int friendnumber, USERSTATUS kind) |
324 | */ | 324 | */ |
325 | void tox_callback_userstatus(Tox *tox, void (*function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata); | 325 | void tox_callback_user_status(Tox *tox, void (*function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata); |
326 | 326 | ||
327 | /* Set the callback for read receipts. | 327 | /* Set the callback for read receipts. |
328 | * function(int friendnumber, uint32_t receipt) | 328 | * function(int friendnumber, uint32_t receipt) |
@@ -346,7 +346,7 @@ void tox_callback_read_receipt(Tox *tox, void (*function)(Tox *tox, int, uint32_ | |||
346 | * being previously online" part. it's assumed that when adding friends, | 346 | * being previously online" part. it's assumed that when adding friends, |
347 | * their connection status is offline. | 347 | * their connection status is offline. |
348 | */ | 348 | */ |
349 | void tox_callback_connectionstatus(Tox *tox, void (*function)(Tox *tox, int, uint8_t, void *), void *userdata); | 349 | void tox_callback_connection_status(Tox *tox, void (*function)(Tox *tox, int, uint8_t, void *), void *userdata); |
350 | 350 | ||
351 | /**********GROUP CHAT FUNCTIONS: WARNING WILL BREAK A LOT************/ | 351 | /**********GROUP CHAT FUNCTIONS: WARNING WILL BREAK A LOT************/ |
352 | 352 | ||
@@ -374,7 +374,7 @@ typedef enum { | |||
374 | TOX_CHAT_CHANGE_PEER_NAME, | 374 | TOX_CHAT_CHANGE_PEER_NAME, |
375 | } TOX_CHAT_CHANGE; | 375 | } TOX_CHAT_CHANGE; |
376 | 376 | ||
377 | void tox_callback_group_namelistchange(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata); | 377 | void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), void *userdata); |
378 | 378 | ||
379 | /* Creates a new groupchat and puts it in the chats array. | 379 | /* Creates a new groupchat and puts it in the chats array. |
380 | * | 380 | * |
@@ -430,7 +430,7 @@ int tox_group_number_peers(Tox *tox, int groupnumber); | |||
430 | * | 430 | * |
431 | * return -1 on failure. | 431 | * return -1 on failure. |
432 | */ | 432 | */ |
433 | int tox_group_copy_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length); | 433 | int tox_group_get_names(Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t length); |
434 | 434 | ||
435 | /* Return the number of chats in the instance m. | 435 | /* Return the number of chats in the instance m. |
436 | * You should use this to determine how much memory to allocate | 436 | * You should use this to determine how much memory to allocate |
@@ -442,26 +442,26 @@ uint32_t tox_count_chatlist(Tox *tox); | |||
442 | * Otherwise, returns the number of elements copied. | 442 | * Otherwise, returns the number of elements copied. |
443 | * If the array was too small, the contents | 443 | * If the array was too small, the contents |
444 | * of out_list will be truncated to list_size. */ | 444 | * of out_list will be truncated to list_size. */ |
445 | uint32_t tox_copy_chatlist(Tox *tox, int *out_list, uint32_t list_size); | 445 | uint32_t tox_get_chatlist(Tox *tox, int *out_list, uint32_t list_size); |
446 | 446 | ||
447 | 447 | ||
448 | /****************FILE SENDING FUNCTIONS*****************/ | 448 | /****************FILE SENDING FUNCTIONS*****************/ |
449 | /* NOTE: This how to will be updated. | 449 | /* NOTE: This how to will be updated. |
450 | * | 450 | * |
451 | * HOW TO SEND FILES CORRECTLY: | 451 | * HOW TO SEND FILES CORRECTLY: |
452 | * 1. Use tox_new_filesender(...) to create a new file sender. | 452 | * 1. Use tox_new_file_sender(...) to create a new file sender. |
453 | * 2. Wait for the callback set with tox_callback_file_control(...) to be called with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT | 453 | * 2. Wait for the callback set with tox_callback_file_control(...) to be called with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT |
454 | * 3. Send the data with tox_file_senddata(...) with chunk size tox_filedata_size(...) | 454 | * 3. Send the data with tox_file_send_data(...) with chunk size tox_file_data_size(...) |
455 | * 4. When sending is done, send a tox_file_sendcontrol(...) with send_receive = 0 and message_id = TOX_FILECONTROL_FINISHED | 455 | * 4. When sending is done, send a tox_file_send_control(...) with send_receive = 0 and message_id = TOX_FILECONTROL_FINISHED |
456 | * | 456 | * |
457 | * HOW TO RECEIVE FILES CORRECTLY: | 457 | * HOW TO RECEIVE FILES CORRECTLY: |
458 | * 1. wait for the callback set with tox_callback_file_sendrequest(...) | 458 | * 1. wait for the callback set with tox_callback_file_send_request(...) |
459 | * 2. accept or refuse the connection with tox_file_sendcontrol(...) with send_receive = 1 and message_id = TOX_FILECONTROL_ACCEPT or TOX_FILECONTROL_KILL | 459 | * 2. accept or refuse the connection with tox_file_send_control(...) with send_receive = 1 and message_id = TOX_FILECONTROL_ACCEPT or TOX_FILECONTROL_KILL |
460 | * 3. save all the data received with the callback set with tox_callback_file_data(...) to a file. | 460 | * 3. save all the data received with the callback set with tox_callback_file_data(...) to a file. |
461 | * 4. when the callback set with tox_callback_file_control(...) is called with receive_send == 0 and control_type == TOX_FILECONTROL_FINISHED | 461 | * 4. when the callback set with tox_callback_file_control(...) is called with receive_send == 0 and control_type == TOX_FILECONTROL_FINISHED |
462 | * the file is done transferring. | 462 | * the file is done transferring. |
463 | * | 463 | * |
464 | * tox_file_dataremaining(...) can be used to know how many bytes are left to send/receive. | 464 | * tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive. |
465 | * | 465 | * |
466 | * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back) | 466 | * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back) |
467 | * the reciever must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being | 467 | * the reciever must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being |
@@ -484,7 +484,7 @@ enum { | |||
484 | * | 484 | * |
485 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) | 485 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) |
486 | */ | 486 | */ |
487 | void tox_callback_file_sendrequest(Tox *tox, void (*function)(Tox *m, int, uint8_t, uint64_t, uint8_t *, uint16_t, | 487 | void tox_callback_file_send_request(Tox *tox, void (*function)(Tox *m, int, uint8_t, uint64_t, uint8_t *, uint16_t, |
488 | void *), void *userdata); | 488 | void *), void *userdata); |
489 | 489 | ||
490 | /* Set the callback for file control requests. | 490 | /* Set the callback for file control requests. |
@@ -512,7 +512,7 @@ void tox_callback_file_data(Tox *tox, void (*function)(Tox *m, int, uint8_t, uin | |||
512 | * return file number on success | 512 | * return file number on success |
513 | * return -1 on failure | 513 | * return -1 on failure |
514 | */ | 514 | */ |
515 | int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length); | 515 | int tox_new_file_sender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length); |
516 | 516 | ||
517 | /* Send a file control request. | 517 | /* Send a file control request. |
518 | * | 518 | * |
@@ -522,7 +522,7 @@ int tox_new_filesender(Tox *tox, int friendnumber, uint64_t filesize, uint8_t *f | |||
522 | * return 0 on success | 522 | * return 0 on success |
523 | * return -1 on failure | 523 | * return -1 on failure |
524 | */ | 524 | */ |
525 | int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, | 525 | int tox_file_send_control(Tox *tox, int friendnumber, uint8_t send_receive, uint8_t filenumber, uint8_t message_id, |
526 | uint8_t *data, uint16_t length); | 526 | uint8_t *data, uint16_t length); |
527 | 527 | ||
528 | /* Send file data. | 528 | /* Send file data. |
@@ -530,14 +530,14 @@ int tox_file_sendcontrol(Tox *tox, int friendnumber, uint8_t send_receive, uint8 | |||
530 | * return 0 on success | 530 | * return 0 on success |
531 | * return -1 on failure | 531 | * return -1 on failure |
532 | */ | 532 | */ |
533 | int tox_file_senddata(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length); | 533 | int tox_file_send_data(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length); |
534 | 534 | ||
535 | /* Returns the recommended/maximum size of the filedata you send with tox_file_senddata() | 535 | /* Returns the recommended/maximum size of the filedata you send with tox_file_send_data() |
536 | * | 536 | * |
537 | * return size on success | 537 | * return size on success |
538 | * return -1 on failure (currently will never return -1) | 538 | * return -1 on failure (currently will never return -1) |
539 | */ | 539 | */ |
540 | int tox_filedata_size(Tox *tox, int friendnumber); | 540 | int tox_file_data_size(Tox *tox, int friendnumber); |
541 | 541 | ||
542 | /* Give the number of bytes left to be sent/received. | 542 | /* Give the number of bytes left to be sent/received. |
543 | * | 543 | * |
@@ -546,7 +546,7 @@ int tox_filedata_size(Tox *tox, int friendnumber); | |||
546 | * return number of bytes remaining to be sent/received on success | 546 | * return number of bytes remaining to be sent/received on success |
547 | * return 0 on failure | 547 | * return 0 on failure |
548 | */ | 548 | */ |
549 | uint64_t tox_file_dataremaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive); | 549 | uint64_t tox_file_data_remaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive); |
550 | 550 | ||
551 | /***************END OF FILE SENDING FUNCTIONS******************/ | 551 | /***************END OF FILE SENDING FUNCTIONS******************/ |
552 | 552 | ||