void GmailChecker::httpFinished () { emit canContinue (); if (Reply_->error ()) { QString error = tr ("Error"); error.prepend ("Gmail Notifier: "); if (Reply_->attribute (QNetworkRequest::HttpStatusCodeAttribute).toInt () == 401) emit anErrorOccupied (error.append (" 401"), tr ("The username or password is incorrect")); else if (Reply_->error() == QNetworkReply::OperationCanceledError) // When timed out emit anErrorOccupied (error, tr ("Connection timeout")); else emit anErrorOccupied (error, Reply_->errorString ()); } else { Data_ = QString::fromUtf8 (Reply_->readAll ()); ParseData (); } Reply_->deleteLater (); Reply_ = 0; }
LoginDialog::LoginDialog(QWidget *parent,bool canautologin) : LoginDialogBase(parent) { PMSettings *pmsettings = new PMSettings(); ui.PasswordEdit->setText(pmsettings->getAttributeSettings("password")); ui.HostEdit->setText(pmsettings->getAttributeSettings("host")); ui.UsernameEdit->setText(pmsettings->getAttributeSettings("username")); if (pmsettings->getAttributeSettings("remember") == "true"){ ui.RememberLoginsChk->setChecked(true); } else { ui.RememberLoginsChk->setChecked(false); } if (pmsettings->getAttributeSettings("autologin") == "true") { ui.AutoLogincheckBox->setChecked(true); delete pmsettings; if (canautologin == true) canContinue(); } else { delete pmsettings; } }
static int readPubkeyAttributes( INOUT STREAM *stream, INOUT PKCS15_INFO *pkcs15infoPtr, IN_LENGTH const int endPos, const BOOLEAN isPubKeyObject ) { int usageFlags, status; assert( isWritePtr( stream, sizeof( STREAM ) ) ); assert( isWritePtr( pkcs15infoPtr, sizeof( PKCS15_INFO ) ) ); REQUIRES( endPos > 0 && endPos > stell( stream ) && \ endPos < MAX_INTLENGTH ); status = readBitString( stream, &usageFlags ); /* Usage flags */ if( canContinue( stream, status, endPos ) && /* Native flag */ peekTag( stream ) == BER_BOOLEAN ) status = readUniversal( stream ); if( canContinue( stream, status, endPos ) && /* Access flags */ peekTag( stream ) == BER_BITSTRING ) status = readUniversal( stream ); if( canContinue( stream, status, endPos ) && /* Key reference */ peekTag( stream ) == BER_INTEGER ) status = readUniversal( stream ); if( canContinue( stream, status, endPos ) && /* Start date */ peekTag( stream ) == BER_TIME_GENERALIZED ) status = readGeneralizedTime( stream, &pkcs15infoPtr->validFrom ); if( canContinue( stream, status, endPos ) && /* End date */ peekTag( stream ) == MAKE_CTAG( CTAG_KA_VALIDTO ) ) status = readGeneralizedTimeTag( stream, &pkcs15infoPtr->validTo, CTAG_KA_VALIDTO ); if( cryptStatusError( status ) ) return( status ); if( isPubKeyObject ) pkcs15infoPtr->pubKeyUsage = usageFlags; else pkcs15infoPtr->privKeyUsage = usageFlags; return( CRYPT_OK ); }
void MainMenu::gotoMenuScreen(int screen) { for (int i = 0; i < 5; ++i) { const MenuButton *btn; if (_vm->_gameDescription->language == Common::RU_RUS) { btn = &kMenuButtonsRu[screen * 5 + i]; } else { btn = &kMenuButtons[screen * 5 + i]; } _buttons[i]->setLabel(btn->label); _buttons[i]->setCmd(btn->cmd); _buttons[i]->setEnabled(btn->cmd != 0); } // Enable the "Continue" button if a savegame at slot 0 exists if (screen == kMainMenuScr) _buttons[1]->setEnabled(canContinue()); }
static int readCertAttributes( INOUT STREAM *stream, INOUT PKCS15_INFO *pkcs15infoPtr, IN_LENGTH const int endPos ) { int length, status = CRYPT_OK; assert( isWritePtr( stream, sizeof( STREAM ) ) ); assert( isWritePtr( pkcs15infoPtr, sizeof( PKCS15_INFO ) ) ); REQUIRES( endPos > 0 && endPos > stell( stream ) && \ endPos < MAX_INTLENGTH ); if( peekTag( stream ) == BER_BOOLEAN ) /* Authority flag */ status = readUniversal( stream ); if( canContinue( stream, status, endPos ) && /* Identifier */ peekTag( stream ) == BER_SEQUENCE ) status = readUniversal( stream ); if( canContinue( stream, status, endPos ) && /* Thumbprint */ peekTag( stream ) == MAKE_CTAG( CTAG_CA_DUMMY ) ) status = readUniversal( stream ); if( canContinue( stream, status, endPos ) && /* Trusted usage */ peekTag( stream ) == MAKE_CTAG( CTAG_CA_TRUSTED_USAGE ) ) { readConstructed( stream, NULL, CTAG_CA_TRUSTED_USAGE ); status = readBitString( stream, &pkcs15infoPtr->trustedUsage ); } if( canContinue( stream, status, endPos ) && /* Identifiers */ peekTag( stream ) == MAKE_CTAG( CTAG_CA_IDENTIFIERS ) ) { status = readConstructed( stream, &length, CTAG_CA_IDENTIFIERS ); if( cryptStatusOK( status ) ) status = readKeyIdentifiers( stream, pkcs15infoPtr, stell( stream ) + length ); } if( canContinue( stream, status, endPos ) && /* Implicitly trusted */ peekTag( stream ) == MAKE_CTAG_PRIMITIVE( CTAG_CA_TRUSTED_IMPLICIT ) ) status = readBooleanTag( stream, &pkcs15infoPtr->implicitTrust, CTAG_CA_TRUSTED_IMPLICIT ); if( canContinue( stream, status, endPos ) && /* Validity */ peekTag( stream ) == MAKE_CTAG( CTAG_CA_VALIDTO ) ) { /* Due to miscommunication between PKCS #15 and 7816-15 there are two ways to encode the validity information for certificates, one based on the format used elsewhere in PKCS #15 (for PKCS #15) and the other based on the format used in certificates (for 7816-15). Luckily they can be distinguished by the tagging type */ readConstructed( stream, NULL, CTAG_CA_VALIDTO ); readUTCTime( stream, &pkcs15infoPtr->validFrom ); status = readUTCTime( stream, &pkcs15infoPtr->validTo ); } else { if( canContinue( stream, status, endPos ) && /* Start date */ peekTag( stream ) == BER_TIME_GENERALIZED ) status = readGeneralizedTime( stream, &pkcs15infoPtr->validFrom ); if( canContinue( stream, status, endPos ) && /* End date */ peekTag( stream ) == MAKE_CTAG_PRIMITIVE( CTAG_CA_VALIDTO ) ) status = readGeneralizedTimeTag( stream, &pkcs15infoPtr->validTo, CTAG_CA_VALIDTO ); } return( status ); }
void lionheart::Game::doTurn(std::shared_ptr<Display> display) { ++turns; //determine random turn order static std::random_device rd; static std::mt19937 engine(rd()); for(auto&& u:units) { std::shuffle(std::begin(u), std::end(u), engine); } auto u0 = std::begin(units[0]); auto u1 = std::begin(units[1]); while (u0 != std::end(units[0]) && u1 != std::end(units[1])) { auto doAction = [&](Unit &unit, std::shared_ptr<Player> p, std::vector<std::shared_ptr<Unit>> &allies, std::vector<std::shared_ptr<Unit>> &enemies)->bool { if (unit.isAlive()) { std::shared_ptr<const Paths> paths = nullptr; if(unit.getMoveSpeed() == 5) { paths = mountedPaths; } else { paths = infantryPaths; } // get recommendations auto action = p->recommendAction(unit, buildReport(map, turns, allies, enemies), Plan(unit, allies, enemies,paths)); // execute valid recommendations return action(map, unit, allies,enemies); } return false; }; // do player 0 unit if (u0 != std::end(units[0])) { auto unit = *u0; auto result = doAction(*unit,player[0],units[0],units[1]); ++u0; if(display&&result) { display->show(getReport(),player[0]->getBlazon(),player[1]->getBlazon()); } } // do player 1 unit if (u1 != std::end(units[1])) { auto unit = *u1; auto result = doAction(*unit,player[1],units[1],units[0]); ++u1; if(display&&result) { display->show(getReport(),player[0]->getBlazon(),player[1]->getBlazon()); } } } // remove the fallen for (auto &&u : units) { u.erase(std::remove_if(std::begin(u), std::end(u), [](std::shared_ptr<Unit> const &unit) { return !unit->isAlive(); }), std::end(u)); } if(!canContinue()) { state = FINISHED; } }