<commit_before><?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");

class pfcCommand_kick extends pfcCommand
{
  var $usage = "/kick {nickname} [ {reason} ]";
  
  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $params      = $p["params"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
    
    $c =& $this->c;
    $u =& $this->u;

    $nick   = isset($params[0]) ? trim($params[0]) : '';
    $reason = isset($params[1]) ? $params[1] : '';
    if ($reason == '') $reason = _pfc("no reason");

    if ($nick == '')
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = _pfc("Missing parameter");
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }
    
    // kicking a user just add a command to play to the aimed user metadata.
    $ct =& $c->getContainerInstance();
    $otherid  = $ct->getNickId($nick);
    $channame = $u->channels[$recipientid]["name"];
    $cmdstr = 'leave';
    $cmdp = array();
    $cmdp['params'][] = $channame; // channel name
    $cmdp['params'][] = _pfc("kicked from %s by %s - reason: %s", $channame, $sender, $reason); // reason
    pfcCommand::AppendCmdToPlay($otherid, $cmdstr, $cmdp);
  }
}

?><commit_msg>Bug fix: the kick command was broken (thanks to http://sourceforge.net/tracker/index.php?func=detail&aid=1625158&group_id=158880&atid=809603)<commit_after><?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");

class pfcCommand_kick extends pfcCommand
{
  var $usage = "/kick {nickname} [ {reason} ]";
  
  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $params      = $p["params"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
    
    $c =& $this->c;
    $u =& $this->u;

    $nick   = isset($params[0]) ? trim($params[0]) : '';
    $reason = isset($params[1]) ? $params[1] : '';
    if ($reason == '') $reason = _pfc("no reason");

    if ($nick == '')
    {
      // error
      $cmdp = $p;
      $cmdp["param"] = _pfc("Missing parameter");
      $cmdp["param"] .= " (".$this->usage.")";
      $cmd =& pfcCommand::Factory("error");
      $cmd->run($xml_reponse, $cmdp);
      return;
    }
    
    // kicking a user just add a command to play to the aimed user metadata.
    $ct =& $c->getContainerInstance();
    $otherid  = $ct->getNickId($nick);
    $channame = $u->channels[$recipientid]["name"];
    $cmdstr = 'leave';
    $cmdp = array();
    $cmdp['params'][] = 'ch';
    $cmdp['params'][] = $channame; // channel name
    $cmdp['params'][] = _pfc("kicked from %s by %s - reason: %s", $channame, $sender, $reason); // reason
    pfcCommand::AppendCmdToPlay($otherid, $cmdstr, $cmdp);
  }
}

?>
{'fraction_non_alphanumeric': 0.2208904109589041, 'fraction_numerical': 0.009246575342465754, 'mean_word_length': 2.952638700947226, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3073336', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1066, 'n_words': 209}