From bc8c2c57880523472b30f475d566a8133e2d2e20 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 21 May 2011 14:04:51 -0400
Subject: [PATCH] - Fix s/pattern/prefix/ in clear_cache()

---
 program/include/rcube_smtp.php |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube_smtp.php b/program/include/rcube_smtp.php
index 5d1d459..120336c 100644
--- a/program/include/rcube_smtp.php
+++ b/program/include/rcube_smtp.php
@@ -5,7 +5,7 @@
  | program/include/rcube_smtp.php                                        |
  |                                                                       |
  | This file is part of the Roundcube Webmail client                     |
- | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland                 |
+ | Copyright (C) 2005-2010, The Roundcube Dev Team                       |
  | Licensed under the GNU GPL                                            |
  |                                                                       |
  | PURPOSE:                                                              |
@@ -101,11 +101,11 @@
       $helo_host = 'localhost';
 
     // IDNA Support
-    $smtp_host = idn_to_ascii($smtp_host);
+    $smtp_host = rcube_idn_to_ascii($smtp_host);
 
     $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host);
 
-    if($RCMAIL->config->get('smtp_debug'))
+    if ($RCMAIL->config->get('smtp_debug'))
       $this->conn->setDebug(true, array($this, 'debug_handler'));
 
     // try to connect to server and exit on failure
@@ -116,6 +116,13 @@
       $this->error = array('label' => 'smtpconnerror', 'vars' => array('code' => $this->conn->_code));
       $this->conn = null;
       return false;
+    }
+
+    // workaround for timeout bug in Net_SMTP 1.5.[0-1] (#1487843)
+    if (method_exists($this->conn, 'setTimeout')
+      && ($timeout = ini_get('default_socket_timeout'))
+    ) {
+      $this->conn->setTimeout($timeout);
     }
 
     $smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']);
@@ -132,8 +139,9 @@
     if ($smtp_user && $smtp_pass)
     {
       // IDNA Support
-      if (strpos($smtp_user, '@'))
-        $smtp_user = idn_to_ascii($smtp_user);
+      if (strpos($smtp_user, '@')) {
+        $smtp_user = rcube_idn_to_ascii($smtp_user);
+      }
 
       $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls, $smtp_authz);
 

--
Gitblit v1.9.1