Added conversion from friend_id to client_id

This commit is contained in:
Maxim Biro 2013-07-13 17:44:43 -04:00
parent d63d63de9b
commit c2fb803ad5
2 changed files with 25 additions and 0 deletions

View File

@ -66,6 +66,25 @@ int getfriend_id(uint8_t * client_id)
return -1;
}
//copies the public key associated to that friend id into client_id buffer.
//make sure that client_id is of size CLIENT_ID_SIZE.
//returns 0 if success
//return -1 if failure.
int getclient_id(int friend_id, uint8_t * client_id)
{
if(friendnumber >= numfriends || friendnumber < 0)
{
return -1;
}
if(friendlist[friend_id].status > 0)
{
memcpy(client_id, friendlist[friend_id].client_id, CLIENT_ID_SIZE);
return 0;
}
return -1;
}
//add a friend
//set the data that will be sent along with friend request

View File

@ -49,6 +49,12 @@ int m_addfriend_norequest(uint8_t * client_id);
//return -1 if no such friend
int getfriend_id(uint8_t * client_id);
//copies the public key associated to that friend id into client_id buffer.
//make sure that client_id is of size CLIENT_ID_SIZE.
//returns 0 if success
//return -1 if failure.
int getclient_id(int friend_id, uint8_t * client_id)
//remove a friend
int m_delfriend(int friendnumber);