-
-/** RPC TKL Add */
-function rpc_tkl_add($name, $type, $expiry, $reason) : bool
-{
- GLOBAL $rpc;
-
- $params = ["name" => $name, "type" => $type, "reason" => $reason, "duration_string" => $expiry];
- $result = $rpc->query("server_ban.add", $params);
- if ($result->error)
- {
- $msg = "The $type could not be added: $name - ".$result->error->message . " (" . $result->error->code . ")";
- Message::Fail($msg);
- return false;
- }
- return true;
-}
-
-
-/** RPC TKL Delete */
-function rpc_tkl_del($name, $type) : bool
-{
- GLOBAL $rpc;
-
- $params = ["name" => $name, "type" => $type];
- $result = $rpc->query("server_ban.del", $params);
- if ($result->error)
- {
- $msg = "The $type could not be deleted: $name - ".$result->error->message . " (" . $result->error->code . ")";
- Message::Fail($msg);
- return false;
- }
- return true;
-}
-
-/** RPC Spamfilter Delete
- *
- */
-function rpc_sf_del($name, $mtype, $targets, $action) : bool
-{
- GLOBAL $rpc;
-
- $params = ["name" => $name, "match_type" => $mtype, "spamfilter_targets" => $targets, "ban_action" => $action, "set_by" => "YoMama"];
- $result = $rpc->query("spamfilter.del", $params);
- if ($result->error)
- {
- $msg = "The spamfilter entry could not be deleted: $name - ".$result['error']['message'] . " (" . $result['error']['code'] . ")";
- Message::Fail($msg);
- return false;
- }
- else
- {
- $r = $result->tkl;
- Message::Success("Deleted spamfilter entry: ".$r->name." [type: ".$r->match_type."] [targets: ".$r->spamfilter_targets. "] [action: ".$r->ban_action."] [reason: ".$r->reason."] [set by: ".$r->set_by."]");
- }
- return true;
-}
-