summaryrefslogtreecommitdiff
path: root/toxcore/group_chats.c
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-21 01:27:53 +0200
committerCoren[m] <Break@Ocean>2013-09-21 01:27:53 +0200
commit89005f17018fcf829efee3cd243c84ef330becfc (patch)
tree7f4f584e810a5de0c637c066e13a5778a5dc02ad /toxcore/group_chats.c
parent13bd6aab187d481e51f45f74f64f5b92c7acf935 (diff)
parent20b6900fb181f71eca4577a5f1e1f5f3ecd6a28b (diff)
Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core.git into ipv6.yield50%toipv4
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)