Sends the whole message source to stdout

@param int  $uid       Message UID
@param bool $formatted Enables line-ending formatting
163728
public function print_raw_body($uid, $formatted = true)
    {
        if (!$this->check_connection()) {
            return;
        }

        $this->conn->handlePartBody($this->folder, $uid, true, null, null, true, null, $formatted);
    }
245563
public void send(String format, Object... args) {
        checkCommitted();

        commit(StringUtils.format(format, args));
    }
1321385
public function write($message, $newLine = false, $formatType = self::OUTPUT_NORMAL) {
        if ($formatType === self::OUTPUT_NORMAL) {
            $message = $this->getFormatter()->format($message);
        }

        if ($newLine) {
            $message .= \PHP_EOL;
        }
        return \fwrite($this->stream, $message);
    }
982770
protected function kickUid($uid)
    {
        if (Start::$testUnity) {
            $this->testUnitSendStack[] = ['action' => 'kickUid', 'uid' => $uid];
        } else {
            get_instance()->kickUid($uid);
        }
    }
1139471
public function dump($formatOutput = true)
    {
        // Format output
        if ($formatOutput === true) {
            $this->dom->formatOutput = true;
        }

        return $this->dom->saveXML();
    }
222433
public function handlePartBody($mailbox, $id, $is_uid=false, $part='', $encoding=null, $print=null, $file=null, $formatted=false, $max_bytes=0)
    {
        if (!$this->select($mailbox)) {
            return false;
        }

        $binary = true;

        do {
            if (!$initiated) {
                switch ($encoding) {
                case 'base64':
                    $mode = 1;
                    break;
                case 'quoted-printable':
                    $mode = 2;
                    break;
                case 'x-uuencode':
                case 'x-uue':
                case 'uue':
                case 'uuencode':
                    $mode = 3;
                    break;
                default:
                    $mode = 0;
                }

                // Use BINARY extension when possible (and safe)
                $binary     = $binary && $mode && preg_match('/^[0-9.]+$/', $part) && $this->hasCapability('BINARY');
                $fetch_mode = $binary ? 'BINARY' : 'BODY';
                $partial    = $max_bytes ? sprintf('<0.%d>', $max_bytes) : '';

                // format request
                $key       = $this->nextTag();
                $cmd       = ($is_uid ? 'UID ' : '') . 'FETCH';
                $request   = "$key $cmd $id ($fetch_mode.PEEK[$part]$partial)";
                $result    = false;
                $found     = false;
                $initiated = true;

                // send request
                if (!$this->putLine($request)) {
                    $this->setError(self::ERROR_COMMAND, "Failed to send $cmd command");
                    return false;
                }

                if ($binary) {
                    // WARNING: Use $formatted argument with care, this may break binary data stream
                    $mode = -1;
                }
            }

            $line = trim($this->readLine(1024));

            if (!$line) {
                break;
            }

            // handle UNKNOWN-CTE response - RFC 3516, try again with standard BODY request
            if ($binary && !$found && preg_match('/^' . $key . ' NO \[(UNKNOWN-CTE|PARSE)\]/i', $line)) {
                $binary = $initiated = false;
                continue;
            }

            // skip irrelevant untagged responses (we have a result already)
            if ($found || !preg_match('/^\* ([0-9]+) FETCH (.*)$/', $line, $m)) {
                continue;
            }

            $line = $m[2];

            // handle one line response
            if ($line[0] == '(' && substr($line, -1) == ')') {
                // tokenize content inside brackets
                // the content can be e.g.: (UID 9844 BODY[2.4] NIL)
                $tokens = $this->tokenizeResponse(preg_replace('/(^\(|\)$)/', '', $line));

                for ($i=0; $i<count($tokens); $i+=2) {
                    if (preg_match('/^(BODY|BINARY)/i', $tokens[$i])) {
                        $result = $tokens[$i+1];
                        $found  = true;
                        break;
                    }
                }

                if ($result !== false) {
                    if ($mode == 1) {
                        $result = base64_decode($result);
                    }
                    else if ($mode == 2) {
                        $result = quoted_printable_decode($result);
                    }
                    else if ($mode == 3) {
                        $result = convert_uudecode($result);
                    }
                }
            }
            // response with string literal
            else if (preg_match('/\{([0-9]+)\}$/', $line, $m)) {
                $bytes = (int) $m[1];
                $prev  = '';
                $found = true;

                // empty body
                if (!$bytes) {
                    $result = '';
                }
                else while ($bytes > 0) {
                    $line = $this->readLine(8192);

                    if ($line === null) {
                        break;
                    }

                    $len = strlen($line);

                    if ($len > $bytes) {
                        $line = substr($line, 0, $bytes);
                        $len  = strlen($line);
                    }
                    $bytes -= $len;

                    // BASE64
                    if ($mode == 1) {
                        $line = preg_replace('|[^a-zA-Z0-9+=/]|', '', $line);
                        // create chunks with proper length for base64 decoding
                        $line = $prev.$line;
                        $length = strlen($line);
                        if ($length % 4) {
                            $length = floor($length / 4) * 4;
                            $prev = substr($line, $length);
                            $line = substr($line, 0, $length);
                        }
                        else {
                            $prev = '';
                        }
                        $line = base64_decode($line);
                    }
                    // QUOTED-PRINTABLE
                    else if ($mode == 2) {
                        $line = rtrim($line, "\t\r\0\x0B");
                        $line = quoted_printable_decode($line);
                    }
                    // UUENCODE
                    else if ($mode == 3) {
                        $line = rtrim($line, "\t\r\n\0\x0B");
                        if ($line == 'end' || preg_match('/^begin\s+[0-7]+\s+.+$/', $line)) {
                            continue;
                        }
                        $line = convert_uudecode($line);
                    }
                    // default
                    else if ($formatted) {
                        $line = rtrim($line, "\t\r\n\0\x0B") . "\n";
                    }

                    if ($file) {
                        if (fwrite($file, $line) === false) {
                            break;
                        }
                    }
                    else if ($print) {
                        echo $line;
                    }
                    else {
                        $result .= $line;
                    }
                }
            }
        }
        while (!$this->startsWith($line, $key, true) || !$initiated);

        if ($result !== false) {
            if ($file) {
                return fwrite($file, $result);
            }
            else if ($print) {
                echo $result;
                return true;
            }

            return $result;
        }

        return false;
    }
226520
function send_dm_by_id( $uid, $text, $id = NULL )
	{
		$params = array();
		$this->id_format( $uid );
		$params['text'] = $text;
		$params['uid'] = $uid;
		if ($id) {
			$this->id_format( $id );
			$params['id'] = $id;
		}
		return $this->oauth->post( 'direct_messages/new', $params );
	}
1161508
public function sendMessage($userIds, $text, $pinId = null)
    {
        return $this->send($pinId, $text, $userIds, []);
    }
257154
public static function ean($str, bool $formatted=false) {
		ref\sanitize::ean($str, $formatted);
		return $str;
	}
286437
public function my_addUid($uid)
    {
        $this->map[$this->node_name]->add($uid);
        foreach ($this->client as $client) {
            $client->addNodeUid($this->node_name, $uid);
        }
        if (Start::isLeader()) {
            get_instance()->pub('$SYS/uidcount', $this->countOnline());
        }
    }
398662
private function addFormatFromFormatNode(\DOMNode $formatNode, &$formats)
    {
        $key = $this->getKeyFromFormatNode($formatNode);
        $internal = $this->getInternalFlagFromFormatNode($formatNode);

        $meta = $this->getMetaFromFormatNode($formatNode);
        $scale = $this->getScaleFromFormatNode($formatNode);
        $transformations = $this->getTransformationsFromFormatNode($formatNode);
        $options = $this->getOptionsFromFormatNode($formatNode);

        $formats[$key] = [
            'key' => $key,
            'internal' => $internal,
            'meta' => $meta,
            'scale' => $scale,
            'transformations' => $transformations,
            'options' => array_merge($this->globalOptions, $options),
        ];
    }
676179
private function printAndCaptureOutlineHeaderOnBeforeEvent(Formatter $formatter, Event $event)
    {
        if (!$event instanceof BeforeOutlineTested) {
            return;
        }

        $this->outlinePrinter->printHeader($formatter, $event->getFeature(), $event->getOutline());
    }
954047
public function sendToUid($uid, $data, $fromDispatch = false)
    {
        if ($this->uid_fd_table->exist($uid)) {//本机处理
            $fd = $this->uid_fd_table->get($uid)['fd'];
            $this->send($fd, $data, true);
        } else {
            if ($fromDispatch) {
                $this->onUidSendFail($uid, $data, null);

                return;
            }
            if ($this->isCluster()) {
                ProcessManager::getInstance()->getRpcCall(ClusterProcess::class, true)->my_sendToUid($uid, $data);
            } else {
                $this->onUidSendFail($uid, $data, null);
            }
        }
    }
372290
public function formatQuery(array $data, array $formatted = array())
	{
		// Convert dot notation to multidimensional array elements.
		foreach ($data as $key => $value)
		{
			array_set($formatted, $key, $value);
		}
		return $formatted;
	}
464675
public function pubToUid($uid, $data, $topic)
    {
        if ($this->uid_fd_table->exist($uid)) {
            $fd = $this->uid_fd_table->get($uid)['fd'];
            $result = $this->send($fd, $data, true, $topic);
            if (!$result) {
                $this->onUidSendFail($uid, $data, $topic);
            }
        } else {
            $this->onUidSendFail($uid, $data, $topic);
        }
    }
627499
public function send($mailer, $resend = false, $flowed = true)
    {
        /* Add mandatory headers if missing. */
        if (!$resend || !isset($this->_headers['Message-ID'])) {
            $this->_headers->addHeaderOb(
                Horde_Mime_Headers_MessageId::create()
            );
        }
        if (!isset($this->_headers['User-Agent'])) {
            $this->_headers->addHeaderOb(
                Horde_Mime_Headers_UserAgent::create()
            );
        }
        if (!$resend || !isset($this->_headers['Date'])) {
            $this->_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
        }

        if (isset($this->_base)) {
            $basepart = $this->_base;
        } else {
            /* Send in flowed format. */
            if ($flowed && !empty($this->_body)) {
                $flowed = new Horde_Text_Flowed($this->_body->getContents(), $this->_body->getCharset());
                $flowed->setDelSp(true);
                $this->_body->setContentTypeParameter('format', 'flowed');
                $this->_body->setContentTypeParameter('DelSp', 'Yes');
                $this->_body->setContents($flowed->toFlowed());
            }

            /* Build mime message. */
            $body = new Horde_Mime_Part();
            if (!empty($this->_body) && !empty($this->_htmlBody)) {
                $body->setType('multipart/alternative');
                $this->_body->setDescription(Horde_Mime_Translation::t("Plaintext Version of Message"));
                $body[] = $this->_body;
                $this->_htmlBody->setDescription(Horde_Mime_Translation::t("HTML Version of Message"));
                $body[] = $this->_htmlBody;
            } elseif (!empty($this->_htmlBody)) {
                $body = $this->_htmlBody;
            } elseif (!empty($this->_body)) {
                $body = $this->_body;
            }
            if (count($this->_parts)) {
                $basepart = new Horde_Mime_Part();
                $basepart->setType('multipart/mixed');
                $basepart->isBasePart(true);
                if ($body) {
                    $basepart[] = $body;
                }
                foreach ($this->_parts as $mime_part) {
                    $basepart[] = $mime_part;
                }
            } else {
                $basepart = $body;
                $basepart->isBasePart(true);
            }
        }
        $basepart->setHeaderCharset($this->_charset);

        /* Build recipients. */
        $recipients = clone $this->_recipients;
        foreach (array('to', 'cc') as $header) {
            if ($h = $this->_headers[$header]) {
                $recipients->add($h->getAddressList());
            }
        }
        if ($this->_bcc) {
            $recipients->add($this->_bcc);
        }

        /* Trick Horde_Mime_Part into re-generating the message headers. */
        $this->_headers->removeHeader('MIME-Version');

        /* Send message. */
        $recipients->unique();
        $basepart->send($recipients->writeAddress(), $this->_headers, $mailer);

        /* Remember the basepart */
        $this->_base = $basepart;
    }
254699
public function coroutineUidIsOnline($uid)
    {
        if ($this->isCluster()) {
            return ProcessManager::getInstance()->getRpcCall(ClusterProcess::class)->isOnline($uid);
        } else {
            return $this->uid_fd_table->exist($uid);
        }
    }