corrected comment and removed forced message for friend adds

This commit is contained in:
Jfreegman 2013-07-31 21:42:28 -04:00
parent c3b5fe3fa1
commit d8867b95c5

View File

@ -99,14 +99,15 @@ int getclient_id(int friend_id, uint8_t *client_id)
client_id is the client id of the friend client_id is the client id of the friend
data is the data and length is the length data is the data and length is the length
returns the friend number if success returns the friend number if success
return -1 if key length is wrong. return -1 if message length is too long
return -2 if user's own key return -2 if user's own key
return -3 if already a friend return -3 if already a friend
return -4 for other*/ return -4 for other*/
int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length) int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length)
{ {
if (length == 0 || length >= if (length >= (MAX_DATA_SIZE - crypto_box_PUBLICKEYBYTES
(MAX_DATA_SIZE - crypto_box_PUBLICKEYBYTES - crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES + crypto_box_ZEROBYTES)) - crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES
+ crypto_box_ZEROBYTES))
return -1; return -1;
if (memcmp(client_id, self_public_key, crypto_box_PUBLICKEYBYTES) == 0) if (memcmp(client_id, self_public_key, crypto_box_PUBLICKEYBYTES) == 0)
return -2; return -2;