public function exportChannel($chan)
{
$this->command($this->usermask, 'JOIN', $chan->name);
$this->command($this->usermask, 'RPL_TOPIC', $chan->irc->nick, $chan->name, $chan->topic);
$names = $chan->exportNicksArray();
$packet = '';
$maxlen = 510 - 7 - mb_orig_strlen($this->pool->config->servername->value) - $chan->irc->nick - 1;
for ($i = 0, $s = sizeof($names); $i < $s; ++$i) {
$packet .= ($packet !== '' ? ' ' : '') . $names[$i];
if (!isset($names[$i + 1]) || mb_orig_strlen($packet) + mb_orig_strlen($names[$i + 1]) + 1 > $maxlen) {
$this->command(null, 'RPL_NAMREPLY', $chan->irc->nick, $chan->type, $chan->name, $packet);
$packet = '';
}
}
$this->command(null, 'RPL_ENDOFNAMES', $chan->irc->nick, $chan->name, 'End of /NAMES list');
}