void CWebSock::SetVars() { m_Template["SessionUser"] = GetUser(); m_Template["SessionIP"] = GetRemoteIP(); m_Template["Tag"] = CZNC::GetTag(GetSession()->GetUser() != NULL); m_Template["SkinName"] = GetSkinName(); m_Template["_CSRF_Check"] = GetCSRFCheck(); if (GetSession()->IsAdmin()) { m_Template["IsAdmin"] = "true"; } GetSession()->FillMessageLoops(m_Template); GetSession()->ClearMessageLoops(); // Global Mods CGlobalModules& vgMods = CZNC::Get().GetModules(); for (unsigned int a = 0; a < vgMods.size(); a++) { AddModLoop("GlobalModLoop", *vgMods[a]); } // User Mods if (IsLoggedIn()) { CModules& vMods = GetSession()->GetUser()->GetModules(); for (unsigned int a = 0; a < vMods.size(); a++) { AddModLoop("UserModLoop", *vMods[a]); } } if (IsLoggedIn()) { m_Template["LoggedIn"] = "true"; } }
void Player::SetMenu(GuiMenu* menu) { if (IsLocalPlayer()) { // If carrying, drop is option if (m_carrying) { AddMenuItem("Put down", new CommandPickUp(m_carrying, false)); } } else if (IsLoggedIn()) { //menu->AddChild(new GuiMenuItem("Talk to " + GetName(), new CommandTalk(this))); AddMenuItem("Talk to " + GetName(), new CommandTalk(this)); /* NO FIGHTING AddMenuItem("FIGHT!!", new CommandFight(this)); */ } else { // TODO put back leaving messages //menu->AddChild(new GuiMenuItem("Leave a message for " + GetName(), new CommandTalk(this))); //AddMenuItem("Leave a message for " + GetName(), new CommandTalk(this)); } }
void SoundCloudService::EnsureItemsCreated() { if (!search_) { search_ = new QStandardItem(IconLoader::Load("edit-find", IconLoader::Base), tr("Search results")); search_->setToolTip( tr("Start typing something on the search box above to " "fill this search results list")); search_->setData(InternetModel::PlayBehaviour_MultipleItems, InternetModel::Role_PlayBehaviour); root_->appendRow(search_); } if (!user_tracks_ && !user_activities_ && !user_playlists_ && IsLoggedIn()) { user_activities_ = new QStandardItem(tr("Activities stream")); user_activities_->setData(InternetModel::PlayBehaviour_MultipleItems, InternetModel::Role_PlayBehaviour); root_->appendRow(user_activities_); user_playlists_ = new QStandardItem(tr("Playlists")); root_->appendRow(user_playlists_); user_tracks_ = new QStandardItem(tr("Tracks")); user_tracks_->setData(InternetModel::PlayBehaviour_MultipleItems, InternetModel::Role_PlayBehaviour); root_->appendRow(user_tracks_); RetrieveUserData(); // at least, try to (this will do nothing if user isn't // logged) } }
//=============================================================================* void BAR_CSCOnlineProxy::CommitOnlineChange(CComBSTR strPrjGUID, CComBSTR strDLoadGUID) //=============================================================================* { BAR_TRACE(2, "commiting online change"); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not commit online change before logged in"); } //=== start online change HRESULT hr = m_pITransfer->CommitOnlineChange(m_lSessionKey, ProgramDomains, L"", L"", strPrjGUID, strDLoadGUID); if ( FAILED(hr) ) { Throw_CommitOnlineChangeFailed(hr, ProgramDomains); } hr = m_pITransfer->CommitOnlineChange(m_lSessionKey, VisualDomains, L"", L"", strPrjGUID, strDLoadGUID); if ( FAILED(hr) ) { Throw_CommitOnlineChangeFailed(hr, VisualDomains); } }
//=============================================================================* void BAR_CSCOnlineProxy::StartOnlineChange() //=============================================================================* { BAR_TRACE(2, "starting online change"); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not start online change before logged in"); } //=== start online change HRESULT hr = m_pITransfer->StartOnlineChange(m_lSessionKey, ProgramDomains/*, L""*/); if ( FAILED(hr) ) { Throw_StartOnlineChangeFailed(hr, ProgramDomains); } hr = m_pITransfer->StartOnlineChange(m_lSessionKey, VisualDomains/*, L""*/); if ( FAILED(hr) ) { Throw_StartOnlineChangeFailed(hr, VisualDomains); } }
//=============================================================================* void BAR_CSCOnlineProxy::DeleteAllDomains() //=============================================================================* { BAR_TRACE(2, "deleting all domains"); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not delete domains before logged in"); } //=== delete all domains HRESULT hr = m_pITransfer->DeleteAllDomains(m_lSessionKey, ProgramDomains/*, L""*/); if ( FAILED(hr) ) { Throw_DeletingAllDomainsFailed(hr, ProgramDomains); } hr = m_pITransfer->DeleteAllDomains(m_lSessionKey, VisualDomains/*, L""*/); if ( FAILED(hr) ) { Throw_DeletingAllDomainsFailed(hr, VisualDomains); } }
//=============================================================================* CComBSTR BAR_CSCOnlineProxy::ReadDLAttr(CSC_TRANSFER_TARGET trg, const string& sAttrName) //=============================================================================* { BAR_TRACE2(4, "read download attribute, trg=%s, attr=%s", TrgToString(trg).c_str(), sAttrName.c_str()); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not read download attribute before logged in"); } VARIANT vtAttrVal; //=== read download attribute HRESULT hr = m_pITransfer->get_DLoadAttribute(m_lSessionKey, trg, //CComBSTR(""), CComBSTR(sAttrName.c_str()), &vtAttrVal); if ( FAILED(hr) ) { Throw_ReadingDLAttrFailed(hr, trg, ToWS(sAttrName)); } if ( vtAttrVal.vt != VT_BSTR ) { Throw_FatalError(L"read download attribute has wrong type"); } //=== finished return vtAttrVal.bstrVal; }
//=============================================================================* void BAR_CSCOnlineProxy::DownloadDomain(CSC_TRANSFER_TARGET trg, CComBSTR strDomainName, SAFEARRAY* psaDomainContent) //=============================================================================* { const wstring wsDetails = wstring(L"trg=") + ToWS(TrgToString(trg)) + L", domain=" + strDomainName.m_str; BAR_WTRACE1(4, L"downloading domain, %s", wsDetails.c_str()); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not download domain before logged in"); } HRESULT hr = m_pITransfer->DownloadDomain(m_lSessionKey, trg, //L"", strDomainName, &psaDomainContent); if ( FAILED(hr) ) { Throw_DownloadDomainFailed(hr, trg, strDomainName.m_str); } }
bool PlayerBot::Login(ObjectGuid characterId) { if (IsLoggedIn()) return false; m_session->HandleBotPlayerLogin(characterId); return true; }
bool PlayerBot::Logout() { if (!IsLoggedIn()) return true; m_session->LogoutPlayer(true); return true; }
bool cSession::ScrobbleOrUpdateTrack(const cMetaData& metaData, bool bScrobble) { std::cout<<"cSession::ScrobbleOrUpdateTrack "<<metaData.sArtist<<" - "<<metaData.sTitle<<std::endl; if (!IsLoggedIn()) { std::cerr<<"cSession::ScrobbleOrUpdateTrack Error not logged in to LastFM"<<std::endl; return false; } const std::string sArtistUTF8 = spitfire::string::ToUTF8(metaData.sArtist); const std::string sTitleUTF8 = spitfire::string::ToUTF8(metaData.sTitle); const std::string sAlbumUTF8 = spitfire::string::ToUTF8(metaData.sAlbum); char* szArtistUTF8 = new char[sArtistUTF8.length() + 1]; strcpy(szArtistUTF8, sArtistUTF8.c_str()); char* szTitleUTF8 = new char[sTitleUTF8.length() + 1]; strcpy(szTitleUTF8, sTitleUTF8.c_str()); char* szAlbumUTF8 = new char[sAlbumUTF8.length() + 1]; strcpy(szAlbumUTF8, sAlbumUTF8.c_str()); const uint64_t uiLengthSeconds = metaData.uiDurationMilliSeconds / 1000; int iResult = -1; if (bScrobble) { /*time_t rawtime; time(&rawtime); tm* ptm = gmtime(&rawtime); time_t started = mktime(ptm); if (ptm->tm_isdst) { ptm->tm_hour += 1; started = mktime(ptm); }*/ // TODO: Start a background thread so we don't have to do this time_t started; time(&started); started -= 31; // simulate playtime iResult = LASTFM_track_scrobble(pSession, szTitleUTF8, szAlbumUTF8, szArtistUTF8, started, uiLengthSeconds, 0, 0, nullptr); } else iResult = LASTFM_track_update_now_playing(pSession, szTitleUTF8, szAlbumUTF8, szArtistUTF8, uiLengthSeconds, 0, 0, nullptr); delete [] szAlbumUTF8; delete [] szTitleUTF8; delete [] szArtistUTF8; const char* szStatus = nullptr; const int* iErrorCode = nullptr; const char* szErrorText = nullptr; LASTFM_status(pSession, &szStatus, &iErrorCode, &szErrorText); std::cout<<"cSession::ScrobbleOrUpdateTrack returning "<<(iResult == 0)<<", status="<<szStatus<<", error="<<iErrorCode<<", "<<szErrorText<<std::endl; return (iResult == 0); }
bool CWebSock::OnLogin(const CString& sUser, const CString& sPass) { DEBUG("=================== CWebSock::OnLogin()"); m_spAuth = new CWebAuth(this, sUser, sPass); // Some authentication module could need some time, block this socket // until then. CWebAuth will UnPauseRead(). PauseRead(); CZNC::Get().AuthUser(m_spAuth); // If CWebAuth already set this, don't change it. return IsLoggedIn(); }
//=============================================================================* void BAR_CSCOnlineProxy::Logout() { if ( IsLoggedIn() ) { BAR_TRACE(2, "logout started"); } DisconnectFromControl(); //=== unregister type libs if any were registered if ( m_pTlbCSCOnlSrv != NULL ) { delete m_pTlbCSCOnlSrv; m_pTlbCSCOnlSrv = NULL; } //=== finished if ( IsLoggedIn() ) { BAR_TRACE(2, "logged out"); } SetLoggedIn(false); }
bool IRCCmd::CanUse(std::string USER, int nLevel) { if(IsLoggedIn(USER)) { if(GetLevel(USER) >= nLevel) return true; else return false; } else if(nLevel == 0) { return true; } else sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : You Are Not Logged In!", true, "ERROR"); return false; }
bool cSession::LoveTrack(const cMetaData& metaData) { std::cout<<"cSession::LoveTrack "<<metaData.sArtist<<" - "<<metaData.sTitle<<std::endl; if (!IsLoggedIn()) { std::cerr<<"cSession::LoveTrack Error not logged in to LastFM"<<std::endl; return false; } const std::string sArtistUTF8 = spitfire::string::ToUTF8(metaData.sArtist); const std::string sTitleUTF8 = spitfire::string::ToUTF8(metaData.sTitle); int iResult = LASTFM_track_love(pSession, sTitleUTF8.c_str(), sArtistUTF8.c_str()); const char* szStatus = nullptr; const int* iErrorCode = nullptr; const char* szErrorText = nullptr; LASTFM_status(pSession, &szStatus, &iErrorCode, &szErrorText); std::cout<<"cSession::LoveTrack returning "<<(iResult == 0)<<", status="<<szStatus<<", error="<<iErrorCode<<", "<<szErrorText<<std::endl; return (iResult == 0); }
void Player::OnLocationEntry() { Ve1ObjectChar::OnLocationEntry(); SceneNode* root = GetVe1SceneGraph()->GetRootNode(SceneGraph::AMJU_OPAQUE); if (root) { root->AddChild(m_arrow.GetPtr()); SetArrowVis(false); } m_nameTag = new PlayerNameNode(this); if (m_sceneNode) { if (m_nameTag) { m_sceneNode->AddChild(m_nameTag.GetPtr()); } if (m_effect) { m_sceneNode->AddChild(m_effect.GetPtr()); } } // TODO Portal should have a heading which you should face when you appear at the destination m_isMoving = false; SetVel(Vec3f(0, 0, 0)); // TODO walk out of doorway ? // TODO Set m_newPos ?? // Set appearance SetLoggedIn(IsLoggedIn()); // If we are carrying something, change its location too if (m_carrying) { TheObjectUpdater::Instance()->SendChangeLocationReq(m_carrying->GetId(), GetPos(), GetLocation()); } }
//=============================================================================* void BAR_CSCOnlineProxy::UploadDomain(CSC_TRANSFER_TARGET trg, const string& sDomain, SAFEARRAY*& psa) //=============================================================================* { const string sDetails = string("trg=") + TrgToString(trg) + ", domain=" + sDomain; BAR_TRACE1(4, "uploading domain, %s", sDetails.c_str()); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not upload domain before logged in"); } psa = NULL; /* V1.3 HRESULT hr = m_pITransfer->UploadDomain(m_lSessionKey, trg, CComBSTR(""), CComBSTR(sDomain.c_str()), &psa); */ HRESULT hr = m_pITransfer->UploadDomain(m_lSessionKey, trg, CComBSTR(sDomain.c_str()), &psa); if ( FAILED(hr) ) { Throw_UploadDomainFailed(hr, ToWS(sDetails)); } assert( psa != NULL ); if ( psa == NULL ) { Throw_FatalError(wstring(L"null domain uploaded, ") + ToWS(sDetails)); } }
CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CString& sPageRet) { if (CZNC::Get().GetProtectWebSessions() && GetSession()->GetIP() != GetRemoteIP()) { DEBUG("Expected IP: " << GetSession()->GetIP()); DEBUG("Remote IP: " << GetRemoteIP()); PrintErrorPage(403, "Access denied", "This session does not belong to your IP."); return PAGE_DONE; } // Check that they really POSTed from one our forms by checking if they // know the "secret" CSRF check value. Don't do this for login since // CSRF against the login form makes no sense and the login form does a // cookies-enabled check which would break otherwise. if (IsPost() && GetParam("_CSRF_Check") != GetCSRFCheck() && sURI != "/login") { DEBUG("Expected _CSRF_Check: " << GetCSRFCheck()); DEBUG("Actual _CSRF_Check: " << GetParam("_CSRF_Check")); PrintErrorPage(403, "Access denied", "POST requests need to send " "a secret token to prevent cross-site request forgery attacks."); return PAGE_DONE; } SendCookie("SessionId", GetSession()->GetId()); if (GetSession()->IsLoggedIn()) { m_sUser = GetSession()->GetUser()->GetUserName(); m_bLoggedIn = true; } // Handle the static pages that don't require a login if (sURI == "/") { if(!m_bLoggedIn && GetParam("cookie_check", false).ToBool() && GetRequestCookie("SessionId").empty()) { GetSession()->AddError("Your browser does not have cookies enabled for this site!"); } return PrintTemplate("index", sPageRet); } else if (sURI == "/favicon.ico") { return PrintStaticFile("/pub/favicon.ico", sPageRet); } else if (sURI == "/robots.txt") { return PrintStaticFile("/pub/robots.txt", sPageRet); } else if (sURI == "/logout") { GetSession()->SetUser(NULL); SetLoggedIn(false); Redirect("/"); // We already sent a reply return PAGE_DONE; } else if (sURI == "/login") { if (GetParam("submitted").ToBool()) { m_sUser = GetParam("user"); m_sPass = GetParam("pass"); m_bLoggedIn = OnLogin(m_sUser, m_sPass); // AcceptedLogin()/RefusedLogin() will call Redirect() return PAGE_DEFERRED; } Redirect("/"); // the login form is here return PAGE_DONE; } else if (sURI.Left(5) == "/pub/") { return PrintStaticFile(sURI, sPageRet); } else if (sURI.Left(11) == "/skinfiles/") { CString sSkinName = sURI.substr(11); CString::size_type uPathStart = sSkinName.find("/"); if (uPathStart != CString::npos) { CString sFilePath = sSkinName.substr(uPathStart + 1); sSkinName.erase(uPathStart); m_Template.ClearPaths(); m_Template.AppendPath(GetSkinPath(sSkinName) + "pub"); if (PrintFile(m_Template.ExpandFile(sFilePath))) { return PAGE_DONE; } else { return PAGE_NOTFOUND; } } return PAGE_NOTFOUND; } else if (sURI.Left(6) == "/mods/" || sURI.Left(10) == "/modfiles/") { ParsePath(); // Make sure modules are treated as directories if (sURI.Right(1) != "/" && sURI.find(".") == CString::npos && sURI.TrimLeft_n("/mods/").TrimLeft_n("/").find("/") == CString::npos) { Redirect(sURI + "/"); return PAGE_DONE; } CModule *pModule = CZNC::Get().GetModules().FindModule(m_sModName); if (!pModule) { // Check if GetSession()->GetUser() is NULL and display // an error in that case if (!ForceLogin()) return PAGE_DONE; pModule = GetSession()->GetUser()->GetModules().FindModule(m_sModName); } if (!pModule) { return PAGE_NOTFOUND; } else if (pModule->WebRequiresLogin() && !ForceLogin()) { return PAGE_PRINT; } else if (pModule->WebRequiresAdmin() && !GetSession()->IsAdmin()) { PrintErrorPage(403, "Forbidden", "You need to be an admin to access this module"); return PAGE_DONE; } else if (!pModule->IsGlobal() && pModule->GetUser() != GetSession()->GetUser()) { PrintErrorPage(403, "Forbidden", "You must login as " + pModule->GetUser()->GetUserName() + " in order to view this page"); return PAGE_DONE; } else if (pModule->OnWebPreRequest(*this, m_sPage)) { return PAGE_DEFERRED; } VWebSubPages& vSubPages = pModule->GetSubPages(); for (unsigned int a = 0; a < vSubPages.size(); a++) { TWebSubPage& SubPage = vSubPages[a]; bool bActive = (m_sModName == pModule->GetModName() && m_sPage == SubPage->GetName()); if (bActive && SubPage->RequiresAdmin() && !GetSession()->IsAdmin()) { PrintErrorPage(403, "Forbidden", "You need to be an admin to access this page"); return PAGE_DONE; } } if (pModule && !pModule->IsGlobal() && (!IsLoggedIn() || pModule->GetUser() != GetSession()->GetUser())) { AddModLoop("UserModLoop", *pModule); } if (sURI.Left(10) == "/modfiles/") { m_Template.AppendPath(GetSkinPath(GetSkinName()) + "/mods/" + m_sModName + "/files/"); m_Template.AppendPath(pModule->GetModDataDir() + "/files/"); if (PrintFile(m_Template.ExpandFile(m_sPage.TrimLeft_n("/")))) { return PAGE_PRINT; } else { return PAGE_NOTFOUND; } } else { SetPaths(pModule, true); /* if a module returns false from OnWebRequest, it does not want the template to be printed, usually because it did a redirect. */ if (pModule->OnWebRequest(*this, m_sPage, m_Template)) { // If they already sent a reply, let's assume // they did what they wanted to do. if (SentHeader()) { return PAGE_DONE; } return PrintTemplate(m_sPage, sPageRet, pModule); } if (!SentHeader()) { PrintErrorPage(404, "Not Implemented", "The requested module does not acknowledge web requests"); } return PAGE_DONE; } } else { CString sPage(sURI.Trim_n("/")); if (sPage.length() < 32) { for (unsigned int a = 0; a < sPage.length(); a++) { unsigned char c = sPage[a]; if ((c < '0' || c > '9') && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && c != '_') { return PAGE_NOTFOUND; } } return PrintTemplate(sPage, sPageRet); } } return PAGE_NOTFOUND; }
bool CWebSock::AddModLoop(const CString& sLoopName, CModule& Module) { CString sTitle(Module.GetWebMenuTitle()); if (!sTitle.empty() && (IsLoggedIn() || (!Module.WebRequiresLogin() && !Module.WebRequiresAdmin())) && (GetSession()->IsAdmin() || !Module.WebRequiresAdmin())) { CTemplate& Row = m_Template.AddRow(sLoopName); Row["ModName"] = Module.GetModName(); Row["Title"] = sTitle; if (m_sModName == Module.GetModName()) { Row["Active"] = "true"; } if (Module.GetUser()) { Row["Username"] = Module.GetUser()->GetUserName(); } VWebSubPages& vSubPages = Module.GetSubPages(); for (unsigned int a = 0; a < vSubPages.size(); a++) { TWebSubPage& SubPage = vSubPages[a]; // bActive is whether or not the current url matches this subpage (params will be checked below) bool bActive = (m_sModName == Module.GetModName() && m_sPage == SubPage->GetName()); if (SubPage->RequiresAdmin() && !GetSession()->IsAdmin()) { continue; // Don't add admin-only subpages to requests from non-admin users } CTemplate& SubRow = Row.AddRow("SubPageLoop"); SubRow["ModName"] = Module.GetModName(); SubRow["PageName"] = SubPage->GetName(); SubRow["Title"] = SubPage->GetTitle().empty() ? SubPage->GetName() : SubPage->GetTitle(); CString& sParams = SubRow["Params"]; const VPair& vParams = SubPage->GetParams(); for (size_t b = 0; b < vParams.size(); b++) { pair<CString, CString> ssNV = vParams[b]; if (!sParams.empty()) { sParams += "&"; } if (!ssNV.first.empty()) { if (!ssNV.second.empty()) { sParams += ssNV.first.Escape_n(CString::EURL); sParams += "="; sParams += ssNV.second.Escape_n(CString::EURL); } if (bActive && GetParam(ssNV.first, false) != ssNV.second) { bActive = false; } } } if (bActive) { SubRow["Active"] = "true"; } } return true; } return false; }
Player* PlayerBot::GetPlayer() { return IsLoggedIn() ? m_session->GetPlayer() : nullptr; }
// This function checks if chat from irc is a command or not // return true on yes and false on no bool IRCCmd::IsValid(std::string USER, std::string FROM, std::string CHAT, std::string TYPE) { // If the first line of our chat is the command prefix we have a command if(CHAT.substr(0, 1) == sIRC._cmd_prefx && CHAT.size() > 1 ) { _CDATA CDATA; bool cValid = false; bool AuthValid = true; bool dontlog = true; std::string* _PARAMS = getArray(CHAT, 2); CDATA.USER = USER; CDATA.FROM = FROM; CDATA.TYPE = TYPE; CDATA.PCOUNT = 0; CDATA.CMD = MakeUpper(_PARAMS[0].substr(1, _PARAMS[0].size() - 1)); CDATA.PARAMS = _PARAMS[1]; if(CDATA.CMD == "LOGIN") { if (FROM == *(sIRC.GetNick())) { if(ParamsValid(&CDATA, 2)) Handle_Login(&CDATA); else sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"login <Player> <Password> )", true, "ERROR"); } else sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Please Send A PM To Login!", true, "ERROR"); if(GetLevel(USER) >= sIRC.gmlog) dontlog = false; cValid = true; } else if(CDATA.CMD == "LOGOUT") { if (FROM == *(sIRC.GetNick())) Handle_Logout(&CDATA); else sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Please Send A PM To Logout!", true, "ERROR"); cValid = true; } else if(CDATA.CMD == "ACCT") { switch(ParamsValid(&CDATA, 2, sIRC.CACCT)) { case E_OK: Account_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"acct <Player> <(un)lock/mail/pass/rename> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "BAN") { switch(ParamsValid(&CDATA, 2, sIRC.CBAN)) { case E_OK: Ban_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"ban <Player> <acct/ip> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "CHAN") { switch(ParamsValid(&CDATA, 1, sIRC.CCHAN)) { case E_OK: Chan_Control(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"chan <op> <IRC User> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "CHAR") { switch(ParamsValid(&CDATA, 2, sIRC.CCHAR)) { case E_OK: Char_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"char <Player> <mailcheat/taxicheat/maxskill/setskill> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "FUN") { switch(ParamsValid(&CDATA, 2, sIRC.CFUN)) { case E_OK: Fun_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"fun <Player> <Sound/Say> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "HELP") { switch(ParamsValid(&CDATA, 0, sIRC.CHELP)) { case E_OK: Help_IRC(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"help <Command> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "INCHAN") { switch(ParamsValid(&CDATA, 1, sIRC.CINCHAN)) { case E_OK: Inchan_Server(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"inchan <Channel> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "INFO") { switch(ParamsValid(&CDATA, 0, sIRC.CINFO)) { case E_OK: Info_Server(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"info )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "ITEM") { CDATA.PCOUNT = 3; switch(ParamsValid(&CDATA, 2, sIRC.CITEM)) { case E_OK: Item_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"item <Player> <add> <ItemID/[ItemName]> <Amount> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "JAIL") { CDATA.PCOUNT = 3; switch(ParamsValid(&CDATA, 1, sIRC.CJAIL)) { case E_OK: Jail_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"jail <Player> <release/Reason>)", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "KICK") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 1, sIRC.CKICK)) { case E_OK: Kick_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"kick <Player> <Reason> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "KILL") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 1, sIRC._KILL)) { case E_OK: Kill_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"kill <Player> <Reason> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "LEVEL") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 2, sIRC.CLEVEL)) { case E_OK: Level_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"level <Player> <NewLevel> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "LOOKUP") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 2, sIRC.CLOOKUP)) { case E_OK: Lookup_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"lookup <acct/char/creature/faction/go/item/quest/skill/spell/tele> <ID/Name> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "MONEY") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 2, sIRC.CMONEY)) { case E_OK: Money_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"money <Player> <(-)Money> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "MUTE") { switch(ParamsValid(&CDATA, 2, sIRC.CMUTE)) { case E_OK: Mute_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"mute <Player> <release/TimeInMins> <Reason> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "ONLINE") { switch(ParamsValid(&CDATA, 0, sIRC.CONLINE)) { case E_OK: Online_Players(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"online )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "PM") { switch(ParamsValid(&CDATA, 2, sIRC.CPM)) { case E_OK: PM_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"pm <Player> <Message> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "RELOAD") { switch(ParamsValid(&CDATA, 0, sIRC.CRESTART)) { case E_OK: sIRC.Send_IRC_Channels("Reloading MangChat Config Options. (Restart recommended)"); sIRC.LoadConfig(); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "RESTART") { switch(ParamsValid(&CDATA, 0, sIRC.CRESTART)) { case E_OK: sIRC.Send_IRC_Channels(sIRC.RstMsg); sIRC.ResetIRC(); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "REVIVE") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 1, sIRC.CREVIVE)) { case E_OK: Revive_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"revive <Player> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "SAVEALL") { switch(ParamsValid(&CDATA, 0, sIRC.CSAVEALL)) { case E_OK: Saveall_Player(&CDATA); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "SHUTDOWN") { switch(ParamsValid(&CDATA, 1, sIRC.CSHUTDOWN)) { case E_OK: Shutdown_Mangos(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"shutdown <TimeInSeconds/cancel> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "SPELL") { switch(ParamsValid(&CDATA, 2, sIRC.CSPELL)) { case E_OK: Spell_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"spell <Player> <Cast/Learn/UnLearn> <SpellID> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "SYSMSG") { CDATA.PCOUNT = 2; switch(ParamsValid(&CDATA, 2, sIRC.CSYSMSG)) { case E_OK: Sysmsg_Server(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"sysmsg <a/e/n/add/del/list> <Message> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "TELE") { switch(ParamsValid(&CDATA, 2, sIRC.CTELE)) { case E_OK: Tele_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"tele <Player> <l/c/r/to> <Loc.Name/MAPID X Y Z/Recall/Player> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "TOP") { CDATA.PCOUNT = 1; switch(ParamsValid(&CDATA, 1, sIRC.CTOP)) { case E_OK: Top_Player(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"top <accttime/chartime/money> <limit> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } else if(CDATA.CMD == "WHO") { switch(ParamsValid(&CDATA, 0, sIRC.CWHO)) { case E_OK: Who_Logged(&CDATA); break; case E_AUTH: AuthValid = false; break; } cValid = true; } // GM Ticket by bizkut http://github.com/bizkut else if(CDATA.CMD == "TICKET") { CDATA.PCOUNT = 1; switch(ParamsValid(&CDATA, 1, sIRC.CTOP)) { case E_OK: GM_Ticket(&CDATA); break; case E_SIZE: sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"ticket <list/read/respond/delete> <limit/name/all> <message> )", true, "ERROR"); break; case E_AUTH: AuthValid = false; break; } cValid = true; } if(!AuthValid && IsLoggedIn(USER)) sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Access Denied! Your Security Level Is Too Low To Use This Command!", true, "ERROR"); if (cValid == false && (sIRC.BOTMASK & 4)) sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Unknown Command!", true, "ERROR"); if (cValid && dontlog) sIRC.iLog.WriteLog(" %s : [ %s(%d) ] Used Command: [ %s ] With Parameters: [ %s ]", sIRC.iLog.GetLogDateTimeStr().c_str(), CDATA.USER.c_str(), GetLevel(USER), CDATA.CMD.c_str(), CDATA.PARAMS.c_str()); return cValid; } return false; }
const std::string& LoginStatus::GetLoggedIn() const { assert(IsLoggedIn()); return mLoggedIn; }
bool CWebSession::IsAdmin() const { return IsLoggedIn() && m_pUser->IsAdmin(); }
//=============================================================================* string BAR_CSCOnlineProxy::ReadControlVersion() //=============================================================================* { BAR_TRACE(4, "read control version"); if ( ! IsLoggedIn() ) { Throw_FatalError(L"can not read control version before logged in"); } //=== instantiate opc server // BAR_TypeLib* pTlb = NULL; // IOPCServer* pIOPCServer = (IOPCServer*)CreateInstance("opc server", // IID_IOPCServer, // CLSID_OPCServer, // m_sRemoteHost, // "OPCDA", // LIBID_OPCDA, // "2", // pTlb); //=== instantiate opc server IOPCServer* pIOPCServer = (IOPCServer*) CreateInstance("opc server", IID_IOPCServer, CLSID_OPCServer, m_sRemoteHost, false, "CSC_Onl_Srv", /*LIBID_OPCDA*/LIBID_CSC_Srv_Lib, "1", m_pTlbCSCOnlSrv); //=== get status item OPCSERVERSTATUS *pStatus = NULL; HRESULT hr = pIOPCServer->GetStatus(&pStatus); if ( FAILED(hr) ) { Throw_ReadControlVersionFailed(hr); } if ( pStatus == NULL ) { Throw_FatalError(L"opc server status is null"); } WORD wMajorVersion = pStatus->wMajorVersion; WORD wMinorVersion = pStatus->wMinorVersion; ::CoTaskMemFree(pStatus); //=== build version string ostringstream ossControlVersion; ossControlVersion << (int)wMajorVersion << "." << (int)wMinorVersion; string sControlVersion = ossControlVersion.str(); //=== release opc server if ( pIOPCServer != NULL ) { pIOPCServer->Release(); } /* //=== unregister type library if ( pTlb != NULL ) { delete pTlb; } */ //=== finished BAR_TRACE1(1, "control version=%s", sControlVersion.c_str()); return sControlVersion.c_str(); }
/* ** m_part ** parv[0] = sender prefix ** parv[1] = channel ** parv[2] = comment (added by Lefler) */ DLLFUNC CMD_FUNC(m_part) { aChannel *chptr; Membership *lp; char *p = NULL, *name; char *commentx = (parc > 2 && parv[2]) ? parv[2] : NULL; char *comment; int n; if (parc < 2 || parv[1][0] == '\0') { sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "PART"); return 0; } if (MyClient(sptr)) { if (IsShunned(sptr)) commentx = NULL; if (STATIC_PART) { if (!strcasecmp(STATIC_PART, "yes") || !strcmp(STATIC_PART, "1")) commentx = NULL; else if (!strcasecmp(STATIC_PART, "no") || !strcmp(STATIC_PART, "0")) ; /* keep original reason */ else commentx = STATIC_PART; } if (commentx) { n = dospamfilter(sptr, commentx, SPAMF_PART, parv[1], 0, NULL); if (n == FLUSH_BUFFER) return n; if (n < 0) commentx = NULL; } } for (; (name = strtoken(&p, parv[1], ",")); parv[1] = NULL) { chptr = get_channel(sptr, name, 0); if (!chptr) { sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL), me.name, parv[0], name); continue; } if (check_channelmask(sptr, cptr, name)) continue; /* 'commentx' is the general part msg, but it can be changed * per-channel (eg some chans block badwords, strip colors, etc) * so we copy it to 'comment' and use that in this for loop :) */ comment = commentx; if (!(lp = find_membership_link(sptr->user->channel, chptr))) { /* Normal to get get when our client did a kick ** for a remote client (who sends back a PART), ** so check for remote client or not --Run */ if (MyClient(sptr)) sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0], name); continue; } if (!IsAnOper(sptr) && !is_chanownprotop(sptr, chptr)) { #ifdef STRIPBADWORDS int blocked = 0; #endif /* Banned? No comment allowed ;) */ if (comment && is_banned(sptr, chptr, BANCHK_MSG)) comment = NULL; /* And other things... */ if ((chptr->mode.mode & MODE_NOCOLOR) && comment) { if (strchr((char *)comment, 3) || strchr((char *)comment, 27)) { comment = NULL; } } if ((chptr->mode.mode & MODE_MODERATED) && comment && !has_voice(sptr, chptr) && !is_halfop(sptr, chptr)) { comment = NULL; } if ((chptr->mode.mode & MODE_STRIP) && comment) { comment = (char *)StripColors(comment); } #ifdef STRIPBADWORDS #ifdef STRIPBADWORDS_CHAN_ALWAYS if (comment) { comment = (char *)stripbadwords_channel(comment, &blocked); } #else if ((chptr->mode.extmode & EXTMODE_STRIPBADWORDS) && comment) { comment = (char *)stripbadwords_channel(comment, &blocked); } #endif #endif } /* +M and not logged in to services? */ if ((chptr->mode.mode & MODE_MODREG) && !IsLoggedIn(sptr) && !IsAnOper(sptr)) comment = NULL; if (MyConnect(sptr)) { Hook *tmphook; for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_PART]; tmphook; tmphook = tmphook->next) { comment = (*(tmphook->func.pcharfunc))(sptr, chptr, comment); if (!comment) break; } } /* Send to other servers... */ if (!comment) sendto_serv_butone_token(cptr, parv[0], MSG_PART, TOK_PART, "%s", chptr->chname); else sendto_serv_butone_token(cptr, parv[0], MSG_PART, TOK_PART, "%s :%s", chptr->chname, comment); if (1) { if ((chptr->mode.mode & MODE_AUDITORIUM) && !is_chanownprotop(sptr, chptr)) { if (!comment) { sendto_chanops_butone(NULL, chptr, ":%s!%s@%s PART %s", sptr->name, sptr->user->username, GetHost(sptr), chptr->chname); if (!is_chan_op(sptr, chptr) && MyClient(sptr)) sendto_one(sptr, ":%s!%s@%s PART %s", sptr->name, sptr->user->username, GetHost(sptr), chptr->chname); } else { sendto_chanops_butone(NULL, chptr, ":%s!%s@%s PART %s %s", sptr->name, sptr->user->username, GetHost(sptr), chptr->chname, comment); if (!is_chan_op(cptr, chptr) && MyClient(sptr)) sendto_one(sptr, ":%s!%s@%s PART %s %s", sptr->name, sptr->user->username, GetHost(sptr), chptr->chname, comment); } } else { if (!comment) sendto_channel_butserv(chptr, sptr, PARTFMT, parv[0], chptr->chname); else sendto_channel_butserv(chptr, sptr, PARTFMT2, parv[0], chptr->chname, comment); } if (MyClient(sptr)) RunHook4(HOOKTYPE_LOCAL_PART, cptr, sptr, chptr, comment); else RunHook4(HOOKTYPE_REMOTE_PART, cptr, sptr, chptr, comment); remove_user_from_channel(sptr, chptr); } } return 0; }
//-------------------------------------------------------- // init the session //-------------------------------------------------------- bool TLSpotify::TSession::Initialise(TRef& ErrorRef) { // init session if ( !m_pSession ) { sp_session_config config; config.api_version = SPOTIFY_API_VERSION; // The path of the directory to store the cache. This must be specified. // Please read the documentation on preferred values. config.cache_location = "tmp"; // The path of the directory to store the settings. This must be specified. // Please read the documentation on preferred values. config.settings_location = "tmp"; // The key of the application. They are generated by Spotify, // and are specific to each application using libspotify. config.application_key = m_Key.GetData(); config.application_key_size = m_Key.GetSize(); // This identifies the application using some // free-text string [1, 255] characters. TFixedArray<char,255> AgentString; m_AgentName.GetAnsi( AgentString ); config.user_agent = AgentString.GetData(); // Register the callbacks. config.callbacks = &g_Callbacks; // https://developer.spotify.com/en/libspotify/docs/group__session.html // In the future, this will be renamed to sp_session_create() and will have a corresponding sp_session_release() function. sp_error Error = sp_session_init( &config, &m_pSession ); if ( Error != SP_ERROR_OK ) { //sp_error_message(error)); ErrorRef = "Init"; Shutdown(); return false; } // where is the session? if ( !m_pSession ) { ErrorRef = "NoSession"; Shutdown(); return false; } } // log in session if ( !IsLoggedIn() ) { TFixedArray<char,255> UserNameString; m_UserName.GetAnsi( UserNameString ); TFixedArray<char,255> PasswordString; m_Password.GetAnsi( PasswordString ); // attempt login sp_error Error = sp_session_login( m_pSession, UserNameString.GetData(), PasswordString.GetData() ); if ( Error != SP_ERROR_OK ) { ErrorRef = "Login"; Shutdown(); return false; } // logged in! fetch the user m_pUser = sp_session_user( m_pSession ); if ( !m_pUser ) { ErrorRef = "NoUser"; // set pointer to something so we attempt to logout, even though it's not valid m_pUser = (sp_user*)0xdeadf00d; Shutdown(); return false; } } return true; }
DLLFUNC int _can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[]) { Link *lp; Ban *banned; if ((chptr->mode.mode & MODE_ONLYSECURE) && !(sptr->umodes & UMODE_SECURE)) { if (IsAnOper(sptr)) { /* Yeah yeah.. duplicate code.. * Anyway: if the channel is +z we still allow an ircop to bypass it * if they are invited. */ for (lp = sptr->user->invited; lp; lp = lp->next) if (lp->value.chptr == chptr) return 0; } return (ERR_SECUREONLYCHAN); } if ((chptr->mode.mode & MODE_OPERONLY) && !IsAnOper(sptr)) return (ERR_OPERONLY); if ((chptr->mode.mode & MODE_ADMONLY) && !IsSkoAdmin(sptr)) return (ERR_ADMONLY); /* Admin, Coadmin, Netadmin, and SAdmin can still walk +b in +O */ banned = is_banned(sptr, chptr, BANCHK_JOIN); if (banned && (chptr->mode.mode & MODE_OPERONLY) && IsAnOper(sptr) && !IsSkoAdmin(sptr) && !IsCoAdmin(sptr)) return (ERR_BANNEDFROMCHAN); /* Only NetAdmin/SAdmin can walk +b in +A */ if (banned && (chptr->mode.mode & MODE_ADMONLY) && IsAnOper(sptr) && !IsNetAdmin(sptr) && !IsSAdmin(sptr)) return (ERR_BANNEDFROMCHAN); for (lp = sptr->user->invited; lp; lp = lp->next) if (lp->value.chptr == chptr) return 0; if ((chptr->mode.limit && chptr->users >= chptr->mode.limit)) { if (chptr->mode.link) { if (*chptr->mode.link != '\0') { /* We are linked. */ sendto_one(sptr, err_str(ERR_LINKCHANNEL), me.name, sptr->name, chptr->chname, chptr->mode.link); parv[0] = sptr->name; parv[1] = (chptr->mode.link); do_join(cptr, sptr, 2, parv); return -1; } } /* We check this later return (ERR_CHANNELISFULL); */ } if ((chptr->mode.mode & MODE_RGSTRONLY) && !IsLoggedIn(sptr)) return (ERR_NEEDREGGEDNICK); if (*chptr->mode.key && (BadPtr(key) || strcmp(chptr->mode.key, key))) return (ERR_BADCHANNELKEY); if ((chptr->mode.mode & MODE_INVITEONLY) && !find_invex(chptr, sptr)) return (ERR_INVITEONLYCHAN); if ((chptr->mode.limit && chptr->users >= chptr->mode.limit)) return (ERR_CHANNELISFULL); if (banned) return (ERR_BANNEDFROMCHAN); #ifndef NO_OPEROVERRIDE #ifdef OPEROVERRIDE_VERIFY if (IsOper(sptr) && (chptr->mode.mode & MODE_SECRET || chptr->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(chptr->chname)) return (ERR_OPERSPVERIFY); #endif #endif #ifdef JOINTHROTTLE if (!IsAnOper(cptr) && (chptr->mode.extmode & EXTMODE_JOINTHROTTLE) && isjthrottled(cptr, chptr)) return ERR_TOOMANYJOINS; #endif return 0; }
QWidget* SpotifyService::HeaderWidget() const { if (IsLoggedIn()) return search_box_; return nullptr; }