void RGhostUploader::handshakeFinished() { QScriptEngine engine; json = engine.evaluate( "(" + reply->readAll() + ")" ); cookie = reply->rawHeader("Set-Cookie"); /*qDebug() << "RGhost uploader::" << "got json" << "\nheaders:" << reply->rawHeaderList() << "\ncookie:" << reply->rawHeader("Set-Cookie") << "\n response:" << reply->readAll();*/ doUpload(); }
void MainWindow::uploadFiles(QString path, QStringList uploadList) { qDebug()<<"uploadFiles"; int i; for(i=0;i<uploadList.size();i++) upList << uploadList.at(i); currentPath = path; if(upList.size()) doUpload(); }
void loadBlocksOfType(daveConnection * dc, int blockType, int doReadout) { int j, i, uploadID, len, more; #ifdef UNIX_STYLE int fd; #endif #ifdef WIN_STYLE HANDLE fd; unsigned long res; #endif char blockName [20]; uc blockBuffer[20000],*bb; daveBlockEntry dbe[256]; j=daveListBlocksOfType(dc, blockType, dbe); if (j<0) { printf("error %d=%s\n",-j,daveStrerror(-j)); return; } printf("%d blocks of type %s\n",j,daveBlockName(blockType)); for (i=0; i<j; i++) { printf("%s%d %d %d\n", daveBlockName(blockType), dbe[i].number, dbe[i].type[0],dbe[i].type[1]); bb=blockBuffer; if(doReadout) { len=0; if (0==initUpload(dc, blockType, dbe[i].number, &uploadID)) { do { doUpload(dc,&more,&bb,&len,uploadID); } while (more); sprintf(blockName,"%s%d.mc7",daveBlockName(blockType), dbe[i].number); #ifdef UNIX_STYLE fd=open(blockName,O_RDWR|O_CREAT|O_TRUNC,0644); write(fd, blockBuffer, len); close(fd); #endif #ifdef WIN_STYLE fd = CreateFile(blockName, GENERIC_WRITE, 0, 0, 2, FILE_FLAG_WRITE_THROUGH, 0); WriteFile(fd, blockBuffer, len, &res, NULL); CloseHandle(fd); #endif endUpload(dc,uploadID); } } } }
void RGhostUploader::upload(const ImageType img, const QString fn) { image = img.toImage(); //qDebug() << fn; filename = QString(fn); /* if (!image) { qDebug() << "RGhost uploader::" << "Failed to convert pixmap to image."; // wat? return; }*/ qDebug() << "RGhost uploader::" << "uploading..."; //<< img; if (json.isUndefined()) handshake(); else doUpload(); }
bool http_servlet::doBody(acl::HttpServletRequest& req, acl::HttpServletResponse& res) { // 当未读完数据体时,需要异步读 HTTP 请求数据体 if (content_length_ > read_length_) { if (doUpload(req, res) == false) return false; } if (content_length_ > read_length_) return true; // 当已经读完 HTTP 请求数据体时,则开始分析上传的数据 bool ret = doParse(req, res); // 处理完毕,需重置 HTTP 会话状态,以便于处理下一个 HTTP 请求 reset(); return ret; }
// virtual void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success) { // do we need to upload, and do we have sufficient data to create an uploadable composite? // TODO: When do we upload the texture if gAgent.mNumPendingQueries is non-zero? const BOOL upload_now = mNeedsUpload && isReadyToUpload(); const BOOL update_now = mNeedsUpdate && isReadyToUpdate(); if(upload_now) { if (!success) { LL_INFOS() << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << LL_ENDL; mUploadPending = FALSE; } else { LLViewerTexLayerSet* layer_set = getViewerTexLayerSet(); if (layer_set->isVisible()) { layer_set->getAvatar()->debugBakedTextureUpload(layer_set->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish. doUpload(); } else { mUploadPending = FALSE; mNeedsUpload = FALSE; mNeedsUploadTimer.pause(); layer_set->getAvatar()->setNewBakedTexture(layer_set->getBakedTexIndex(),IMG_INVISIBLE); } } } if (update_now) { doUpdate(); } // *TODO: Old logic does not check success before setGLTextureCreated // we have valid texture data now mGLTexturep->setGLTextureCreated(true); }
RESULT YandexNarodHTTPConnector::uploadFile(const QString& path, const QString& title, const QString& /*parentId*/, QString& response) { RESULT res = eERROR_GENERAL; QString progressLink; QString uploadLink; getUploadLink(progressLink, uploadLink); res = doUpload(path, title, uploadLink, response); if(res == eNO_ERROR) { QString tmp; res = getProgress(progressLink, tmp); response.append(tmp); if(res == eNO_ERROR) { tmp = ""; res = getUploadedFileLink(tmp); response.append(tmp); } } return res; }
char doRegular(char expand, char c) { char toReturn; int i; int done = 0; label doorinfo; toReturn = FALSE; for (i = 0; !expand && i < MAXEXTERN && extCmd[i].name[0]; ++i) { if (c == toupper(extCmd[i].name[0]) && (onConsole || !extCmd[i].local)) { done = 1; mPrintf("\b%s", extCmd[i].name); doCR(); if (changedir(cfg.aplpath) == ERROR) { mPrintf(" -- Can't find application directory.\n\n"); changedir(cfg.homepath); } /* apsystem(extCmd[i].command); */ sprintf(doorinfo, "DORINFO%d.DEF", onConsole ? 0 : userdat.apl_com); extFmtRun(extCmd[i].command, doorinfo); } } if (!done) { switch (c) { case 'S': if (gl_user.sysop && expand) { mPrintf("\b\bSysop Menu"); doCR(); doSysop(); } else { toReturn = TRUE; } break; case 'A': if (gl_user.aide) { doAide(expand, 'E'); } else { toReturn = TRUE; } break; case 'C': doChat(expand, '\0'); break; case 'D': doDownload(expand); break; case 'E': doEnter(expand, 'm'); break; case 'F': doRead(expand, 'f'); break; case 'G': doGoto(expand, FALSE); break; case 'H': doHelp(expand); break; case 'I': doIntro(); break; case 'J': mPrintf("\bJump back to "); unGotoRoom(); break; case 'K': doKnown(expand, 'r'); break; case 'L': if (!loggedIn) { doLogin(expand); } else { if (!getYesNo(confirm, 0)) break; doLogout(expand, 's'); doLogin(expand); } break; case 'N': case 'O': case 'R': doRead(expand, tolower(c)); break; case 'B': doGoto(expand, TRUE); break; case 'T': doLogout(expand, 'q'); break; case 'U': doUpload(expand); break; case 'X': if (!expand) { doEnter(expand, 'x'); } else { doXpert(); } break; case '=': case '+': doNext(); break; case '\b': mPrintf(" "); case '-': doPrevious(); break; case ']': case '>': doNextHall(); break; case '[': case '<': doPreviousHall(); break; case '~': mPrintf("\bAnsi %s\n ", gl_term.ansiOn ? gl_str.off : gl_str.on); gl_term.ansiOn = !gl_term.ansiOn; break; case '!': mPrintf("\bIBM Graphics %s\n ", gl_term.IBMOn ? gl_str.off:gl_str.on); gl_term.IBMOn = !gl_term.IBMOn; break; case '?': nextmenu("mainopt", &(cfg.cnt.mainopttut), 1); listExterns(); break; case 0: /* never gets here in shell mode... */ if (newCarrier) { greeting(); if (cfg.forcelogin) { doCR(); doCR(); i = 0; while (!loggedIn && gotCarrier()) { doLogin(2); if (++i > 3) { Initport(); toReturn = TRUE; break; } } } newCarrier = FALSE; } if (logBuf.lbflags.NODE && loggedIn) { net_slave(); haveCarrier = FALSE; modStat = FALSE; newCarrier = FALSE; justLostCarrier = FALSE; onConsole = FALSE; disabled = FALSE; callout = FALSE; delay(2000); Initport(); cfg.callno++; terminate(FALSE, FALSE); } if (justLostCarrier || ExitToMsdos) { justLostCarrier = FALSE; if (loggedIn) terminate(FALSE, FALSE); } break; /* irrelevant value */ default: toReturn = TRUE; break; } } /* if they get unverified online */ if (logBuf.VERIFIED) terminate(FALSE, FALSE); /* update25(); */ do_idle(0); return toReturn; }
void MainWindow::ftpCommandFinished(int, bool error) { if (ftp->currentCommand() == QFtp::ConnectToHost) { if (error) { QMessageBox::information(this, tr("FTP"), tr("Unable to connect to the FTP server " "at %1. Please check that the host " "name is correct.")); //connectOrDisconnect(); return; } qDebug()<<"Connected.."; //connected but not logined return; } if (ftp->currentCommand() == QFtp::Login) { if(error) { QMessageBox::information(this, tr("FTP"),tr("Can't log in. Please check that the id or password is correct.")); return; } ftp->list(); //get all list currentDirectory = ""; login->hide(); show(); return; } if (ftp->currentCommand() == QFtp::List) //Recrusive { if(unparsedDirectory.size()) { ftp->list(unparsedDirectory.at(0)); currentDirectory = unparsedDirectory.at(0); unparsedDirectory.removeFirst(); } else { fullFilesList.sort(); #if 0 int i; for(i=0;i<fullFilesList.size();i++) qDebug()<<"[ " + fullFilesList.at(i) + " ]"; #endif getPlaylist(); } } if (ftp->currentCommand() == QFtp::Get) { if (error) { // statusLabel->setText(tr("Canceled download of %1.") // .arg(file->fileName())); file->close(); file->remove(); } else { // statusLabel->setText(tr("Downloaded %1 to current directory.") // .arg(file->fileName())); file->close(); } delete file; // enableDownloadButton(); // progressDialog->hide(); //TODO Check if(playlist downloading?) getPlaylist(); } if(ftp->currentCommand() == QFtp::Put) { qDebug()<<"PUT END"; file->close(); delete file; if(upList.size()) { doUpload(); } else { refreshTable(); //FIXME upload->close(); } } if(ftp->currentCommand() == QFtp::Remove) { qDebug()<<"DELETE END"; if(rmList.size()) doRemove(); } }
//------------------------------------------------------------- void API::threadedFunction(){ while (isThreadRunning()){ // work through queue in order if ( APIqueue.size() > 0 ){ lock(); APICall apiCall = APIqueue.front(); APIqueue.erase(APIqueue.begin()); unlock(); string result = ""; string path; APIEvent args; switch (apiCall.type) { case FLICKR_GETMEDIA: path = buildAPICall( apiCall.method, apiCall.args, apiCall.format, apiCall.bSigned ); try { // Get REST style xml as string from flickr std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open( "https://" + api_base + path )); StreamCopier::copyToString(*pStr.get(), result); // get frob loadedMedia[apiCall.args["id"]] = Media(); loadedMedia[apiCall.args["id"]].loadFromXML( result ); args.results.push_back(loadedMedia[apiCall.args["id"]]); ofNotifyEvent(APIEvent::events, args); } catch (Exception &ex) { cerr << ex.displayText() << endl; } break; case FLICKR_SEARCH: path = buildAPICall( apiCall.method, apiCall.args, apiCall.format, apiCall.bSigned ); try { // Get REST style xml as string from flickr std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open( "https://" + api_base + path )); StreamCopier::copyToString(*pStr.get(), result); ofxXmlSettings xml; xml.loadFromBuffer(result); xml.pushTag("rsp");{ xml.pushTag("photos"); { for (int i=0; i<xml.getNumTags("photo"); i++){ Media med; med.id = xml.getAttribute("photo", "id", "", i); med.farm = xml.getAttribute("photo", "farm", "", i); med.secret = xml.getAttribute("photo", "secret", "", i); med.server = xml.getAttribute("photo", "server", "", i); med.originalsecret = xml.getAttribute("photo", "originalsecret", "", i); med.originalformat = xml.getAttribute("photo", "originalformat", "", i); string t = xml.getAttribute("photo", "media", "", i); if ( t == "photo"){ med.type = FLICKR_PHOTO; } else if ( t == "video"){ med.type = FLICKR_VIDEO; } else { med.type = FLICKR_UNKNOWN; } args.results.push_back(med); } } xml.popTag(); } xml.popTag(); ofNotifyEvent(APIEvent::events, args); } catch (Exception &ex) { cerr << ex.displayText() << endl; } break; case FLICKR_UPLOAD: args.resultString = doUpload( apiCall.method ); ofNotifyEvent(APIEvent::events, args); break; default: break; } } sleep(20); } }
//------------------------------------------------------------- string API::upload( string image ){ return doUpload(image); }
bool FtpServer::handleFrame(Client* cli){ if (cli->frame.dir == 0) return doUpload(cli); else if (cli->frame.dir == 1) return doDownload(cli); }