lithium\analysis\logger\adapter\Growl::_register()

protected method

Growl server connection registration and initialization.

Returns

boolean

True

Source

	protected function _register() {
		if ($this->_registered) {
			return true;
		}
		$ct = count($this->_config['notifications']);
		$app = utf8_encode($this->_config['name']);
		$nameEnc = $defaultEnc = '';

		foreach ($this->_config['notifications'] as $i => $name) {
			$name = utf8_encode($name);
			$nameEnc .= pack('n', strlen($name)) . $name;
			$defaultEnc .= pack('c', $i);
		}
		$data = pack('c2nc2', static::PROTOCOL_VERSION, static::TYPE_REG, strlen($app), $ct, $ct);
		$data .= $app . $nameEnc . $defaultEnc;
		$checksum = pack('H32', md5($data . $this->_config['password']));
		$data .= $checksum;

		$this->_send($data);
		return $this->_registered = true;
	}