void Nntp::readyRead() { // new data arrived on the command socket // of we should read the list of available groups, let's do so if ( readGroups ) { parseGroups(); return; } // of we should read an article, let's do so if ( readArticle ) { parseArticle(); return; } // read the new data from the socket QCString s; s.resize( commandSocket->bytesAvailable() + 1 ); commandSocket->readBlock( s.data(), commandSocket->bytesAvailable() ); if ( !url() ) return; // of the code of the server response was 200, we know that the // server is ready to get commands from us now if ( s.left( 3 ) == "200" ) connectionReady = TRUE; }
void GoogleSession::groupsResult(bool errorFlag) { QByteArray respData = http->readAll(); qDebug() << "Groups Response header:" << http->lastResponse().statusCode() << http->lastResponse().reasonPhrase(); qDebug() << "Groups HTTP headers\n" << http->lastResponse().toString(); QString resp; if (http->lastResponse().value("content-encoding")=="gzip") { char *data = inf(respData.constData(), respData.size() ); resp = QString::fromUtf8(data); free(data); } else resp = QString::fromUtf8(respData.constData()); QHash<QString, QString> groupMap; parseGroups(resp, groupMap); setState(Authenticated); emit groupsFetched(groupMap); }