summaryrefslogtreecommitdiff
path: root/toxcore/group.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-07 17:18:19 +0100
committerJfreegman <jfreegman@gmail.com>2016-09-17 19:11:28 -0400
commitc0397a0a4614671679d409c428b47549a01fdf7f (patch)
tree525f0efd2241dc921588949598cd8a1767d19425 /toxcore/group.h
parent21f8db12c45bd56293262cd4abfb73cd9abec821 (diff)
ApiDSL'ing old group chats (now: conference).
Diffstat (limited to 'toxcore/group.h')
-rw-r--r--toxcore/group.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/toxcore/group.h b/toxcore/group.h
index 56151402..6d278dde 100644
--- a/toxcore/group.h
+++ b/toxcore/group.h
@@ -116,15 +116,13 @@ typedef struct {
116 Group_c *chats; 116 Group_c *chats;
117 uint32_t num_chats; 117 uint32_t num_chats;
118 118
119 void (*invite_callback)(Messenger *m, int32_t, uint8_t, const uint8_t *, uint16_t, void *); 119 void (*invite_callback)(Messenger *m, uint32_t, int, const uint8_t *, size_t, void *);
120 void *invite_callback_userdata; 120 void *invite_callback_userdata;
121 void (*message_callback)(Messenger *m, int, int, const uint8_t *, uint16_t, void *); 121 void (*message_callback)(Messenger *m, uint32_t, uint32_t, int, const uint8_t *, size_t, void *);
122 void *message_callback_userdata; 122 void *message_callback_userdata;
123 void (*action_callback)(Messenger *m, int, int, const uint8_t *, uint16_t, void *);
124 void *action_callback_userdata;
125 void (*peer_namelistchange)(Messenger *m, int, int, uint8_t, void *); 123 void (*peer_namelistchange)(Messenger *m, int, int, uint8_t, void *);
126 void *group_namelistchange_userdata; 124 void *group_namelistchange_userdata;
127 void (*title_callback)(Messenger *m, int, int, const uint8_t *, uint8_t, void *); 125 void (*title_callback)(Messenger *m, uint32_t, uint32_t, const uint8_t *, size_t, void *);
128 void *title_callback_userdata; 126 void *title_callback_userdata;
129 127
130 struct { 128 struct {
@@ -138,29 +136,25 @@ typedef struct {
138 * 136 *
139 * data of length is what needs to be passed to join_groupchat(). 137 * data of length is what needs to be passed to join_groupchat().
140 */ 138 */
141void g_callback_group_invite(Group_Chats *g_c, void (*function)(Messenger *m, int32_t, uint8_t, const uint8_t *, 139void g_callback_group_invite(Group_Chats *g_c, void (*function)(Messenger *m, uint32_t, int, const uint8_t *,
142 uint16_t, void *), void *userdata); 140 size_t, void *), void *userdata);
143 141
144/* Set the callback for group messages. 142/* Set the callback for group messages.
145 * 143 *
146 * Function(Group_Chats *g_c, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata) 144 * Function(Group_Chats *g_c, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata)
147 */ 145 */
148void g_callback_group_message(Group_Chats *g_c, void (*function)(Messenger *m, int, int, const uint8_t *, uint16_t, 146void g_callback_group_message(Group_Chats *g_c, void (*function)(Messenger *m, uint32_t, uint32_t, int, const uint8_t *,
147 size_t,
149 void *), void *userdata); 148 void *), void *userdata);
150 149
151/* Set the callback for group actions.
152 *
153 * Function(Group_Chats *g_c, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata)
154 */
155void g_callback_group_action(Group_Chats *g_c, void (*function)(Messenger *m, int, int, const uint8_t *, uint16_t,
156 void *), void *userdata);
157 150
158/* Set callback function for title changes. 151/* Set callback function for title changes.
159 * 152 *
160 * Function(Group_Chats *g_c, int groupnumber, int friendgroupnumber, uint8_t * title, uint8_t length, void *userdata) 153 * Function(Group_Chats *g_c, int groupnumber, int friendgroupnumber, uint8_t * title, uint8_t length, void *userdata)
161 * if friendgroupnumber == -1, then author is unknown (e.g. initial joining the group) 154 * if friendgroupnumber == -1, then author is unknown (e.g. initial joining the group)
162 */ 155 */
163void g_callback_group_title(Group_Chats *g_c, void (*function)(Messenger *m, int, int, const uint8_t *, uint8_t, 156void g_callback_group_title(Group_Chats *g_c, void (*function)(Messenger *m, uint32_t, uint32_t, const uint8_t *,
157 size_t,
164 void *), void *userdata); 158 void *), void *userdata);
165 159
166/* Set callback function for peer name list changes. 160/* Set callback function for peer name list changes.
@@ -200,6 +194,8 @@ int del_groupchat(Group_Chats *g_c, int groupnumber);
200 */ 194 */
201int group_peer_pubkey(const Group_Chats *g_c, int groupnumber, int peernumber, uint8_t *pk); 195int group_peer_pubkey(const Group_Chats *g_c, int groupnumber, int peernumber, uint8_t *pk);
202 196
197int group_peername_size(const Group_Chats *g_c, int groupnumber, int peernumber);
198
203/* Copy the name of peernumber who is in groupnumber to name. 199/* Copy the name of peernumber who is in groupnumber to name.
204 * name must be at least MAX_NAME_LENGTH long. 200 * name must be at least MAX_NAME_LENGTH long.
205 * 201 *
@@ -242,13 +238,15 @@ int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *ac
242int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *title, uint8_t title_len); 238int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *title, uint8_t title_len);
243 239
244 240
241int group_title_get_size(const Group_Chats *g_c, int groupnumber);
242
245/* Get group title from groupnumber and put it in title. 243/* Get group title from groupnumber and put it in title.
246 * title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes. 244 * title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes.
247 * 245 *
248 * return length of copied title if success. 246 * return length of copied title if success.
249 * return -1 if failure. 247 * return -1 if failure.
250 */ 248 */
251int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title, uint32_t max_length); 249int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title);
252 250
253/* Return the number of peers in the group chat on success. 251/* Return the number of peers in the group chat on success.
254 * return -1 on failure 252 * return -1 on failure