[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/kioslave/nntp
From:       Volker Krause <volker.krause () rwth-aachen ! de>
Date:       2005-08-31 14:58:51
Message-ID: 1125500331.299440.6220.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 455448 by vkrause:

Fix group and article listing, TCPSlaveBase::readLine() doesn't seem to 
0-terminate strings any more...


 M  +6 -3      nntp.cpp  


--- trunk/KDE/kdebase/kioslave/nntp/nntp.cpp #455447:455448
@@ -404,6 +404,7 @@
         moderated = false;
       }
 
+      entry.clear();
       fillUDSEntry(entry, group, msg_cnt, postingAllowed && !moderated, false);
       // add the last serial number as UDS_EXTRA atom, this is needed for
       // incremental article listing
@@ -510,6 +511,7 @@
     resp_line = readBuffer;
     if ((pos = resp_line.find('<')) > 0 && (pos2 = resp_line.find('>',pos+1))) {
       msg_id = resp_line.mid(pos,pos2-pos+1);
+      entry.clear();
       fillUDSEntry(entry, msg_id, 0, false, true);
       entryList.append(entry);
       if (entryList.count() >= UDS_ENTRY_CHUNK) {
@@ -542,7 +544,7 @@
       }
       memset( readBuffer, 0, MAX_PACKET_LEN );
       readBufferLen = readLine ( readBuffer, MAX_PACKET_LEN );
-      line = readBuffer;
+      line = QString::fromLatin1( readBuffer, readBufferLen );
       if ( line == ".\r\n" )
         break;
       headers << line.stripWhiteSpace();
@@ -576,7 +578,7 @@
     }
     memset( readBuffer, 0, MAX_PACKET_LEN );
     readBufferLen = readLine ( readBuffer, MAX_PACKET_LEN );
-    line = readBuffer;
+    line = QString::fromLatin1( readBuffer, readBufferLen );
     if ( line == ".\r\n" ) {
       // last article reached
       if ( !entryList.isEmpty() )
@@ -587,10 +589,12 @@
     fields = QStringList::split( "\t", line, true );
     msgId = QString::null;
     msgSize = 0;
+    entry.clear();
     QStringList::ConstIterator it = headers.constBegin();
     QStringList::ConstIterator it2 = fields.constBegin();
     ++it2; // first entry is the serial number
     for ( ; it != headers.constEnd() && it2 != fields.constEnd(); ++it, ++it2 ) {
+      DBG << "Processing header: " << *it << " with content: " << *it2 << endl;
       if ( (*it).contains( "Message-ID:", false ) ) {
         msgId = (*it2);
         continue;
@@ -625,7 +629,6 @@
   long posting=0;
 
   UDSAtom atom;
-  entry.clear();
 
   // entry name
   atom.m_uds = UDS_NAME;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic