static PyObject *meth_QUrlInfo_setFile(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf)); { bool a0; QUrlInfo *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "Bb", &sipSelf, sipType_QUrlInfo, &sipCpp, &a0)) { Py_BEGIN_ALLOW_THREADS (sipSelfWasArg ? sipCpp->QUrlInfo::setFile(a0) : sipCpp->setFile(a0)); Py_END_ALLOW_THREADS Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QUrlInfo, sipName_setFile, doc_QUrlInfo_setFile); return NULL; }
void Qip::socketReadyRead() { // read from the server QTextStream stream( socket ); QString line; while ( socket->canReadLine() ) { line = stream.readLine(); if ( line.startsWith( "500" ) ) { error( ErrValid, line.mid( 4 ) ); } else if ( line.startsWith( "550" ) ) { error( ErrFileNotExisting, line.mid( 4 ) ); } else if ( line.startsWith( "212+" ) ) { if ( state != List ) { state = List; emit start( operationInProgress() ); } QUrlInfo inf; inf.setName( line.mid( 6 ) + QString( ( line[ 4 ] == 'D' ) ? "/" : "" ) ); inf.setDir( line[ 4 ] == 'D' ); inf.setSymLink( FALSE ); inf.setFile( line[ 4 ] == 'F' ); inf.setWritable( FALSE ); inf.setReadable( TRUE ); emit newChild( inf, operationInProgress() ); } else if ( line.startsWith( "213+" ) ) { state = Data; emit data( line.mid( 4 ).utf8(), operationInProgress() ); } if( line[3] == ' ' && state != Start) { state = Start; operationInProgress()->setState( StDone ); emit finished( operationInProgress() ); } } }
void Nntp::parseGroups() { if ( !commandSocket->canReadLine() ) return; // read one line after the other while ( commandSocket->canReadLine() ) { QString s = commandSocket->readLine(); // if the line starts with a dot, all groups or articles have been listed, // so we finished processing the listChildren() command if ( s[ 0 ] == '.' ) { readGroups = FALSE; operationInProgress()->setState( StDone ); emit finished( operationInProgress() ); return; } // if the code of the server response is 215 or 211 // the next line will be the first group or article (depending on what we read). // So let others know that we start reading now... if ( s.left( 3 ) == "215" || s.left( 3 ) == "211" ) { operationInProgress()->setState( StInProgress ); emit start( operationInProgress() ); continue; } // parse the line and create a QUrlInfo object // which describes the child (group or article) bool tab = s.find( '\t' ) != -1; QString group = s.mid( 0, s.find( tab ? '\t' : ' ' ) ); QUrlInfo inf; inf.setName( group ); QString path = url()->path(); inf.setDir( path.isEmpty() || path == "/" ); inf.setSymLink( FALSE ); inf.setFile( !inf.isDir() ); inf.setWritable( FALSE ); inf.setReadable( TRUE ); // let others know about our new child emit newChild( inf, operationInProgress() ); } }