Processes a message of type QUIT.

\param string $origin
Origin of the message to process.

\param Erebot::Interfaces::IrcTextWrapper $msg
The message to process, wrapped in
a special object that makes it easier
to analyze each token separately.
553509
protected function handleQUIT($origin, $msg)
    {
        // :nick1!ident@host QUIT :Reason
        return $this->connection->dispatch(
            $this->makeEvent('!Quit', $origin, $msg[0])
        );
    }
623336
public function processMessage(BaseAMQPMessage $msg)
    {
        $newMsg = new AMQPMessage($msg->body, $msg->get_properties());
        $newMsg->delivery_info = $msg->delivery_info;
        $newMsg->body_size = $msg->body_size;
        $newMsg->is_truncated = $msg->is_truncated;
        $newMsg->setQueueName($this->queueName);

        $processFlag = call_user_func($this->callback, $newMsg);
        $this->handleProcessMessage($newMsg, $processFlag);
    }
46757
protected function processPpcRun($message)
    {
        $result = $this->processPpcRunHelp($message);
        if (!$message['oneWay']) {
            $newMessage['result'] = $result;
            $newMessage['token'] = $message['token'];
            $data = get_instance()->packServerMessageBody(SwooleMarco::PROCESS_RPC_RESULT, $newMessage);
            $this->sendMessage($data, $message['worker_id']);
        }
    }
1019797
def process_origin(
        headers: Headers, origins: Optional[Sequence[Optional[Origin]]] = None
    ) -> Optional[Origin]:
        
        # "The user agent MUST NOT include more than one Origin header field"
        # per https://tools.ietf.org/html/rfc6454#section-7.3.
        try:
            origin = cast(Origin, headers.get("Origin"))
        except MultipleValuesError:
            raise InvalidHeader("Origin", "more than one Origin header found")
        if origins is not None:
            if origin not in origins:
                raise InvalidOrigin(origin)
        return origin
647789
public function handle(MessageInterface $message, EndpointInterface $endpointFrom)
    {
        $retries = 0;
        // If this is an exchange envelope, we extract the old exchange and prepare the new one
        if ($message && $message instanceof ExchangeEnvelope) {
            $oldExchange = $message->getBody();
            $exchange = new Exchange($oldExchange->getIn(), $oldExchange->getItinerary(), $oldExchange->getHeaders());

            if ($message instanceof RetryExchangeEnvelope) {
                $retries = $message->getRetries();
                $delaySinceLastRetry = round(microtime(true) * 1000) - $message->getHeader(RetryExchangeEnvelope::HEADER_LAST_RETRY_AT);
                $retryDelay = $message->getHeader(RetryExchangeEnvelope::HEADER_RETRY_DELAY) * 1000;

                $endpointURI = $message instanceof ThrottledExchangeEnvelope ? $this->throttleURI : $this->retryURI;

                if ($delaySinceLastRetry < $retryDelay) {
                    $this->deferExchangeMessage($message, $endpointURI);

                    return;
                }
            }
        }
        // Otherwise create the exchange
        else {
            $exchange = $this->createExchangeForMessageFromURI($message, $endpointFrom->getURI());
        }

        $this->onHandleStart($exchange);
        $result = $this->processExchange($exchange, $retries);
        $this->onHandleSuccess($exchange);
        return $result;
    }
198448
public function disconnect()
    {
        if ( $this->status != self::STATUS_NOT_CONNECTED )
        {
            $this->sendData( 'QUIT' );
            $replyCode = $this->getReplyCode( $error ) !== '221';
            fclose( $this->connection );
            $this->status = self::STATUS_NOT_CONNECTED;
            if ( $replyCode )
            {
                throw new ezcMailTransportSmtpException( "QUIT failed with error: $error." );
            }
        }
    }
1153336
private function handleRunningProcess(
        Process $process,
        &$runningCommand,
        &$failed,
        &$hasReceivedSignal,
        &$exitCode,
        &$exitCodeText
    ) {
        if ($process->isRunning()) {
            if ($hasReceivedSignal) {
                return;
            }
            //force it to shut down now!
            if ($this->shutdownNow) {
                $this->output->write("[RECEIVED SIGNAL] Shutting down now!");
                $process->stop(0);
                $hasReceivedSignal = true;
                $this->keepWorking = false;
                $runningCommand = false;
            }
            if ((!$this->keepWorking || $this->shutdownGracefully)) {
                //we need to keep this running until we are finished...
                $this->output->write("[RECEIVED SIGNAL] will shutdown after finishing task");
                $hasReceivedSignal = true;
            }
        } else {
            $runningCommand = false;
            $exitCode = $process->getExitCode();
            $exitCodeText = $process->getExitCode();
            if ($exitCode != 0) {
                $failed = true;
            }
        }
    }
1261440
public function stderr($msg, $status = self::STATUS_FAIL)
    {
        $msg = "<strong>".$msg."</strong>";
        $msg = $this->removeColors($msg);
        $msg = $this->replaceEOLs($msg);

        if (defined('STDERR')) {
            fwrite(STDERR, $msg);
        } else {
            echo $msg;
            if (count(\ob_get_status()) !== 0) {
                ob_flush();
            }
        }
        return $this;
    }
332631
protected function handleINVITE($origin, $msg)
    {
        // :nick1!ident@host INVITE nick2 :#chan
        return $this->connection->dispatch(
            $this->makeEvent('!Invite', $msg[1], $origin, $msg[0])
        );
    }
1109293
function terminateEC($error_msg = '', $kill_sess_vars = false, $goto_page = '') {
    global $messageStack, $order, $order_total_modules;
    $error_msg = trim($error_msg);
    if (substr($error_msg, -1) == '-') $error_msg = trim(substr($error_msg, 0, strlen($error_msg) - 1));
    $stackAlert = 'header';

    // debug
    $this->_doDebug('PayPal test Log - terminateEC-A', "goto page: " . $goto_page . "\nerror_msg: " . $error_msg . "\n\nSession data: " . print_r($_SESSION, true));

    if ($kill_sess_vars) {
      if (!empty($_SESSION['paypal_ec_temp'])) {
        $this->ec_delete_user($_SESSION['customer_id']);
      }
      // Unregister the paypal session variables, making the user start over.
      unset($_SESSION['paypal_ec_temp']);
      unset($_SESSION['paypal_ec_token']);
      unset($_SESSION['paypal_ec_payer_id']);
      unset($_SESSION['paypal_ec_payer_info']);
      unset($_SESSION['paypal_ec_final']);
      unset($_SESSION['paypal_ec_markflow']);
      // debug
      $this->zcLog('termEC-1', 'Killed the session vars as requested');
    }

    $this->zcLog('termEC-2', 'BEFORE: $this->showPaymentPage = ' . (int)$this->showPaymentPage . "\nToken Data:" . $_SESSION['paypal_ec_token']);
    // force display of payment page if GV/DC active for this customer
    if (MODULE_ORDER_TOTAL_INSTALLED && $this->showPaymentPage !== true && isset($_SESSION['paypal_ec_token']) ) {
      require_once(DIR_WS_CLASSES . 'order.php');
      $order = new order;
      require_once(DIR_WS_CLASSES . 'order_total.php');
      $order_total_modules = new order_total;
      $order_totals = $order_total_modules->process();
      $selection =  $order_total_modules->credit_selection();
      if (sizeof($selection)>0) $this->showPaymentPage = true;
    }
    // if came from Payment page, don't go back to it
    if ($_SESSION['paypal_ec_markflow'] == 1) $this->showPaymentPage = false;
    // if in DP mode, don't go to payment page ... we've already been there to get here
    if ($goto_page == FILENAME_CHECKOUT_PROCESS) $this->showPaymentPage = false;

    // debug
    $this->zcLog('termEC-3', 'AFTER: $this->showPaymentPage = ' . (int)$this->showPaymentPage);

    if (!empty($_SESSION['customer_first_name']) && !empty($_SESSION['customer_id'])) {
      if ($this->showPaymentPage === true || $goto_page == FILENAME_CHECKOUT_PAYMENT) {
        // debug
        $this->zcLog('termEC-4', 'We ARE logged in, and $this->showPaymentPage === true');
        // if no shipping selected or if shipping cost is < 0 goto shipping page
        if ((!$_SESSION['shipping'] || $_SESSION['shipping'] == '') || $_SESSION['shipping']['cost'] < 0) {
          // debug
          $this->zcLog('termEC-5', 'Have no shipping method selected, or shipping < 0 so set FILENAME_CHECKOUT_SHIPPING');
          $redirect_path = FILENAME_CHECKOUT_SHIPPING;
          $stackAlert = 'checkout_shipping';
        } else {
          // debug
          $this->zcLog('termEC-6', 'We DO have a shipping method selected, so goto PAYMENT');
          $redirect_path = FILENAME_CHECKOUT_PAYMENT;
          $stackAlert = 'checkout_payment';
        }
      } elseif ($goto_page) {
        // debug
        $this->zcLog('termEC-7', '$this->showPaymentPage NOT true, and have custom page parameter: ' . $goto_page);
        $redirect_path = $goto_page;
        $stackAlert = 'header';
        if ($goto_page == FILENAME_SHOPPING_CART) $stackAlert = 'shopping_cart';
      } else {
        // debug
        $this->zcLog('termEC-8', '$this->showPaymentPage NOT true, and NO custom page selected ... using SHIPPING as default');
        $redirect_path = FILENAME_CHECKOUT_SHIPPING;
        $stackAlert = 'checkout_shipping';
      }
    } else {
      // debug
      $this->zcLog('termEC-9', 'We are NOT logged in, so set snapshot to Shipping page, and redirect to login');
      $_SESSION['navigation']->set_snapshot(FILENAME_CHECKOUT_SHIPPING);
      $redirect_path = FILENAME_LOGIN;
      $stackAlert = 'login';
    }
    if ($error_msg) {
      $messageStack->add_session($stackAlert, $error_msg, 'error');
    }
    // debug
    $this->zcLog('termEC-10', 'Redirecting to ' . $redirect_path . ' - Stack: ' . $stackAlert . "\n" . 'Message: ' . $error_msg . "\nSession Data: " . print_r($_SESSION, true));
    zen_redirect(zen_href_link($redirect_path, '', 'SSL', true, false));
  }
335981
private function onMessage($msg, $socket) {
        try {
            $payload = @json_decode($msg, true);
            if (!$payload) {
                $this->response($socket, ['error' => 403, 'message' => 'error request']);

                return;
            }
            $command = isset($payload['command']) ? $payload['command'] : 'status';
            $service = isset($payload['args']['service']) ? $payload['args']['service'] : '';
            switch ($command) {
                case 'stop':
                    if ($service) {
                        $rst = $this->stopService($service);
                        $this->response($socket, ['status' => $rst ? 'done' : 'fail']);
                    } else {
                        $this->response($socket, ['status' => 'done']);
                        $this->shutdown = true;
                        $this->rSignal  = SIGTERM;
                    }
                    break;
                case 'start':
                    if ($service) {
                        $rst = $this->startService($service);
                        $this->response($socket, ['status' => $rst ? 'done' : 'fail']);
                    } else {
                        $this->response($socket, ['status' => 'fail']);
                    }
                    break;
                case 'reload':
                    $rst = $this->reloadConfig(null, $service);
                    $this->response($socket, ['status' => $rst ? 'done' : 'fail']);
                    break;
                case 'ps':
                    if ($service) {
                        if (isset($this->services[ $service ])) {
                            $pids = isset($this->services[ $service ]['pids']) ? $this->services[ $service ]['pids'] : [];
                            $this->response($socket, [
                                'ps'   => [$service => $pids],
                                'ssid' => posix_getpid()
                            ]);
                        } else {
                            $this->response($socket, ['ps' => [], 'ssid' => posix_getpid()]);
                        }
                    } else {
                        $ps = [];
                        foreach ($this->services as $s => $ser) {
                            $ps[ $s ] = isset($ser['pids']) ? $ser['pids'] : [];
                        }
                        $this->response($socket, ['ps' => $ps, 'ssid' => posix_getpid()]);
                    }
                    break;
                case 'status':
                default:
                    if ($service) {
                        if (isset($this->services[ $service ])) {
                            $this->response($socket, [
                                'status' => $this->services[ $service ]['status'],
                                'detail' => $this->services[ $service ]
                            ]);
                        } else {
                            $this->response($socket, ['status' => 'unknown', 'detail' => []]);
                        }
                    } else {
                        $this->response($socket, ['status' => 'running', 'services' => $this->services]);
                    }
            }
        } catch (\Exception $e) {
            $this->response($socket, ['error' => 500, 'msg' => $e->getMessage()]);
        }
    }
102548
protected function handleNICK($origin, $msg)
    {
        // :oldnick!ident@host NICK newnick
        return $this->connection->dispatch(
            $this->makeEvent('!Nick', $origin, $msg[0])
        );
    }
945856
public function trigger($eventName, $origin = null, $context = [], EventInterface $event = null)
    {
        if ($eventsHandler = $this->getEventsHandler()) {
            $eventsHandler->trigger($eventName, $origin, $context, $event);
        }
    }
105981
protected function quit()
        {
            // although RFC says QUIT can be issued at any time, we won't
            if ($this->state['helo']) {
                // [TODO] might need a try/catch here to cover some edge cases...
                $this->send('QUIT');
                $this->expect(self::SMTP_QUIT_SUCCESS, $this->command_timeouts['quit']);
            }
        }
851328
def exit(self, status=0, message=None):
        '''
        
        '''
        self.exited = True
        self.status = status

        if message is not None:
            self.outp.printf(message)
        raise s_exc.ParserExit(mesg=message, status=status)
970200
public static function fromMessage(Message $msg)
    {
        $workerHandlerId = $msg->shift();
        $requestId = $msg->shift();
        if (!$requestId) {
            $requestId = null;
        }

        return new self($workerHandlerId, $requestId);
    }
1061031
public function quit($quitmessage = null, $priority = SMARTIRC_CRITICAL)
    {
        if ($quitmessage !== null) {
            $this->send('QUIT :'.$quitmessage, $priority);
        } else {
            $this->send('QUIT', $priority);
        }

        return $this->disconnect(true);
    }