]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - Classes/class-rpc.php
Allow adding spamfilter entries
[irc/unrealircd/unrealircd-webpanel.git] / Classes / class-rpc.php
index aa2161ab1f5e755b5c5d23b268326f739ad2181d..a952d0974a773f5493621b5e1b3b3d5120342ccd 100644 (file)
@@ -37,7 +37,7 @@ function rpc_pop_lists()
        $ret = $rpc->user()->getAll();
        // TODO: error checking
 
-       foreach($ret->list as $r)
+       foreach($ret as $r)
        {
                RPC_List::$user[] = $r;
                if (strpos($r->user->modes,"o") !== false && strpos($r->user->modes,"S") == false)
@@ -48,7 +48,7 @@ function rpc_pop_lists()
 
        /* Get the channels list */
        $ret = $rpc->channel()->getAll();
-       foreach($ret->list as $r)
+       foreach($ret as $r)
        {
                RPC_List::$channel[] = $r;
                if ($r->num_users > RPC_List::$channel_pop_count)
@@ -60,40 +60,16 @@ function rpc_pop_lists()
 
        /* Get the tkl list */
        $ret = $rpc->serverban()->getAll();
-       foreach($ret->list as $r)
+       foreach($ret as $r)
                RPC_List::$tkl[] = $r;
 
        /* Get the spamfilter list */
-       $ret = $rpc->query("spamfilter.list");
-       // TODO: convert to new style
-       foreach($ret->list as $r)
+       $ret = $rpc->spamfilter()->getAll();
+       foreach($ret as $r)
                RPC_List::$spamfilter[] = $r;
 
 }
 
-/** RPC Spamfilter Delete
- * TODO: get rid of this, use unrealircd-rpc-php api when the call is there...
- */
-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;
-}
-
 /** Convert the duration_string */
 function rpc_convert_duration_string($str)
 {