QDict<Board>* Board::m_boardDict = 0;
QCp932Codec* Board::m_cp932Codec = NULL;
+QEucJpCodec* Board::m_eucJpCodec = NULL;
Board::Board()
{}
QIODevice * tmpDevice = KFilterDev::deviceForFile( tmpFile, "application/x-gzip" );
tmpDevice->open( IO_ReadOnly );
- if( !m_cp932Codec ) m_cp932Codec = new QCp932Codec();
+ if( !m_cp932Codec ) m_cp932Codec = new QCp932Codec();
+ if( !m_eucJpCodec ) m_eucJpCodec = new QEucJpCodec();
QTextStream stream( tmpDevice );
- stream.setCodec( m_cp932Codec );
+
+ if ( Kita::boardType( boardURL ) == Board_JBBS ) {
+ stream.setCodec( m_eucJpCodec );
+ } else {
+ stream.setCodec( m_cp932Codec );
+ }
// parse subject.txt(only one format...)
// FIXME: need to refactoring
QRegExp regexp;
switch ( Kita::boardType( boardURL ) ) {
- case Board_MachiBBS:
- regexp.setPattern( "(\\d+\\.cgi),(.*)\\((\\d+)\\)" );
- break;
case Board_2ch:
- default:
regexp.setPattern( "(\\d+\\.dat)<>(.*)\\((\\d+)\\)" );
break;
+ case Board_MachiBBS:
+ case Board_JBBS:
+ default:
+ regexp.setPattern( "(\\d+\\.cgi),(.*)\\((\\d+)\\)" );
+ break;
}
QString line;
while ( ( line = stream.readLine() ) != QString::null ) {
+ kdDebug() << "line: " << line << endl;
int pos = regexp.search( line );
if ( pos != -1 ) {
QString fname = regexp.cap( 1 );
#include <qptrlist.h>
#include <qxml.h>
#include <qdict.h>
+#include <qeucjpcodec.h>
#include "thread.h"
QString m_boardURL;
QString m_boardName;
static QDict<Board>* m_boardDict;
- static QCp932Codec* m_cp932Codec;
+ static QCp932Codec* m_cp932Codec;
+ static QEucJpCodec* m_eucJpCodec;
Board( const QString& boardURL, const QString boardName = QString::null );
static Board* getByURL( const QString& boardURL );
protected:
int Kita::boardType( const QString& url )
{
QRegExp url_machibbs( "http://.*\\.machi\\.to/.*" );
- if ( url_machibbs.search( url ) == -1 ) {
- return Board_2ch;
- } else {
+ QRegExp url_jbbs( "http://jbbs.shitaraba.com/.*" );
+ if ( url_machibbs.search( url ) != -1 ) {
return Board_MachiBBS;
+ } else if ( url_jbbs.search( url ) != -1 ) {
+ return Board_JBBS;
+ } else {
+ return Board_2ch;
}
}