mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-04 11:16:45 +02:00
make friend add fail if friend is in the block list
This commit is contained in:
@ -1240,6 +1240,26 @@ Tox_Connection get_friend_connection_status(uint32_t friendnumber)
|
||||
return Friends.list[friendnumber].connection_status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if friend associated with `public_key` is in the block list.
|
||||
*
|
||||
* `public_key` must be at least TOX_PUBLIC_KEY_SIZE bytes.
|
||||
*/
|
||||
bool friend_is_blocked(const char *public_key)
|
||||
{
|
||||
for (size_t i = 0; i < Blocked.max_idx; ++i) {
|
||||
if (!Blocked.list[i].active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (memcmp(public_key, Blocked.list[i].pub_key, TOX_PUBLIC_KEY_SIZE) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ToxWindow *new_friendlist(void)
|
||||
{
|
||||
ToxWindow *ret = calloc(1, sizeof(ToxWindow));
|
||||
|
Reference in New Issue
Block a user