summaryrefslogtreecommitdiff
path: root/toxcore/group_chats.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/group_chats.h')
-rw-r--r--toxcore/group_chats.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/toxcore/group_chats.h b/toxcore/group_chats.h
index 49b83c81..802d345b 100644
--- a/toxcore/group_chats.h
+++ b/toxcore/group_chats.h
@@ -62,9 +62,9 @@ typedef struct Group_Chat {
62 uint32_t numpeers; 62 uint32_t numpeers;
63 63
64 uint32_t message_number; 64 uint32_t message_number;
65 void (*group_message)(struct Group_Chat *m, int, uint8_t *, uint16_t, void *); 65 void (*group_message)(struct Group_Chat *m, int, const uint8_t *, uint16_t, void *);
66 void *group_message_userdata; 66 void *group_message_userdata;
67 void (*group_action)(struct Group_Chat *m, int, uint8_t *, uint16_t, void *); 67 void (*group_action)(struct Group_Chat *m, int, const uint8_t *, uint16_t, void *);
68 void *group_action_userdata; 68 void *group_action_userdata;
69 void (*peer_namelistchange)(struct Group_Chat *m, int peer, uint8_t change, void *); 69 void (*peer_namelistchange)(struct Group_Chat *m, int peer, uint8_t change, void *);
70 void *group_namelistchange_userdata; 70 void *group_namelistchange_userdata;
@@ -91,14 +91,14 @@ typedef struct Group_Chat {
91 * return length of name if success 91 * return length of name if success
92 * return -1 if failure 92 * return -1 if failure
93 */ 93 */
94int group_peername(Group_Chat *chat, int peernum, uint8_t *name); 94int group_peername(const Group_Chat *chat, int peernum, uint8_t *name);
95 95
96/* 96/*
97 * Set callback function for chat messages. 97 * Set callback function for chat messages.
98 * 98 *
99 * format of function is: function(Group_Chat *chat, peer number, message, message length, userdata) 99 * format of function is: function(Group_Chat *chat, peer number, message, message length, userdata)
100 */ 100 */
101void callback_groupmessage(Group_Chat *chat, void (*function)(Group_Chat *chat, int, uint8_t *, uint16_t, void *), 101void callback_groupmessage(Group_Chat *chat, void (*function)(Group_Chat *chat, int, const uint8_t *, uint16_t, void *),
102 void *userdata); 102 void *userdata);
103 103
104/* 104/*
@@ -106,7 +106,7 @@ void callback_groupmessage(Group_Chat *chat, void (*function)(Group_Chat *chat,
106 * 106 *
107 * format of function is: function(Group_Chat *chat, peer number, action, action length, userdata) 107 * format of function is: function(Group_Chat *chat, peer number, action, action length, userdata)
108 */ 108 */
109void callback_groupaction(Group_Chat *chat, void (*function)(Group_Chat *chat, int, uint8_t *, uint16_t, void *), 109void callback_groupaction(Group_Chat *chat, void (*function)(Group_Chat *chat, int, const uint8_t *, uint16_t, void *),
110 void *userdata); 110 void *userdata);
111 111
112/* 112/*
@@ -130,14 +130,14 @@ void callback_namelistchange(Group_Chat *chat, void (*function)(Group_Chat *chat
130 * 130 *
131 * returns the number of peers it has sent it to. 131 * returns the number of peers it has sent it to.
132 */ 132 */
133uint32_t group_sendmessage(Group_Chat *chat, uint8_t *message, uint32_t length); 133uint32_t group_sendmessage(Group_Chat *chat, const uint8_t *message, uint32_t length);
134 134
135/* 135/*
136 * Send an action to the group. 136 * Send an action to the group.
137 * 137 *
138 * returns the number of peers it has sent it to. 138 * returns the number of peers it has sent it to.
139 */ 139 */
140uint32_t group_sendaction(Group_Chat *chat, uint8_t *action, uint32_t length); 140uint32_t group_sendaction(Group_Chat *chat, const uint8_t *action, uint32_t length);
141 141
142/* 142/*
143 * Set our nick for this group. 143 * Set our nick for this group.
@@ -150,7 +150,7 @@ int set_nick(Group_Chat *chat, const uint8_t *nick, uint16_t nick_len);
150 * Tell everyone about a new peer (a person we are inviting for example.) 150 * Tell everyone about a new peer (a person we are inviting for example.)
151 * 151 *
152 */ 152 */
153uint32_t group_newpeer(Group_Chat *chat, uint8_t *client_id); 153uint32_t group_newpeer(Group_Chat *chat, const uint8_t *client_id);
154 154
155 155
156/* Create a new group chat. 156/* Create a new group chat.
@@ -164,7 +164,7 @@ Group_Chat *new_groupchat(Networking_Core *net);
164 164
165/* Return the number of peers in the group chat. 165/* Return the number of peers in the group chat.
166 */ 166 */
167uint32_t group_numpeers(Group_Chat *chat); 167uint32_t group_numpeers(const Group_Chat *chat);
168 168
169/* List all the peers in the group chat. 169/* List all the peers in the group chat.
170 * 170 *
@@ -172,7 +172,7 @@ uint32_t group_numpeers(Group_Chat *chat);
172 * 172 *
173 * returns the number of peers. 173 * returns the number of peers.
174 */ 174 */
175uint32_t group_client_names(Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length); 175uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length);
176 176
177/* Kill a group chat 177/* Kill a group chat
178 * 178 *
@@ -188,11 +188,11 @@ void do_groupchat(Group_Chat *chat);
188/* if we receive a group chat packet we call this function so it can be handled. 188/* if we receive a group chat packet we call this function so it can be handled.
189 return 0 if packet is handled correctly. 189 return 0 if packet is handled correctly.
190 return 1 if it didn't handle the packet or if the packet was shit. */ 190 return 1 if it didn't handle the packet or if the packet was shit. */
191int handle_groupchatpacket(Group_Chat *chat, IP_Port source, uint8_t *packet, uint32_t length); 191int handle_groupchatpacket(Group_Chat *chat, IP_Port source, const uint8_t *packet, uint32_t length);
192 192
193 193
194void chat_bootstrap(Group_Chat *chat, IP_Port ip_port, uint8_t *client_id); 194void chat_bootstrap(Group_Chat *chat, IP_Port ip_port, const uint8_t *client_id);
195void chat_bootstrap_nonlazy(Group_Chat *chat, IP_Port ip_port, uint8_t *client_id); 195void chat_bootstrap_nonlazy(Group_Chat *chat, IP_Port ip_port, const uint8_t *client_id);
196 196
197 197
198#endif 198#endif