Hello community,

here is the log from the commit of package kdepim3 for openSUSE:Factory checked 
in at 2013-05-13 14:58:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kdepim3 (Old)
 and      /work/SRC/openSUSE:Factory/.kdepim3.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kdepim3"

Changes:
--------
--- /work/SRC/openSUSE:Factory/kdepim3/kdepim3.changes  2013-04-14 
10:16:18.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kdepim3.new/kdepim3.changes     2013-05-13 
14:58:17.000000000 +0200
@@ -1,0 +2,7 @@
+Thu May  9 03:08:54 UTC 2013 - [email protected]
+
+- add a fix to IMAP4 handling (kdepim3-gentoo-fix-imap4.patch), 
+  thanks to Serghei Amelian. For details look here: 
+  http://lists.opensuse.org/opensuse-kde3/2013-05/msg00000.html
+  
+-------------------------------------------------------------------

New:
----
  kdepim3-gentoo-fix-imap4.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kdepim3.spec ++++++
--- /var/tmp/diff_new_pack.NNMdaL/_old  2013-05-13 14:58:20.000000000 +0200
+++ /var/tmp/diff_new_pack.NNMdaL/_new  2013-05-13 14:58:20.000000000 +0200
@@ -81,6 +81,7 @@
 Patch141:       kdepim-trinity-patch1.patch
 Patch142:       kdepim-trinity-patch2.patch
 Patch143:       kdepim-trinity-patch3.patch
+Patch144:       kdepim3-gentoo-fix-imap4.patch
 Provides:       cryptplug
 Obsoletes:      cryptplug
 # authentification plugins can be useful
@@ -283,6 +284,7 @@
 %patch141 -p1
 %patch142 -p1
 %patch143 -p1
+%patch144 -p1
 . /etc/opt/kde3/common_options
 update_admin
 

++++++ kdepim3-gentoo-fix-imap4.patch ++++++
--- a/kioslaves/imap4/imap4.cc
+++ b/kioslaves/imap4/imap4.cc
@@ -167,9 +167,7 @@
 {
   outputBufferIndex = 0;
   mySSL = isSSL;
-  readBuffer[0] = 0x00;
   relayEnabled = false;
-  readBufferLen = 0;
   cacheOutput = false;
   decodeContent = false;
   mTimeOfLastNoop = QDateTime();
@@ -702,66 +700,60 @@
 
 bool IMAP4Protocol::parseReadLine (QByteArray & buffer, ulong relay)
 {
-  if (myHost.isEmpty()) return FALSE;
-
-  while (true) {
-    ssize_t copyLen = 0;
-    if (readBufferLen > 0)
-    {
-      while (copyLen < readBufferLen && readBuffer[copyLen] != '\n') copyLen++;
-      if (copyLen < readBufferLen) copyLen++;
-      if (relay > 0)
-      {
-        QByteArray relayData;
-
-        if (copyLen < (ssize_t) relay)
-          relay = copyLen;
-        relayData.setRawData (readBuffer, relay);
-        parseRelay (relayData);
-        relayData.resetRawData (readBuffer, relay);
-//        kdDebug(7116) << "relayed : " << relay << "d" << endl;
-      }
-      // append to buffer
-      {
-        QBuffer stream (buffer);
-
-        stream.open (IO_WriteOnly);
-        stream.at (buffer.size ());
-        stream.writeBlock (readBuffer, copyLen);
-        stream.close ();
-//        kdDebug(7116) << "appended " << copyLen << "d got now " << 
buffer.size() << endl;
-      }
-
-      readBufferLen -= copyLen;
-      if (readBufferLen)
-        memmove(readBuffer, &readBuffer[copyLen], readBufferLen);
-      if (buffer[buffer.size() - 1] == '\n') return TRUE;
-    }
+  // FIXME (Serghei): i'm not sure about role of "relay"
+
+  if(myHost.isEmpty())
+    return false;
+
+  // default error
+  int errorStatus = ERR_CONNECTION_BROKEN;
+
+  // open buffer stream
+  QBuffer stream(buffer);
+  stream.open(IO_WriteOnly);
+  stream.at(buffer.size());
+
+  for (;;)
+  {
     if (!isConnectionValid())
     {
       kdDebug(7116) << "parseReadLine - connection broken" << endl;
-      error (ERR_CONNECTION_BROKEN, myHost);
-      setState(ISTATE_CONNECT);
-      closeConnection();
-      return FALSE;
-    }
-    if (!waitForResponse( responseTimeout() ))
-    {
-      error(ERR_SERVER_TIMEOUT, myHost);
-      setState(ISTATE_CONNECT);
-      closeConnection();
-      return FALSE;
-    }
-    readBufferLen = read(readBuffer, IMAP_BUFFER - 1);
-    if (readBufferLen == 0)
-    {
-      kdDebug(7116) << "parseReadLine: readBufferLen == 0 - connection broken" 
<< endl;
-      error (ERR_CONNECTION_BROKEN, myHost);
-      setState(ISTATE_CONNECT);
-      closeConnection();
-      return FALSE;
-    }
-  }
+      break;
+    }
+
+    if (!waitForResponse(responseTimeout()))
+    {
+      kdDebug(7116) << "parseReadLine - connection timeout" << endl;
+      errorStatus = ERR_SERVER_TIMEOUT;
+      break;
+    }
+
+    char buf[4096];
+    int len = readLine(buf, sizeof(buf));
+
+    if (0 >= len)
+    {
+      kdDebug(7116) << "parseReadLine - read line error" << endl;
+      break;
+    }
+
+    stream.writeBlock(buf, len);
+
+    // len is always bigger than zero,
+    // is safe to substract it by 1
+    if ('\n' == buf[len - 1])
+    {
+      stream.close();
+      return true;
+    }
+  }
+
+  // error
+  stream.close();
+  error(errorStatus, myHost);
+  setState(ISTATE_CONNECT);
+  closeConnection();
+  return false;
 }
 
 void
@@ -2008,7 +2000,6 @@
   sentQueue.clear();
   lastHandled = 0;
   currentBox = QString::null;
-  readBufferLen = 0;
 }
 
 bool IMAP4Protocol::makeLogin ()
@@ -2640,16 +2631,12 @@
 
 ssize_t IMAP4Protocol::myRead(void *data, ssize_t len)
 {
-  if (readBufferLen)
-  {
-    ssize_t copyLen = (len < readBufferLen) ? len : readBufferLen;
-    memcpy(data, readBuffer, copyLen);
-    readBufferLen -= copyLen;
-    if (readBufferLen) memcpy(readBuffer, &readBuffer[copyLen], readBufferLen);
-    return copyLen;
-  }
-  if (!isConnectionValid()) return 0;
-  waitForResponse( responseTimeout() );
+  if (!isConnectionValid())
+    return 0;
+
+  if (!waitForResponse(responseTimeout()))
+    return 0;
+
   return read(data, len);
 }
 --
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to