OSDN Git Service

list cache
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 26 Sep 2004 15:36:09 +0000 (15:36 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 26 Sep 2004 15:36:09 +0000 (15:36 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1396 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/libkita/board.cpp

index fa95784..9a66b40 100644 (file)
 
 #include <qregexp.h>
 #include <qdict.h>
+#include <qdir.h>
 
 #include "kita_misc.h"
 #include "threadinfo.h"
+#include "cache.h"
+#include "datmanager.h"
 
 #include "qcp932codec.h"
 
@@ -54,6 +57,43 @@ const QPtrList<Thread> Board::getThreadList( const QString& boardURL )
     }
     QPtrList<Thread> threadList;
 
+    /* get all obtained threads list */
+    if( boardURL == "http://virtual/obtained/" ){
+
+       QDictIterator<Kita::Board> it( *m_boardDict );
+       for ( ; it.current(); ++it ) {
+
+           /* get the cache dir */
+           QString boardUrl = it.currentKey() + "dat/";
+           QString cdir = Cache::getPath( boardUrl + "dummy.dat" );
+           int i = cdir.findRev( "dummy.dat");
+           cdir.truncate( i );
+           
+           /* get the file names */
+           QDir d( cdir );
+           if ( d.exists() ){
+               QStringList flist = d.entryList( "*.dat" );
+               for( QStringList::iterator it = flist.begin();  it != flist.end(); ++it ){
+                   if( (*it) == QString::null ) continue;
+
+                   QString datURL = boardUrl + (*it);
+
+                   /* get the name of the thread from the dat file */
+                   QString subject = DatManager::threadName( datURL );  
+
+                   if( subject == QString::null ) Kita::Thread::setName( datURL, "?" );
+                   int rnum = KitaThreadInfo::readNum( datURL );
+                   if( KitaThreadInfo::resNum( datURL ) < rnum ) KitaThreadInfo::setResNum( datURL, rnum  );
+                   Kita::Thread* thread = Kita::Thread::getByURL( datURL );
+                   threadList.append( thread );
+               }
+           }
+       }
+       
+       return threadList;      
+    }
+    
+
     KIO::SlaveConfig::self() ->setConfigData( "http",
             KURL( boardURL ).host() ,
             "UserAgent",