DamageOverTime::DamageOverTime() { setAttackerID(0); setType(CreatureState::BLEEDING); setAttribute(CreatureAttribute::HEALTH); strength = 0; setDuration(0); setExpires(0); setSecondaryStrength(0); addSerializableVariables(); }
void O2Gft::onTokenReplyFinished() { qDebug() << "O2Gft::onTokenReplyFinished"; QNetworkReply *tokenReply = qobject_cast<QNetworkReply *>(sender()); if (tokenReply->error() == QNetworkReply::NoError) { QByteArray replyData = tokenReply->readAll(); QScriptEngine engine; QScriptValueIterator it(engine.evaluate("(" + QString(replyData) + ")")); QVariantMap tokens; while (it.hasNext()) { it.next(); tokens.insert(it.name(), it.value().toVariant()); } // Check for mandatory tokens if (tokens.contains(O2_OAUTH2_ACCESS_TOKEN)) { setToken(tokens.take(O2_OAUTH2_ACCESS_TOKEN).toString()); // setIdToken(tokens.take(O2_OAUTH2_ID_TOKEN).toString()); // bool ok = false; int expiresIn = tokens.take(O2_OAUTH2_EXPIRES_IN).toInt(&ok); if (ok) { qDebug() << "Token expires in" << expiresIn << "seconds"; setExpires(QDateTime::currentMSecsSinceEpoch() / 1000 + expiresIn); } setRefreshToken(tokens.take(O2_OAUTH2_REFRESH_TOKEN).toString()); // Set extra tokens if any if (!tokens.isEmpty()) { setExtraTokens(tokens); } timedReplies_.remove(tokenReply); emit linkedChanged(); emit tokenChanged(); emit linkingSucceeded(); } else { qWarning() << "O2::onTokenReplyFinished: oauth_token missing from response" << replyData; emit linkedChanged(); emit tokenChanged(); emit linkingFailed(); } } tokenReply->deleteLater(); }
void TransferRequest::setDefaults( ATP_TransferRequest_t * header, int id ){ setFrameID( header, "ATP" ); setFrameType( header, ATP_TRANSFER_REQUEST ); setMeshAddress( header, 0 ); // Pan address for XBee radios setDatetime( header, (unsigned long) millis() ); setAtpID( header, id ); setVersion( header, 1 ); setStatus( header, ATP_UNSENT ); // Do not change the above members of the struct. The app.cpp dispatcher requires these. setTopChunk( header, 0 ); setChunkCount( header, 0 ); setSize( header, 0 ); setExpires( header, 0 ); setDescriptor( header, "CC"); setSource( header, 0 ); //todo Implement for Pinoccio Scouts, right now we're using XBee radios in direct connect mode setDestination( header, 0 ); setFileName( header, "" ); setBuffer( header, 0 ); }
// value 格式:xxx=xxx; domain=xxx; expires=xxx; path=xxx bool HttpCookie::setCookie(const char* value) { if (value == NULL || *value == 0) return false; ACL_ARGV* tokens = acl_argv_split(value, ";"); acl_assert(tokens->argc > 0); HTTP_PARAM param; // 从第一个 name=value 字段中取得 cookie 名及 cookie 值 if (splitNameValue(tokens->argv[0], ¶m) == false) { acl_argv_free(tokens); return false; } // name 肯定非 "\0",而 value 可以为 "\0" name_ = dbuf_->dbuf_strdup(param.name); value_ = dbuf_->dbuf_strdup(param.value); for (int i = 1; i < tokens->argc; i++) { if (splitNameValue(tokens->argv[i], ¶m) == false) continue; if (*(param.value) == 0) continue; if (strcasecmp(param.name, "domain") == 0) setDomain(param.value); else if (strcasecmp(param.name, "expires") == 0) setExpires(param.value); else if (strcasecmp(param.name, "path") == 0) setPath(param.value); else add(param.name, param.value); } acl_argv_free(tokens); return true; }
QNetworkAuthenticationCache() { setExpires(false); setShareable(true); reserve(1); }
Cookie & Cookie::setExpires(const QDateTime & dateTime) { return setExpires(http::dateString(dateTime)); }
QNetworkAccessHttpBackendCache(const QString &hostName, quint16 port, bool encrypt) : QHttpNetworkConnection(hostName, port, encrypt) { setExpires(true); setShareable(true); }