diff options
Diffstat (limited to 'toxcore/Messenger.h')
-rw-r--r-- | toxcore/Messenger.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 0ff14de4..05a5af27 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -44,6 +44,9 @@ | |||
44 | #define PACKET_ID_RECEIPT 65 | 44 | #define PACKET_ID_RECEIPT 65 |
45 | #define PACKET_ID_MESSAGE 64 | 45 | #define PACKET_ID_MESSAGE 64 |
46 | #define PACKET_ID_ACTION 63 | 46 | #define PACKET_ID_ACTION 63 |
47 | #define PACKET_ID_FILE_SENDREQUEST 80 | ||
48 | #define PACKET_ID_FILE_CONTROL 81 | ||
49 | #define PACKET_ID_FILE_DATA 82 | ||
47 | #define PACKET_ID_INVITE_GROUPCHAT 144 | 50 | #define PACKET_ID_INVITE_GROUPCHAT 144 |
48 | #define PACKET_ID_JOIN_GROUPCHAT 145 | 51 | #define PACKET_ID_JOIN_GROUPCHAT 145 |
49 | #define PACKET_ID_ACCEPT_GROUPCHAT 146 | 52 | #define PACKET_ID_ACCEPT_GROUPCHAT 146 |
@@ -157,11 +160,19 @@ typedef struct Messenger { | |||
157 | void *friend_statuschange_userdata; | 160 | void *friend_statuschange_userdata; |
158 | void (*friend_connectionstatuschange)(struct Messenger *m, int, uint8_t, void *); | 161 | void (*friend_connectionstatuschange)(struct Messenger *m, int, uint8_t, void *); |
159 | void *friend_connectionstatuschange_userdata; | 162 | void *friend_connectionstatuschange_userdata; |
163 | |||
160 | void (*group_invite)(struct Messenger *m, int, uint8_t *, void *); | 164 | void (*group_invite)(struct Messenger *m, int, uint8_t *, void *); |
161 | void *group_invite_userdata; | 165 | void *group_invite_userdata; |
162 | void (*group_message)(struct Messenger *m, int, int, uint8_t *, uint16_t, void *); | 166 | void (*group_message)(struct Messenger *m, int, int, uint8_t *, uint16_t, void *); |
163 | void *group_message_userdata; | 167 | void *group_message_userdata; |
164 | 168 | ||
169 | void (*file_sendrequest)(struct Messenger *m, int, uint8_t, uint64_t, uint8_t *, uint16_t, void *); | ||
170 | void *file_sendrequest_userdata; | ||
171 | void (*file_filecontrol)(struct Messenger *m, int, uint8_t, uint8_t, uint8_t *, uint16_t, void *); | ||
172 | void *file_filecontrol_userdata; | ||
173 | void (*file_filedata)(struct Messenger *m, int, uint8_t, uint8_t *, uint16_t length, void *); | ||
174 | void *file_filedata_userdata; | ||
175 | |||
165 | } Messenger; | 176 | } Messenger; |
166 | 177 | ||
167 | /* Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] | 178 | /* Format: [client_id (32 bytes)][nospam number (4 bytes)][checksum (2 bytes)] |
@@ -439,6 +450,55 @@ int join_groupchat(Messenger *m, int friendnumber, uint8_t *friend_group_public_ | |||
439 | 450 | ||
440 | int group_message_send(Messenger *m, int groupnumber, uint8_t *message, uint32_t length); | 451 | int group_message_send(Messenger *m, int groupnumber, uint8_t *message, uint32_t length); |
441 | 452 | ||
453 | /****************FILE SENDING*****************/ | ||
454 | |||
455 | |||
456 | /* Set the callback for file send requests. | ||
457 | * | ||
458 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, uint16_t filename_length, void *userdata) | ||
459 | */ | ||
460 | void callback_file_sendrequest(Messenger *m, void (*function)(Messenger *m, int, uint8_t, uint64_t, uint8_t *, uint16_t, | ||
461 | void *), void *userdata); | ||
462 | |||
463 | /* Set the callback for file control requests. | ||
464 | * | ||
465 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t control_type, uint8_t *data, uint16_t length, void *userdata) | ||
466 | * | ||
467 | */ | ||
468 | void callback_file_control(Messenger *m, void (*function)(Messenger *m, int, uint8_t, uint8_t, uint8_t *, uint16_t, | ||
469 | void *), void *userdata); | ||
470 | |||
471 | /* Set the callback for file data. | ||
472 | * | ||
473 | * Function(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata) | ||
474 | * | ||
475 | */ | ||
476 | void callback_file_data(Messenger *m, void (*function)(Messenger *m, int, uint8_t, uint8_t *, uint16_t length, void *), | ||
477 | void *userdata); | ||
478 | |||
479 | /* Send a file send request. | ||
480 | * Maximum filename length is 256 bytes. | ||
481 | * return 1 on success | ||
482 | * return 0 on failure | ||
483 | */ | ||
484 | int file_sendrequest(Messenger *m, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename, | ||
485 | uint16_t filename_length); | ||
486 | |||
487 | /* Send a file control request. | ||
488 | * | ||
489 | * return 1 on success | ||
490 | * return 0 on failure | ||
491 | */ | ||
492 | int file_control(Messenger *m, int friendnumber, uint8_t filenumber, uint8_t message_id, uint8_t *data, | ||
493 | uint16_t length); | ||
494 | |||
495 | /* Send file data. | ||
496 | * | ||
497 | * return 1 on success | ||
498 | * return 0 on failure | ||
499 | */ | ||
500 | int file_data(Messenger *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length); | ||
501 | |||
442 | /*********************************/ | 502 | /*********************************/ |
443 | 503 | ||
444 | /* Run this at startup. | 504 | /* Run this at startup. |