RsControlModule::RsControlModule(int argc, char **argv, StateTokenServer* sts, ApiServer *apiserver, bool full_control): mStateTokenServer(sts), mApiServer(apiserver), mExitFlagMtx("RsControlModule::mExitFlagMtx"), mProcessShouldExit(false), mDataMtx("RsControlModule::mDataMtx"), mRunState(WAITING_INIT), mAutoLoginNextTime(false), mWantPassword(false), mPrevIsBad(false), mCountAttempts(0), mPassword("") { mStateToken = sts->getNewToken(); this->argc = argc; this->argv = argv; // start worker thread if(full_control) start("resapi ctrl mod"); else mRunState = RUNNING_OK_NO_FULL_CONTROL; addResourceHandler("runstate", this, &RsControlModule::handleRunState); addResourceHandler("identities", this, &RsControlModule::handleIdentities); addResourceHandler("locations", this, &RsControlModule::handleLocations); addResourceHandler("password", this, &RsControlModule::handlePassword); addResourceHandler("login", this, &RsControlModule::handleLogin); addResourceHandler("shutdown", this, &RsControlModule::handleShutdown); addResourceHandler("import_pgp", this, &RsControlModule::handleImportPgp); addResourceHandler("create_location", this, &RsControlModule::handleCreateLocation); }
ForumHandler::ForumHandler(RsGxsForums* forums): mRsGxsForums(forums) { addResourceHandler("*", this, &ForumHandler::handleWildcard); }
IdentityHandler::IdentityHandler(RsIdentity *identity): mRsIdentity(identity) { addResourceHandler("*", this, &IdentityHandler::handleWildcard); addResourceHandler("own", this, &IdentityHandler::handleOwn); }
ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs, RsPeers* peers, RsIdentity* identity, UnreadMsgNotify* unread): mStateTokenServer(sts), mNotify(notify), mRsMsgs(msgs), mRsPeers(peers), mRsIdentity(identity), mUnreadMsgNotify(unread), mMtx("ChatHandler::mMtx") { mNotify->registerNotifyClient(this); mStateTokenServer->registerTickClient(this); mMsgStateToken = mStateTokenServer->getNewToken(); mLobbiesStateToken = mStateTokenServer->getNewToken(); mUnreadMsgsStateToken = mStateTokenServer->getNewToken(); addResourceHandler("*", this, &ChatHandler::handleWildcard); addResourceHandler("lobbies", this, &ChatHandler::handleLobbies); addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby); addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby); addResourceHandler("messages", this, &ChatHandler::handleMessages); addResourceHandler("send_message", this, &ChatHandler::handleSendMessage); addResourceHandler("mark_chat_as_read", this, &ChatHandler::handleMarkChatAsRead); addResourceHandler("info", this, &ChatHandler::handleInfo); addResourceHandler("typing_label", this, &ChatHandler::handleTypingLabel); addResourceHandler("send_status", this, &ChatHandler::handleSendStatus); addResourceHandler("unread_msgs", this, &ChatHandler::handleUnreadMsgs); }
ServiceControlHandler::ServiceControlHandler(RsServiceControl* control): mRsServiceControl(control) { addResourceHandler("*", this, &ServiceControlHandler::handleWildcard); addResourceHandler("user", this, &ServiceControlHandler::handleUser); }
StatsHandler::StatsHandler() { addResourceHandler("*", this, &StatsHandler::handleStatsRequest); }