summaryrefslogtreecommitdiff
path: root/toxcore/group_chats.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-09-17 20:06:33 -0400
committerirungentoo <irungentoo@gmail.com>2013-09-17 20:06:33 -0400
commit7c5b98397a85394add318cf897eb5b78703e55ea (patch)
tree3a30952c38c4a52e726467723b59c58c681a7d2f /toxcore/group_chats.c
parent9ce1828facc5e344d9de7bc6900bd378de99a425 (diff)
parent5a83c1296cee5b0bfaae564896f56d78ae265fbc (diff)
Merge branch 'group-chat'
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)