void KNNntpClient::doFetchArticle() { KNRemoteArticle *target = static_cast<KNRemoteArticle *>(job->data()); QCString cmd; sendSignal(TSdownloadArticle); errorPrefix = i18n("Article could not be retrieved.\nThe following error occurred:\n"); progressValue = 100; predictedLines = target->lines()->numberOfLines() + 10; if(target->collection()) { QString groupName = static_cast<KNGroup *>(target->collection())->groupname(); if(currentGroup != groupName) { cmd = "GROUP "; cmd += groupName.utf8(); if(!sendCommandWCheck(cmd, 211)) // 211 n f l s group selected return; currentGroup = groupName; } } if(target->articleNumber() != -1) { cmd.setNum(target->articleNumber()); cmd.prepend("ARTICLE "); } else { cmd = "ARTICLE " + target->messageID()->as7BitString(false); } if(!sendCommandWCheck(cmd, 220)) // 220 n <a> article retrieved - head and body follow { int code = atoi(getCurrentLine()); if(code == 430 || code == 423) // 430 no such article found || 423 no such article number in this group { QString msgId = target->messageID()->as7BitString(false); // strip of '<' and '>' msgId = msgId.mid(1, msgId.length() - 2); job->setErrorString(errorPrefix + getCurrentLine() + i18n("<br><br>The article you requested is not available on your news server." "<br>You could try to get it from <a href=\"http://groups.google.com/groups?selm=%1\">groups.google.com</a>.") .arg(msgId)); } return; } QStrList msg; if(!getMsg(msg)) return; progressValue = 1000; sendSignal(TSprogressUpdate); target->setContent(&msg); target->parse(); }
void KNNntpClient::doFetchSource() { KNRemoteArticle *target = static_cast<KNRemoteArticle *>(job->data()); sendSignal(TSdownloadArticle); errorPrefix = i18n("Article could not be retrieved.\nThe following error occurred:\n"); progressValue = 100; predictedLines = target->lines()->numberOfLines() + 10; QCString cmd = "ARTICLE " + target->messageID()->as7BitString(false); if(!sendCommandWCheck(cmd, 220)) // 220 n <a> article retrieved - head and body follow return; QStrList msg; if(!getMsg(msg)) return; progressValue = 1000; sendSignal(TSprogressUpdate); target->setContent(&msg); }