m_addfriend_norequest now prevents you from adding your own id as friend.

This commit is contained in:
irungentoo 2013-10-05 09:09:28 -04:00
parent edf799133c
commit b0f9e6db6f

View File

@ -220,6 +220,9 @@ int m_addfriend_norequest(Messenger *m, uint8_t *client_id)
if (realloc_friendlist(m, m->numfriends + 1) != 0) if (realloc_friendlist(m, m->numfriends + 1) != 0)
return FAERR_NOMEM; return FAERR_NOMEM;
if (memcmp(client_id, m->net_crypto->self_public_key, crypto_box_PUBLICKEYBYTES) == 0)
return FAERR_OWNKEY;
memset(&(m->friendlist[m->numfriends]), 0, sizeof(Friend)); memset(&(m->friendlist[m->numfriends]), 0, sizeof(Friend));
uint32_t i; uint32_t i;