// Takes care of all the choices the user can // make with the menu. void LogIn::menuChoices() { switch(choice) { case 1: createAccount(); cout << endl; mainMenu(); break; case 2: getUserInfo(); cout << endl; mainMenu(); break; case 3: deleteQuery(); deleteAccount(); break; case 4: displayContents(); mainMenu(); break; case 9: cout << "You have exitted the program.\n"; exit(EXIT_SUCCESS); } }
//METHODS void ConnectionWindow::createConnectionPart() { //Connection part layoutP1 = new QHBoxLayout(); askUserID = new QLabel("Name "); editUserID = new QLineEdit(); layoutP1->addWidget(askUserID); askUserID->setFixedWidth(100); layoutP1->addWidget(editUserID); layoutP2 = new QHBoxLayout(); askUserPass = new QLabel("Password "); askUserPass->setFixedWidth(100); editUserPass = new QLineEdit(); layoutP2->addWidget(askUserPass); layoutP2->addWidget(editUserPass); sendUserID = new QPushButton("Connect"); addNewUser = new QPushButton("Register"); isUserKnown = new QLabel(); mainLayout->addLayout(layoutP1); mainLayout->addLayout(layoutP2); mainLayout->addWidget(sendUserID); mainLayout->addWidget(addNewUser); mainLayout->addWidget(isUserKnown); //Connection signals QObject::connect(sendUserID,SIGNAL(clicked()),this,SLOT(sendIDConnection())); QObject::connect(addNewUser,SIGNAL(clicked()),this,SLOT(createAccount())); }
static void runSyncMany (BREthereumNetwork newtork, BREthereumMode mode, unsigned int durationInSeconds, unsigned int accounts) { BREthereumEWM ewms[accounts]; BREthereumClient clients[accounts]; BREthereumTimestamp timestamp = 1539330275; // ETHEREUM_TIMESTAMP_UNKNOWN; for (int i = 0; i < accounts; i++) { UInt128 entropy; arc4random_buf(entropy.u64, sizeof (entropy)); size_t phraseLen = BRBIP39Encode(NULL, 0, BRBIP39WordsEn, entropy.u8, sizeof(entropy)); char phrase[phraseLen]; assert (phraseLen == BRBIP39Encode(phrase, sizeof(phrase), BRBIP39WordsEn, entropy.u8, sizeof(entropy))); BREthereumAccount account = createAccount(phrase); char storagePath[100]; sprintf (storagePath, "many%d", i); BREthereumEWM ewm; eth_log("TST", "SyncTest: PaperKey: %s", phrase); // alarmClockCreateIfNecessary (1); clients[i] = runEWM_createClient(); ewm = ewmCreate (ethereumMainnet, account, timestamp, mode, clients[i], storagePath); ewms[i] = ewm; char *address = ewmGetAccountPrimaryAddress(ewm); printf ("ETH: TST:\nETH: TST: Address: %s\nETH: TST:\n", address); free (address); ewmUpdateTokens(ewm); ewmConnect(ewm); } unsigned int remaining = durationInSeconds; while (remaining) { printf ("ETH: TST:\nETH: TST: sleeping: %d\nETH: TST:\n", remaining); remaining = sleep(remaining); } for (size_t i = 0; i < accounts; i++) { ewmDisconnect(ewms[i]); ewmDestroy(ewms[i]); runEWM_freeClient(clients[i]); } // alarmClockDestroy(alarmClock); }
void Account::validFormAccount(int status) { RegisterAccount *registerAccount = qobject_cast<RegisterAccount*>(sender()); if (registerAccount && status == 1) createAccount(registerAccount->getLogin(), registerAccount->getPassword()); registerAccount->deleteLater(); }
int main() { Account *ptr; ptr=(Account*)malloc(sizeof(Account)); createAccount(ptr); showBal(ptr); return 0; }
void Registration::changePassword( const std::string& username, const std::string& password ) { if( !m_parent || !m_parent->authed() || username.empty() ) return; int fields = FieldUsername | FieldPassword; RegistrationFields rf; rf.username = username; rf.password = password; createAccount( fields, rf ); }
//初始化root,顺便把userManager也生成,默认添加一个用户 :xiaojian,密码:123456 void makeRoot(string& q1) { Root.open("root", NULL); cout<<"正在添加用户------------------"<<endl; Account* temp = NULL; while(temp==NULL) createAccount(temp); UM.open(temp->user, temp->password);//测试使用 q1 = temp->user; delete temp; }
accountHndl EmailNotifier::registerAccount( const AccountSettings & accountSettings, EmailNotifiableIntf* handler ) const { EmailAccount* newAccount = createAccount(accountSettings, handler); if (newAccount == NULL) { ACE_DEBUG((LM_ERROR, "EmailNotify:Error creating acount \n")); handler->onUpdateError(Email_invalid_account_detils ); //TODO: replace error } else { pthread_t workerTread; pthread_create(&workerTread, NULL, startChechingAccount, newAccount); } return newAccount; }
int mainTerminal_text() { char prompt[20]; while (1 == 1) { clearCommander(0); /*Print info about help*/ printAndWriteFrom(20, "> "); printFrom(22, 6, "Type 'help' to display help entry"); /*Wait for input*/ flushinp(); getstr(prompt); /*If the player would like to identify himself*/ if (strcmp(prompt, "identify") == 0) { /*If the player has successfully logged in*/ if (userIdentify() == TRUE) { return 0; } continue; } /*If the player would like to read help entry*/ else if (strcmp(prompt, "help") == 0) { showHelp(mainTerminal); continue; } /*If the player would like to exit the game*/ else if (strcmp(prompt, "exit") == 0) { clearCommander(0); return EXIT; } /*If the player would like to create a new account*/ else if (strcmp(prompt, "create") == 0) { createAccount(); continue; } /*If the player typed unknown command*/ else { showCommanderInfo("Unknown command", 1); } } return 0; }
int main(int argc, const char * argv[]) { BREthereumMode mode = BRD_WITH_P2P_SEND; const char *paperKey = (argc > 1 ? argv[1] : "0xa9de3dbd7d561e67527bc1ecb025c59d53b9f7ef"); BREthereumAccount account = createAccount(paperKey); BREthereumTimestamp timestamp = 1539330275; // ETHEREUM_TIMESTAMP_UNKNOWN; const char *path = "core"; runSyncTest (ethereumMainnet, account, mode, timestamp, 5 * 60, path); // runSyncMany(ethereumMainnet, mode, 10 * 60, 1000); return 0; }
optional<TxInfo> ensureAccountIsLoadedCreated(size_t i) { if (!mAccounts[i]) { auto newAccount = createAccount(i); mAccounts[i] = newAccount; if (!loadAccount(*newAccount)) { newAccount->mSeq = LedgerHeaderFrame(mApp->getLedgerManager() .getCurrentLedgerHeader()) .getStartingSequenceNumber(); return make_optional<TxInfo>(newAccount->creationTransaction()); } } return nullopt<TxInfo>(); }
int main(int argc, char **argv) { int i; int *value; if (argc < 3) { fprintf(stderr, "Usage: %s <numThreads (1-3)> <good|bad>\n", argv[0]); exit(1); } numThreads = atoi(argv[1]); if (numThreads > 3) { fprintf(stderr, "Usage: %s Too many threads specified. Defaulting to 3.\n", argv[0]); numThreads = 3; } char *goodArg = argv[2]; if(strcmp(goodArg, "good") == 0) { good = 1; printf("Running good version...\n"); } else { good = 0; printf("Running bad version...\n"); } /* Initialize account */ myacct = createAccount(0.0); printf("initial balance = %lf\n", myacct->balance); /* Create threads */ tids = (pthread_t *) malloc(sizeof(pthread_t)*numThreads); for (i=0; i<numThreads; i++) { value = (int *) malloc(sizeof(int)); *value = i; pthread_create(&tids[i], NULL, run, (void *) value); } /* Wait for all threads to finish */ for (i=0; i<numThreads; i++) { pthread_join(tids[i], NULL); } printf("final balance = %lf\n", myacct->balance); exit(0); }
internetGameLoginDialogImpl::internetGameLoginDialogImpl(QWidget *parent, ConfigFile *c) : QDialog(parent), myConfig(c) { setupUi(this); this->installEventFilter(this); #ifdef ANDROID this->setWindowState(Qt::WindowFullScreen); #endif //html stuff QString createAccount(QString("<a href='http://create-gaming-account.pokerth.net'>%1</a>").arg(tr("Create new user account"))); label_createAnAccount->setText(createAccount); connect(groupBox_reguser, SIGNAL(toggled(bool)), this, SLOT(regUserToggled(bool))); connect(checkBox_guest, SIGNAL(toggled(bool)), this, SLOT(guestUserToggled(bool))); connect(lineEdit_password, SIGNAL(textEdited(QString)), this, SLOT(okButtonCheck())); connect(lineEdit_username, SIGNAL(textEdited(QString)), this, SLOT(okButtonCheck())); }
void AccountsFunctions::loginMenu() { string option; while (true) { cout << "|========================|" << endl; cout << "| Login |" << endl; cout << "| Register |" << endl; cout << "| Return |" << endl; cout << "|========================|" << endl; getline(cin, option); if (option == "Login" || option == "login") { loginAccount(); } else if (option == "Register" || option == "register") { createAccount(); } else if (option == "Return" || option == "return") { return; } else { cout << "Wrong input!" << endl; return; } } }
static void handlePaperKeyToAccount (void) { char paperKey[1024]; printf ("Enter PaperKey: "); char *readPaperKey = fgets (paperKey, 1023, stdin); size_t paperKeyLen = strlen (paperKey); if (0 == paperKeyLen) { printf ("Failed\n"); return; }; if ('\n' == paperKey[paperKeyLen-1]) paperKey[paperKeyLen - 1] = '\0'; printf ("Read: %s\n", paperKey); BREthereumAccount account = createAccount(paperKey); char *publicAddress = accountGetPrimaryAddressString(account); printf ("Public Address: %s\n", publicAddress); free (publicAddress); }
//------------------------------------------------------------------------------------- void ClientObject::gameTick() { if(pChannel()->endpoint()) { pChannel()->handleMessage(NULL); sendTick(); } switch(state_) { case C_STATE_INIT: state_ = C_STATE_PLAY; if(!initCreate() || !createAccount()) return; break; case C_STATE_LOGIN: state_ = C_STATE_PLAY; if(!login()) return; break; case C_STATE_LOGIN_GATEWAY: state_ = C_STATE_PLAY; if(!initLoginGateWay() || !loginGateWay()) return; break; case C_STATE_PLAY: break; default: KBE_ASSERT(false); break; }; }
void MoodBoxServer::createAccount(Callback callback, UserAccount userAccount, QString inviteCode) { createAccount(callback, QVariant(), userAccount, inviteCode); }
//------------------------------------------------------------------------------------- void ClientObject::gameTick() { if(pServerChannel()->pEndPoint()) { pServerChannel()->processPackets(NULL); } else { if(connectedGateway_) { EventData_ServerCloased eventdata; eventHandler_.fire(&eventdata); connectedGateway_ = false; canReset_ = true; state_ = C_STATE_INIT; DEBUG_MSG(fmt::format("ClientObject({})::tickSend: serverCloased! name({})!\n", this->appID(), this->name())); } } if(locktime() > 0 && timestamp() < locktime()) { return; } switch(state_) { case C_STATE_INIT: state_ = C_STATE_PLAY; if(!initCreate()) return; break; case C_STATE_CREATE: state_ = C_STATE_PLAY; if(!createAccount()) return; break; case C_STATE_LOGIN: state_ = C_STATE_PLAY; if(!login()) return; break; case C_STATE_LOGIN_GATEWAY_CREATE: state_ = C_STATE_PLAY; if(!initLoginGateWay()) return; break; case C_STATE_LOGIN_GATEWAY: state_ = C_STATE_PLAY; if(!loginGateWay()) return; break; case C_STATE_PLAY: break; default: KBE_ASSERT(false); break; }; tickSend(); }
//------------------------------------------------------------------------------------- void ClientObject::gameTick() { if(pServerChannel()->endpoint()) { pServerChannel()->processPackets(NULL); } else { if(connectedGateway_) { EventData_ServerCloased eventdata; eventHandler_.fire(&eventdata); connectedGateway_ = false; canReset_ = true; } } switch(state_) { case C_STATE_INIT: state_ = C_STATE_PLAY; if(!initCreate()) return; break; case C_STATE_CREATE: state_ = C_STATE_PLAY; if(!createAccount()) return; break; case C_STATE_LOGIN: state_ = C_STATE_PLAY; if(!login()) return; break; case C_STATE_LOGIN_GATEWAY_CREATE: state_ = C_STATE_PLAY; if(!initLoginGateWay()) return; break; case C_STATE_LOGIN_GATEWAY: state_ = C_STATE_PLAY; if(!loginGateWay()) return; break; case C_STATE_PLAY: break; default: KBE_ASSERT(false); break; }; tickSend(); }
void AccountFactory::initIP2IPAccount() { // cache this often used account using a weak_ptr ip2ip_account_ = createAccount(SIPAccount::ACCOUNT_TYPE, SIPAccount::IP2IP_PROFILE); }
/*Derived sub-menu of main menu*/ int identifyMenu() { char opt1[] = "Existing profile"; char opt2[] = "New profile"; char opt3[] = "Back"; int posAct = 1; int input = 0; const short int posMin = 1; const short int posMax = 3; clearCommander(0); /*Repeating menu loop*/ while (1 == 1) { silenceOn(); /*Let the text be created!*/ invardTextLineSlide(20, opt1); invardTextLineSlide(21, opt2); invardTextLineSlide(22, opt3); input = 0; /*Text appearance loop*/ while (1 == 1) { if (input == KEY_UP) { posAct--; } else if (input == KEY_DOWN) { posAct++; } /*If ENTER is pressed, exit the loop*/ else if (input == 10) { break; } /*In case if moved outside the min and max boundary*/ if (posAct > posMax) { posAct = posMin; } else if (posAct < posMin) { posAct = posMax; } /*Change the text appearance*/ switch(posAct) { case 1: attron(A_REVERSE); printCenter(20, opt1, 0); attroff(A_REVERSE); printCenter(21, opt2, 0); printCenter(22, opt3, 0); break; case 2: printCenter(20, opt1, 0); attron(A_REVERSE); printCenter(21, opt2, 0); attroff(A_REVERSE); printCenter(22, opt3, 0); break; case 3: printCenter(20, opt1, 0); printCenter(21, opt2, 0); attron(A_REVERSE); printCenter(22, opt3, 0); attroff(A_REVERSE); break; } /*Wait for input*/ flushinp(); input = getch(); } switch (posAct) { case 1: /*If the player has successfully logged in*/ if (userIdentify() == TRUE) { return TRUE; } /*If the player has just left that menu*/ clearCommander(0); break; case 2: createAccount(); clearCommander(0); break; case 3: return 0; break; } /*Run this menu again*/ continue; } return 0; }
void Ui::start() { std::cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; std::string next = mainMenu(); std::string username = ""; Account* account = nullptr; while (next != "quit") { std::cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; if (next == "mainMenu") { next = mainMenu(); } else if (next == "accountMenu") { next = accountMenu(); } else if (next == "createAccount") { username = createAccount(); next = "mainMenu"; if (username.length() != 0) { next = "loadAccount"; } } else if (next == "deleteAccount") { deleteAccount(); next = "mainMenu"; } else if (next == "loadAccount") { account = loadAccount(username); username = ""; next = "accountMenu"; if (account == nullptr) { next = "loadAccount"; } } else if (next == "updateAccount") { updateAccount(account); next = "accountMenu"; } else if (next == "getWithdrawals") { getWithdrawals(account); next = "accountMenu"; } else if (next == "getDeposits") { getDeposits(account); next = "accountMenu"; } else if (next == "withdraw") { withdraw(account); next = "accountMenu"; } else if (next == "deposit") { deposit(account); next = "accountMenu"; } else if (next == "quitAccountMenu") { delete account; account = nullptr; next = "mainMenu"; } } }
const QString CsvUtil::checkCategory(const QString& name, const MyMoneyMoney& value, const MyMoneyMoney& value2) { // Borrowed from MyMoneyQifReader::checkCategory() QString accountId; MyMoneyFile *file = MyMoneyFile::instance(); MyMoneyAccount account; bool found = true; if (!name.isEmpty()) { // The category might be constructed with an arbitraty depth (number of // colon delimited fields). We try to find a parent account within this // hierarchy by searching the following sequence: // // aaaa:bbbb:cccc:ddddd // // 1. search aaaa:bbbb:cccc:dddd, create nothing // 2. search aaaa:bbbb:cccc , create dddd // 3. search aaaa:bbbb , create cccc:dddd // 4. search aaaa , create bbbb:cccc:dddd // 5. don't search , create aaaa:bbbb:cccc:dddd account.setName(name); QString accName; // part to be created (right side in above list) QString parent(name); // a possible parent part (left side in above list) do { accountId = file->categoryToAccount(parent); if (accountId.isEmpty()) { found = false; // prepare next step if (!accName.isEmpty()) accName.prepend(':'); accName.prepend(parent.section(':', -1)); account.setName(accName); parent = parent.section(':', 0, -2); } else if (!accName.isEmpty()) { account.setParentAccountId(accountId); } } while (!parent.isEmpty() && accountId.isEmpty()); // if we did not find the category, we create it if (!found) { MyMoneyAccount parent; if (account.parentAccountId().isEmpty()) { if (!value.isNegative() && value2.isNegative()) parent = file->income(); else parent = file->expense(); } else { parent = file->account(account.parentAccountId()); } account.setAccountType((!value.isNegative() && value2.isNegative()) ? MyMoneyAccount::Income : MyMoneyAccount::Expense); MyMoneyAccount brokerage; // clear out the parent id, because createAccount() does not like that account.setParentAccountId(QString()); createAccount(account, parent, brokerage, MyMoneyMoney()); accountId = account.id(); } } return accountId; }
void MainWindow::checkForPasswordFile() { QString fileInput = "password.txt"; QString hidden = ".password.txt"; QList<QString> asList; QFile file(fileInput); if (!file.exists() && !QFile(hidden).exists()) { UserWindow * newUser = new UserWindow(0, false); connect(newUser, SIGNAL(createAccount(QString,QString)), this, SLOT(makeAccount(QString,QString))); newUser->show(); }//first run, or file cannot be found. else if (!file.exists() && QFile(hidden).exists()) { QFile file2(hidden); file2.copy(fileInput); /** Load the password into memory. **/ if (!file2.open(QIODevice::ReadOnly)) { QMessageBox::critical(this, tr("Error"), tr("Could not open file")); return; }//end if QTextStream in(&file2); while (!in.atEnd()) { asList.push_back(in.readLine()); }//iterate through the file. All of it. Store. if (asList.size() > 0) { QString current = asList.at(0); int index1 = current.indexOf("User:"******"password: "******"") { /** Load the password into memory. **/ if (!file.open(QIODevice::ReadOnly)) { QMessageBox::critical(this, tr("Error"), tr("Could not open file")); return; }//end if QTextStream in(&file); while (!in.atEnd()) { asList.push_back(in.readLine()); }//iterate through the file. All of it. Store. if (asList.size() > 0) { QString current = asList.at(0); int index1 = current.indexOf("User:"******"password: " current.remove(0, 10); m_password = current; }//end if countCash(); displayInfo(); }//open last save. }
void Database::createDBFile(const QString& file) { QSqlDatabase db = createDatabase(file); createAccount(db); }