summaryrefslogtreecommitdiff
path: root/core/Messenger.c
diff options
context:
space:
mode:
authorJfreegman <Jfreegman@gmail.com>2013-07-31 21:42:28 -0400
committerJfreegman <Jfreegman@gmail.com>2013-07-31 21:42:28 -0400
commitd8867b95c5923802cc6957599c8909ce0e55805a (patch)
treeab8131a4d4d16b91bb49c19a3253b18ad3b6257b /core/Messenger.c
parentc3b5fe3fa154e60d46d647f7928cab48ec4012a0 (diff)
corrected comment and removed forced message for friend adds
Diffstat (limited to 'core/Messenger.c')
-rw-r--r--core/Messenger.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/Messenger.c b/core/Messenger.c
index eb59b81a..49f638df 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -99,14 +99,15 @@ int getclient_id(int friend_id, uint8_t *client_id)
99 client_id is the client id of the friend 99 client_id is the client id of the friend
100 data is the data and length is the length 100 data is the data and length is the length
101 returns the friend number if success 101 returns the friend number if success
102 return -1 if key length is wrong. 102 return -1 if message length is too long
103 return -2 if user's own key 103 return -2 if user's own key
104 return -3 if already a friend 104 return -3 if already a friend
105 return -4 for other*/ 105 return -4 for other*/
106int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length) 106int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length)
107{ 107{
108 if (length == 0 || length >= 108 if (length >= (MAX_DATA_SIZE - crypto_box_PUBLICKEYBYTES
109 (MAX_DATA_SIZE - crypto_box_PUBLICKEYBYTES - crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES + crypto_box_ZEROBYTES)) 109 - crypto_box_NONCEBYTES - crypto_box_BOXZEROBYTES
110 + crypto_box_ZEROBYTES))
110 return -1; 111 return -1;
111 if (memcmp(client_id, self_public_key, crypto_box_PUBLICKEYBYTES) == 0) 112 if (memcmp(client_id, self_public_key, crypto_box_PUBLICKEYBYTES) == 0)
112 return -2; 113 return -2;