virtual bool run(OperationContext* opCtx, const std::string& db, const BSONObj& cmdObj, BSONObjBuilder& result) override { auto client = opCtx->getClient(); ServiceContext* serviceContext = client->getServiceContext(); auto lsCache = LogicalSessionCache::get(serviceContext); boost::optional<LogicalSessionRecord> record = makeLogicalSessionRecord(opCtx, lsCache->now()); uassertStatusOK(lsCache->startSession(opCtx, record.get())); makeLogicalSessionToClient(record->getId()).serialize(&result); return true; }
void AFPSGPlayerController::clientStartSession_Implementation() { GEngine->AddOnScreenDebugMessage(-1, 20.0f, FColor::Cyan, TEXT("AFPSGPlayerController::clientStartSession_Implementation")); AFPSGPlayerState* myPlayerState = Cast<AFPSGPlayerState>(PlayerState); //Clear timer in case it was used (Usually nothing to clear) GetWorldTimerManager().ClearTimer(invokeStartSessionTimerHandle); if (myPlayerState != NULL) { //Start the session startSession(myPlayerState->SessionName); } else { //In case the player state has not been replicated yet, keep executing this function GetWorldTimerManager().SetTimer(invokeStartSessionTimerHandle, this, &AFPSGPlayerController::clientStartSession, 0.2f, false); } }
bool OSSMidiPortDriver::setPortProperties(MidiPropertiesDialog *mpd, MidiSession *midiSession) { int sessionIx = -1; QString midiPortName = ""; if (midiSession != NULL) { for (int i = 0; i < sessions.size(); i++) { if (sessions[i]->midiSession == midiSession) { sessionIx = i; midiPortName = sessions[i]->midiPortName; break; } } } QList<QString> midiInPortNames; OSSMidiPortDriver::enumPorts(midiInPortNames); midiInPortNames.removeOne(sequencerName); mpd->setMidiList(midiInPortNames, -1); mpd->setMidiPortName(midiPortName); if (mpd->exec() != QDialog::Accepted) return false; if (sessionIx == -1 || midiPortName == mpd->getMidiPortName()) return true; stopSession(sessions[sessionIx]); midiSession->getSynthRoute()->setMidiSessionName(midiSession, mpd->getMidiPortName()); return startSession(midiSession, mpd->getMidiPortName(), false); }
int CraftingSessionImplementation::initializeSession(CraftingTool* tool, CraftingStation* station) { craftingTool = tool; craftingStation = station; ManagedReference<CreatureObject*> crafter = this->crafter.get(); ManagedReference<CraftingTool*> craftingTool = this->craftingTool.get(); crafter->addActiveSession(SessionFacadeType::CRAFTING, _this.get()); craftingTool->addActiveSession(SessionFacadeType::CRAFTING, _this.get()); craftingTool->setCountdownTimer(0, true); craftingTool->disperseItems(); crafterGhost = crafter->getPlayerObject(); craftingManager = crafter->getZoneServer()->getCraftingManager(); experimentationPointsTotal = 0; experimentationPointsUsed = 0; return startSession(); }
void AnnouncementDialog::onSessionStart(const AmSipRequest& req) { DBG("AnnouncementDialog::onSessionStart\n"); startSession(); }
/** * Constructor. Connect all of the object and the job control. */ KAudioCreator::KAudioCreator( QWidget* parent, const char* name) : KMainWindow(parent, name) { janusWidget = new KJanusWidget(this, name, KJanusWidget::Tabbed); setCentralWidget(janusWidget); QVBox *frame = janusWidget->addVBoxPage(i18n("&CD Tracks"), QString::null, SmallIcon("cdaudio_unmount", 32)); tracks = new TracksImp(frame, "Tracks"); ripper = new Ripper ( frame, "Rip" ); encoder = new Encoder( frame, "Encoder" ); frame = janusWidget->addVBoxPage( i18n("&Jobs"), QString::null, SmallIcon( "run", 32 ) ); jobQue = new JobQueImp( frame, "Que" ); resize(500, 440); /*KAction *eject = */new KAction( i18n("&Eject CD"), 0, tracks, SLOT( eject() ), actionCollection(), "eject" ); (void)new KAction( i18n("&Configure KAudioCreator..."), 0, this, SLOT( showSettings() ), actionCollection(), "configure_kaudiocreator" ); KAction *selectAll = new KAction( i18n( "Select &All Tracks"), 0, tracks, SLOT( selectAllTracks() ), actionCollection(), "select_all" ) ; KAction *deselectAll = new KAction( i18n( "Deselect &All Tracks"), 0, tracks, SLOT( deselectAllTracks() ), actionCollection(), "deselect_all" ); selectAll->setEnabled( false ); deselectAll->setEnabled( false ); KActionMenu *actActionMenu = new KActionMenu( i18n("Rip &Selection"), "rip", actionCollection(), "rip" ); actActionMenu->setDelayed(true); //needed for checking "all accounts" actActionMenu->setEnabled( false ); connect( actActionMenu, SIGNAL( activated() ), tracks, SLOT( startSession() ) ); ripMenu = actActionMenu->popupMenu(); connect( ripMenu, SIGNAL( activated(int) ), this, SLOT( slotRipSelection(int)) ); connect( ripMenu, SIGNAL( aboutToShow() ), this, SLOT( getRipMenu()) ); KAction *rip = new KAction( i18n( "Rip &Selection" ), 0, tracks, SLOT( startSession() ), actionCollection(), "rip_selected" ); rip->setEnabled( false ); connect( jobQue, SIGNAL( removeJob(int) ), this, SLOT( updateStatus() ) ); connect( jobQue, SIGNAL( removeJob(int) ), ripper, SLOT( removeJob(int) ) ); connect( jobQue, SIGNAL( removeJob(int) ), encoder, SLOT( removeJob(int)) ); connect( ripper, SIGNAL( updateProgress(int, int) ) , jobQue, SLOT( updateProgress(int,int) ) ); connect( ripper, SIGNAL( addJob(Job*, const QString &) ), jobQue, SLOT( addJob(Job*, const QString &)) ); connect( ripper, SIGNAL( eject(const QString &) ) , tracks, SLOT( ejectDevice(const QString &)) ); connect( ripper, SIGNAL( encodeWav(Job *) ) , encoder, SLOT( encodeWav(Job *)) ); connect( ripper, SIGNAL( jobsChanged() ) , this, SLOT( updateStatus() ) ); connect( encoder, SIGNAL( updateProgress(int, int) ) , jobQue, SLOT( updateProgress(int,int)) ); connect( encoder, SIGNAL( addJob(Job*, const QString&)), jobQue, SLOT( addJob(Job*, const QString &)) ); connect( encoder, SIGNAL( jobsChanged() ) , this, SLOT( updateStatus() ) ); connect( tracks, SIGNAL( hasCD(bool) ) , this, SLOT( hasCD(bool) ) ); connect( tracks, SIGNAL( ripTrack(Job *) ), ripper, SLOT( ripTrack(Job *)) ); connect( tracks, SIGNAL( hasTracks(bool) ), rip, SLOT( setEnabled(bool)) ); connect( tracks, SIGNAL( hasTracks(bool) ), actActionMenu, SLOT( setEnabled(bool)) ); connect( tracks, SIGNAL( hasTracks(bool) ), deselectAll, SLOT( setEnabled(bool)) ); connect( tracks, SIGNAL( hasTracks(bool) ), selectAll, SLOT( setEnabled(bool)) ); (void)new KAction(i18n("Remove &Completed Jobs"), 0, jobQue, SLOT(clearDoneJobs()), actionCollection(), "clear_done_jobs" ); KAction *edit = new KAction(i18n("&Edit Album..."), 0, tracks, SLOT(editInformation()), actionCollection(), "edit_cd"); connect(tracks, SIGNAL(hasCD(bool)), edit, SLOT(setEnabled(bool))); edit->setEnabled( false ); (void)new KAction(i18n("Encode &File..."), 0, this, SLOT(encodeFile()), actionCollection(), "encode_file"); KAction *cddb = new KAction(i18n("&CDDB Lookup"), 0, tracks, SLOT(performCDDB()), actionCollection(), "cddb_now"); connect(tracks, SIGNAL(hasCD(bool)), cddb, SLOT(setEnabled(bool))); cddb->setEnabled( false ); KStdAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection()); KStdAction::quit( this, SLOT(close()), actionCollection(), "quit" ); // Init statusbar statusBar()->insertItem(i18n("No Audio CD detected"), 0 ); hasCD(tracks->hasCD()); setupGUI(); }
void Client::checkAuthentication(QString authentication, bool encrypted) { QString status = "failed", message = QString(); if (encrypted) authentication = QByteArray::fromBase64(authentication.toLatin1()); QStringList usernamePassword = QString(authentication).split(":"); QString hashedPassword = QCryptographicHash::hash(usernamePassword[1].toLatin1(), QCryptographicHash::Md5).toHex(); socketOut.writeStartElement("authentication"); socketOut.writeAttribute("id", "status"); QSqlQuery retrieveUser; retrieveUser.prepare("SELECT acd_agent_id, name, password, fullname, level " "FROM acd_agent " "WHERE name = :username AND password = :password"); retrieveUser.bindValue(":username", usernamePassword[0]); retrieveUser.bindValue(":password", hashedPassword); if (retrieveUser.exec()) { if (retrieveUser.next()) { username = usernamePassword[0]; fullname = retrieveUser.value(3).toString(); level = (Level) retrieveUser.value(4).toUInt(); agentId = retrieveUser.value(0).toUInt(); status = "ok"; socketOut.writeTextElement("level", QString::number(level)); socketOut.writeTextElement("login", QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")); if (!extension.isEmpty()) socketOut.writeTextElement("extension", extension); else retrieveExtension(); retrieveSkills(); retrieveGroups(); startSession(); startStatus(Login); emit userLoggedIn(); } else { message = "Username/Password incorrect"; } } else { message = "Retrieve user query error"; logFailedQuery(&retrieveUser, "retrieving user"); } socketOut.writeTextElement("status", status); if (!message.isEmpty()) socketOut.writeTextElement("message", message); socketOut.writeEndElement(); // authentication socket->write("\n"); }
bool SocketServer::doAccept() { m_services.lock(); m_services_poller.clear(); for (unsigned i = 0; i < m_services.size(); i++) { m_services_poller.add(m_services[i].m_socket, true, false, true); } assert(m_services.size() == m_services_poller.count()); const int accept_timeout_ms = 1000; const int ret = m_services_poller.poll(accept_timeout_ms); if (ret < 0) { // Error occured, indicate error to caller by returning false m_services.unlock(); return false; } if (ret == 0) { // Timeout occured m_services.unlock(); return true; } bool result = true; for (unsigned i = 0; i < m_services_poller.count(); i++) { const bool has_read = m_services_poller.has_read(i); if (!has_read) continue; // Ignore events where read flag wasn't set ServiceInstance & si = m_services[i]; assert(m_services_poller.is_socket_equal(i, si.m_socket)); const NDB_SOCKET_TYPE childSock = my_accept(si.m_socket, 0, 0); if (!my_socket_valid(childSock)) { // Could not 'accept' socket(maybe at max fds), indicate error // to caller by returning false result = false; continue; } SessionInstance s; s.m_service = si.m_service; s.m_session = si.m_service->newSession(childSock); if (s.m_session != 0) { m_session_mutex.lock(); m_sessions.push_back(s); startSession(m_sessions.back()); m_session_mutex.unlock(); } } m_services.unlock(); return result; }
void ViewerAppliInternal::postAnEvent(QEvent *e) { startSession(); getViewer()->post(e); }
void CacheAnnounceDialog::onSessionStart(const AmSipRequest& req) { DBG("CacheAnnounceDialog::onSessionStart\n"); startSession(); }
void ApplicationSession::run() { if(!_p->_session->isConnected()) startSession(); Application::run(); }
void ApplicationSession::start() { startSession(); }
void ADStatistics::onResume() { startSession(); }
/** interface for ios */ void AnalyticsUmeng::startSession(const char* appKey, UmengReportPolicy policy, const char* channelId) { startSession(appKey); }
void AnnouncementDialog::onSessionStart(const AmSipReply& rep) { DBG("AnnouncementDialog::onSessionStart (SEMS originator mode)\n"); startSession(); }
int fsm(isc_opt_t *op) { state_t state; isess_t *sess; if((sess = calloc(1, sizeof(isess_t))) == NULL) { // boy, is this a bad start ... fprintf(stderr, "no memory!\n"); return -1; } state = S1; sess->op = op; sess->fd = -1; sess->soc = -1; sess->target.address = strdup(op->targetAddress); sess->target.port = op->port; sess->target.pgt = op->targetPortalGroupTag; sess->flags = SESS_INITIALLOGIN | SESS_INITIALLOGIN1; do { switch(state) { case S1: switch(tcpConnect(sess)) { case T1: state = S2; break; default: state = S8; break; } break; case S2: switch(startSession(sess)) { case T2: state = S1; break; case T4: state = S4; break; default: state = S8; break; } break; case S4: switch(doLogin(sess)) { case T7: state = S1; break; case T5: state = S5; break; default: state = S8; break; } break; case S5: switch(supervise(sess)) { case T8: state = S1; break; case T9: state = S6; break; case T11: state = S7; break; case T15: state = S8; break; default: state = S8; break; } break; case S6: switch(startLogout(sess)) { case T13: state = S1; break; case T14: state = S6; break; case T16: state = S8; break; default: state = S8; break; } break; case S7: switch(inLogout(sess)) { case T18: state = S1; break; case T10: state = S6; break; case T12: state = S7; break; case T16: state = S8; break; default: state = S8; break; } break; case S8: // maybe do some clean up? syslog(LOG_INFO, "terminated"); return 0; } } while(1); }
void OtrInternal::startSession(const QString& account, const QString& jid, TreeModelItem &item) { startSession(account,jid,item,(int)OTRL_POLICY_DEFAULT); }