diff options
Diffstat (limited to 'toxcore/tox_old.h')
-rw-r--r-- | toxcore/tox_old.h | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/toxcore/tox_old.h b/toxcore/tox_old.h new file mode 100644 index 00000000..a926cdf7 --- /dev/null +++ b/toxcore/tox_old.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /**********GROUP CHAT FUNCTIONS ************/ | ||
2 | |||
3 | /* Group chat types for tox_callback_group_invite function. | ||
4 | * | ||
5 | * TOX_GROUPCHAT_TYPE_TEXT groupchats must be accepted with the tox_join_groupchat() function. | ||
6 | * The function to accept TOX_GROUPCHAT_TYPE_AV is in toxav. | ||
7 | */ | ||
8 | enum { | ||
9 | TOX_GROUPCHAT_TYPE_TEXT, | ||
10 | TOX_GROUPCHAT_TYPE_AV | ||
11 | }; | ||
12 | |||
13 | /* Set the callback for group invites. | ||
14 | * | ||
15 | * Function(Tox *tox, int32_t friendnumber, uint8_t type, const uint8_t *data, uint16_t length, void *userdata) | ||
16 | * | ||
17 | * data of length is what needs to be passed to join_groupchat(). | ||
18 | * | ||
19 | * for what type means see the enum right above this comment. | ||
20 | */ | ||
21 | void tox_callback_group_invite(Tox *tox, void (*function)(Tox *tox, int32_t, uint8_t, const uint8_t *, uint16_t, | ||
22 | void *), void *userdata); | ||
23 | |||
24 | /* Set the callback for group messages. | ||
25 | * | ||
26 | * Function(Tox *tox, int groupnumber, int peernumber, const uint8_t * message, uint16_t length, void *userdata) | ||
27 | */ | ||
28 | void tox_callback_group_message(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), | ||
29 | void *userdata); | ||
30 | |||
31 | /* Set the callback for group actions. | ||
32 | * | ||
33 | * Function(Tox *tox, int groupnumber, int peernumber, const uint8_t * action, uint16_t length, void *userdata) | ||
34 | */ | ||
35 | void tox_callback_group_action(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), | ||
36 | void *userdata); | ||
37 | |||
38 | /* Set callback function for title changes. | ||
39 | * | ||
40 | * Function(Tox *tox, int groupnumber, int peernumber, uint8_t * title, uint8_t length, void *userdata) | ||
41 | * if peernumber == -1, then author is unknown (e.g. initial joining the group) | ||
42 | */ | ||
43 | void tox_callback_group_title(Tox *tox, void (*function)(Tox *tox, int, int, const uint8_t *, uint8_t, | ||
44 | void *), void *userdata); | ||
45 | |||
46 | /* Set callback function for peer name list changes. | ||
47 | * | ||
48 | * It gets called every time the name list changes(new peer/name, deleted peer) | ||
49 | * Function(Tox *tox, int groupnumber, int peernumber, TOX_CHAT_CHANGE change, void *userdata) | ||
50 | */ | ||
51 | typedef enum { | ||
52 | TOX_CHAT_CHANGE_PEER_ADD, | ||
53 | TOX_CHAT_CHANGE_PEER_DEL, | ||
54 | TOX_CHAT_CHANGE_PEER_NAME, | ||
55 | } TOX_CHAT_CHANGE; | ||
56 | |||
57 | void tox_callback_group_namelist_change(Tox *tox, void (*function)(Tox *tox, int, int, uint8_t, void *), | ||
58 | void *userdata); | ||
59 | |||
60 | /* Creates a new groupchat and puts it in the chats array. | ||
61 | * | ||
62 | * return group number on success. | ||
63 | * return -1 on failure. | ||
64 | */ | ||
65 | int tox_add_groupchat(Tox *tox); | ||
66 | |||
67 | /* Delete a groupchat from the chats array. | ||
68 | * | ||
69 | * return 0 on success. | ||
70 | * return -1 if failure. | ||
71 | */ | ||
72 | int tox_del_groupchat(Tox *tox, int groupnumber); | ||
73 | |||
74 | /* Copy the name of peernumber who is in groupnumber to name. | ||
75 | * name must be at least TOX_MAX_NAME_LENGTH long. | ||
76 | * | ||
77 | * return length of name if success | ||
78 | * return -1 if failure | ||
79 | */ | ||
80 | int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name); | ||
81 | |||
82 | /* Copy the public key of peernumber who is in groupnumber to public_key. | ||
83 | * public_key must be TOX_PUBLIC_KEY_SIZE long. | ||
84 | * | ||
85 | * returns 0 on success | ||
86 | * returns -1 on failure | ||
87 | */ | ||
88 | int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *public_key); | ||
89 | |||
90 | /* invite friendnumber to groupnumber | ||
91 | * return 0 on success | ||
92 | * return -1 on failure | ||
93 | */ | ||
94 | int tox_invite_friend(Tox *tox, int32_t friendnumber, int groupnumber); | ||
95 | |||
96 | /* Join a group (you need to have been invited first.) using data of length obtained | ||
97 | * in the group invite callback. | ||
98 | * | ||
99 | * returns group number on success | ||
100 | * returns -1 on failure. | ||
101 | */ | ||
102 | int tox_join_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length); | ||
103 | |||
104 | /* send a group message | ||
105 | * return 0 on success | ||
106 | * return -1 on failure | ||
107 | */ | ||
108 | int tox_group_message_send(Tox *tox, int groupnumber, const uint8_t *message, uint16_t length); | ||
109 | |||
110 | /* send a group action | ||
111 | * return 0 on success | ||
112 | * return -1 on failure | ||
113 | */ | ||
114 | int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint16_t length); | ||
115 | |||
116 | /* set the group's title, limited to MAX_NAME_LENGTH | ||
117 | * return 0 on success | ||
118 | * return -1 on failure | ||
119 | */ | ||
120 | int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t length); | ||
121 | |||
122 | /* Get group title from groupnumber and put it in title. | ||
123 | * title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes. | ||
124 | * | ||
125 | * return length of copied title if success. | ||
126 | * return -1 if failure. | ||
127 | */ | ||
128 | int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title, uint32_t max_length); | ||
129 | |||
130 | /* Check if the current peernumber corresponds to ours. | ||
131 | * | ||
132 | * return 1 if the peernumber corresponds to ours. | ||
133 | * return 0 on failure. | ||
134 | */ | ||
135 | unsigned int tox_group_peernumber_is_ours(const Tox *tox, int groupnumber, int peernumber); | ||
136 | |||
137 | /* Return the number of peers in the group chat on success. | ||
138 | * return -1 on failure | ||
139 | */ | ||
140 | int tox_group_number_peers(const Tox *tox, int groupnumber); | ||
141 | |||
142 | /* List all the peers in the group chat. | ||
143 | * | ||
144 | * Copies the names of the peers to the name[length][TOX_MAX_NAME_LENGTH] array. | ||
145 | * | ||
146 | * Copies the lengths of the names to lengths[length] | ||
147 | * | ||
148 | * returns the number of peers on success. | ||
149 | * | ||
150 | * return -1 on failure. | ||
151 | */ | ||
152 | int tox_group_get_names(const Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t lengths[], | ||
153 | uint16_t length); | ||
154 | |||
155 | /* Return the number of chats in the instance m. | ||
156 | * You should use this to determine how much memory to allocate | ||
157 | * for copy_chatlist. */ | ||
158 | uint32_t tox_count_chatlist(const Tox *tox); | ||
159 | |||
160 | /* Copy a list of valid chat IDs into the array out_list. | ||
161 | * If out_list is NULL, returns 0. | ||
162 | * Otherwise, returns the number of elements copied. | ||
163 | * If the array was too small, the contents | ||
164 | * of out_list will be truncated to list_size. */ | ||
165 | uint32_t tox_get_chatlist(const Tox *tox, int32_t *out_list, uint32_t list_size); | ||
166 | |||
167 | /* return the type of groupchat (TOX_GROUPCHAT_TYPE_) that groupnumber is. | ||
168 | * | ||
169 | * return -1 on failure. | ||
170 | * return type on success. | ||
171 | */ | ||
172 | int tox_group_get_type(const Tox *tox, int groupnumber); | ||
173 | |||