- }
-
-
- /**
- * Getter for a specific config parameter
- *
- * @param string Parameter name
- * @param mixed Default value if not set
- * @return mixed The requested config value
- */
- public function get($name, $def = null)
- {
- return isset($this->prop[$name]) ? $this->prop[$name] : $def;
- }
-
-
- /**
- * Setter for a config parameter
- *
- * @param string Parameter name
- * @param mixed Parameter value
- */
- public function set($name, $value)
- {
- $this->prop[$name] = $value;
- }
-
-
- /**
- * Override config options with the given values (eg. user prefs)
- *
- * @param array Hash array with config props to merge over
- */
- public function merge($prefs)
- {
- $this->prop = array_merge($this->prop, $prefs);
- }
-
-
- /**
- * Getter for all config options
- *
- * @return array Hash array containg all config properties
- */
- public function all()
- {
- return $this->prop;
- }
-
-
- /**
- * Return a 24 byte key for the DES encryption
- *
- * @return string DES encryption key
- */
- public function get_des_key()
- {
- $key = !empty($this->prop['des_key']) ? $this->prop['des_key'] : 'rcmail?24BitPwDkeyF**ECB';
- $len = strlen($key);
-
- // make sure the key is exactly 24 chars long
- if ($len<24)
- $key .= str_repeat('_', 24-$len);
- else if ($len>24)
- substr($key, 0, 24);
-
- return $key;
- }
-
-
- /**
- * Try to autodetect operating system and find the correct line endings
- *
- * @return string The appropriate mail header delimiter
- */
- public function header_delimiter()
- {
- // use the configured delimiter for headers
- if (!empty($this->prop['mail_header_delimiter']))
- return $this->prop['mail_header_delimiter'];
- else if (strtolower(substr(PHP_OS, 0, 3) == 'win'))
- return "\r\n";
- else if (strtolower(substr(PHP_OS, 0, 3) == 'mac'))
- return "\r\n";
- else
- return "\n";
- }
-
-
-
- /**
- * Return the mail domain configured for the given host
- *
- * @param string IMAP host
- * @return string Resolved SMTP host
- */
- public function mail_domain($host)
- {
- $domain = $host;
-
- if (is_array($this->prop['mail_domain'])) {
- if (isset($this->prop['mail_domain'][$host]))
- $domain = $this->prop['mail_domain'][$host];