mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
get peer pubkey api
This commit is contained in:
parent
4e6f993e7d
commit
6a52b3cb6c
|
@ -722,6 +722,26 @@ int del_groupchat(Group_Chats *g_c, int groupnumber)
|
|||
return wipe_group_chat(g_c, groupnumber);
|
||||
}
|
||||
|
||||
/* Copy the public key of peernumber who is in groupnumber to pk.
|
||||
* pk must be crypto_box_PUBLICKEYBYTES long.
|
||||
*
|
||||
* returns 0 on success
|
||||
* returns -1 on failure
|
||||
*/
|
||||
int group_peer_pubkey(const Group_Chats *g_c, int groupnumber, int peernumber, uint8_t *pk)
|
||||
{
|
||||
Group_c *g = get_group_c(g_c, groupnumber);
|
||||
|
||||
if (!g)
|
||||
return -1;
|
||||
|
||||
if ((uint32_t)peernumber >= g->numpeers)
|
||||
return -1;
|
||||
|
||||
memcpy(pk, g->group[peernumber].real_pk, crypto_box_PUBLICKEYBYTES);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy the name of peernumber who is in groupnumber to name.
|
||||
* name must be at least MAX_NAME_LENGTH long.
|
||||
*
|
||||
|
|
|
@ -192,6 +192,14 @@ int add_groupchat(Group_Chats *g_c, uint8_t type);
|
|||
*/
|
||||
int del_groupchat(Group_Chats *g_c, int groupnumber);
|
||||
|
||||
/* Copy the public key of peernumber who is in groupnumber to pk.
|
||||
* pk must be crypto_box_PUBLICKEYBYTES long.
|
||||
*
|
||||
* returns 0 on success
|
||||
* returns -1 on failure
|
||||
*/
|
||||
int group_peer_pubkey(const Group_Chats *g_c, int groupnumber, int peernumber, uint8_t *pk);
|
||||
|
||||
/* Copy the name of peernumber who is in groupnumber to name.
|
||||
* name must be at least MAX_NAME_LENGTH long.
|
||||
*
|
||||
|
|
|
@ -641,6 +641,18 @@ int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t
|
|||
return group_peername(m->group_chat_object, groupnumber, peernumber, name);
|
||||
}
|
||||
|
||||
/* Copy the public key of peernumber who is in groupnumber to pk.
|
||||
* pk must be TOX_CLIENT_ID_SIZE long.
|
||||
*
|
||||
* returns 0 on success
|
||||
* returns -1 on failure
|
||||
*/
|
||||
int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk)
|
||||
{
|
||||
const Messenger *m = tox;
|
||||
return group_peer_pubkey(m->group_chat_object, groupnumber, peernumber, pk);
|
||||
}
|
||||
|
||||
/* invite friendnumber to groupnumber
|
||||
* return 0 on success
|
||||
* return -1 on failure
|
||||
|
|
|
@ -496,6 +496,14 @@ int tox_del_groupchat(Tox *tox, int groupnumber);
|
|||
*/
|
||||
int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name);
|
||||
|
||||
/* Copy the public key of peernumber who is in groupnumber to pk.
|
||||
* pk must be TOX_CLIENT_ID_SIZE long.
|
||||
*
|
||||
* returns 0 on success
|
||||
* returns -1 on failure
|
||||
*/
|
||||
int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk);
|
||||
|
||||
/* invite friendnumber to groupnumber
|
||||
* return 0 on success
|
||||
* return -1 on failure
|
||||
|
|
Loading…
Reference in New Issue
Block a user