mirror of
https://github.com/pissnet/pissircd.git
synced 2025-08-06 10:15:24 +01:00
RPC: server_ban: add handling of "expire_at".
Was previously always setting expiry to 5 seconds as a placeholder/TODO.
This commit is contained in:
parent
970cd60698
commit
6749ab4e0c
1 changed files with 7 additions and 2 deletions
|
@ -297,14 +297,19 @@ RPC_CALL_FUNC(rpc_server_ban_add)
|
|||
} else
|
||||
if ((str = json_object_get_string(params, "expire_at")))
|
||||
{
|
||||
// TODO: handle this
|
||||
tkl_expire_at = 5;
|
||||
tkl_expire_at = server_time_to_unix_time(str);
|
||||
} else
|
||||
{
|
||||
/* Never expire */
|
||||
tkl_expire_at = 0;
|
||||
}
|
||||
|
||||
if ((tkl_expire_at != 0) && (tkl_expire_at < TStime()))
|
||||
{
|
||||
rpc_error_fmt(client, NULL, JSON_RPC_ERROR_INVALID_PARAMS, "Error: the specified expiry time is before current time (before now)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server_ban_parse_mask(client, 0, tkl_type_int, name, &usermask, &hostmask, &soft, &error))
|
||||
{
|
||||
rpc_error_fmt(client, NULL, JSON_RPC_ERROR_INVALID_PARAMS, "Error: %s", error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue