Actually care about max_friend_requests.

This commit is contained in:
Håvard Pettersson 2014-10-11 11:48:24 +02:00
parent 270fc20989
commit 328ac28aa8

View File

@ -40,6 +40,12 @@ twc_friend_request_add(struct t_twc_profile *profile,
const uint8_t *client_id,
const char *message)
{
int max_request_count =
TWC_PROFILE_OPTION_INTEGER(profile, TWC_PROFILE_OPTION_MAX_FRIEND_REQUESTS);
int current_request_count = twc_sqlite_friend_request_count(profile);
if (current_request_count >= max_request_count)
return -1;
// create a new request
struct t_twc_friend_request *request
= malloc(sizeof(struct t_twc_friend_request));