From 83a7636872d58f044d1fac444268dd2e7c7ebaee Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sat, 14 Jun 2008 08:23:08 -0400
Subject: [PATCH] More code cleanup

---
 program/include/rcube_config.php |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index 8e956de..5c744ba 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -177,5 +177,46 @@
   }
   
   
+  /**
+   * 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];
+    }
+    else if (!empty($this->prop['mail_domain']))
+      $domain = $this->prop['mail_domain'];
+    
+    return $domain;
+  }
+
+
 }
 

--
Gitblit v1.9.1