<commit_before><?php

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

class pfcCommand_quit extends pfcCommand
{
  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
    
    $c =& $this->c;
    $u =& $this->u;

    // set the chat inactive
    $u->active = false;
    $u->saveInCache();

    // then remove the nickname file
    $container =& $c->getContainerInstance();
    $quitmsg = $param == "" ? _pfc("%s quit", $u->nick) : _pfc("%s quit (%s)", $u->nick, $param);
    
    // from the channels
    foreach( $u->channels as $id => $chandetail )
      if ($container->removeNick($chandetail["recipient"], $u->nickid))
      {
        $cmdp = $p;
        $cmdp["param"] = $id;
        $cmdp["recipient"] = $chandetail["recipient"];
        $cmdp["recipientid"] = $id;
        $cmd =& pfcCommand::Factory("leave");
        $cmd->run($xml_reponse, $cmdp);
      }
    // from the private messages
    foreach( $u->privmsg as $id => $pvdetail )
      if ($container->removeNick($pvdetail["recipient"], $u->nickid))
      {
        $cmdp = $p;
        $cmdp["param"] = $id;
        $cmdp["recipient"] = $pvdetail["recipient"];
        $cmdp["recipientid"] = $id;        
        $cmd =& pfcCommand::Factory("leave");
        $cmd->run($xml_reponse, $cmdp);
      }
    // from the server
    $container->removeNick(NULL, $u->nickid);

    $xml_reponse->addScript("pfc.handleResponse('quit', 'ok', '');");

    if ($c->debug) pxlog("/quit (a user just quit -> nick=".$u->nick.")", "chat", $c->getId());
  }
}

?><commit_msg>[en] Bug fix: when user quit a channel and join again this channel, the join message was not shown. [20min] [fr] Bug fix : lorsqu'un utilisateur quittait un salon puis revenait, le message signalant qu'il est revenu n'était pas affiché. [20min]<commit_after><?php

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

class pfcCommand_quit extends pfcCommand
{
  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
    
    $c =& $this->c;
    $u =& $this->u;

    // then remove the nickname file
    $ct =& $c->getContainerInstance();
    $quitmsg = $param == "" ? _pfc("%s quit", $u->nick) : _pfc("%s quit (%s)", $u->nick, $param);
    
    // from the channels
    foreach( $u->channels as $id => $chandetail )
      if ($ct->removeNick($chandetail["recipient"], $u->nickid))
      {
        $cmdp = $p;
        $cmdp["param"] = $id;
        $cmdp["recipient"] = $chandetail["recipient"];
        $cmdp["recipientid"] = $id;
        $cmd =& pfcCommand::Factory("leave");
        $cmd->run($xml_reponse, $cmdp);
      }
    // from the private messages
    foreach( $u->privmsg as $id => $pvdetail )
      if ($ct->removeNick($pvdetail["recipient"], $u->nickid))
      {
        $cmdp = $p;
        $cmdp["param"] = $id;
        $cmdp["recipient"] = $pvdetail["recipient"];
        $cmdp["recipientid"] = $id;        
        $cmd =& pfcCommand::Factory("leave");
        $cmd->run($xml_reponse, $cmdp);
      }
    // from the server
    $ct->removeNick(NULL, $u->nickid);

    // then set the chat inactive
    $u->active = false;
    $u->saveInCache();
    
    $xml_reponse->addScript("pfc.handleResponse('quit', 'ok', '');");

    if ($c->debug) pxlog("/quit (a user just quit -> nick=".$u->nick.")", "chat", $c->getId());
  }
}

?>
{'fraction_non_alphanumeric': 0.20805555555555555, 'fraction_numerical': 0.0011111111111111111, 'mean_word_length': 2.7200413223140494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '746340', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1262, 'n_words': 262}