summaryrefslogtreecommitdiff
path: root/toxcore/group_chats.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/group_chats.c')
-rw-r--r--toxcore/group_chats.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/toxcore/group_chats.c b/toxcore/group_chats.c
index f37c6a9c..dc8e158b 100644
--- a/toxcore/group_chats.c
+++ b/toxcore/group_chats.c
@@ -278,6 +278,28 @@ static int delpeer(Group_Chat *chat, uint8_t *client_id)
278 278
279 return -1; 279 return -1;
280} 280}
281
282/* Copy the name of peernum to name.
283 * name must be at least MAX_NICK_BYTES long.
284 *
285 * return length of name if success
286 * return -1 if failure
287 */
288int group_peername(Group_Chat *chat, int peernum, uint8_t *name)
289{
290 if ((uint32_t)peernum >= chat->numpeers)
291 return -1;
292
293 if (chat->group[peernum].nick_len == 0) {
294 memcpy(name, "NSA Agent", 10); /* Kindly remind the user that someone with no name might be a NSA agent.*/
295 return 10;
296 }
297
298 memcpy(name, chat->group[peernum].nick, chat->group[peernum].nick_len);
299 return chat->group[peernum].nick_len;
300}
301
302
281/* min time between pings sent to one peer in seconds */ 303/* min time between pings sent to one peer in seconds */
282#define PING_TIMEOUT 5 304#define PING_TIMEOUT 5
283static int send_getnodes(Group_Chat *chat, IP_Port ip_port, int peernum) 305static int send_getnodes(Group_Chat *chat, IP_Port ip_port, int peernum)