本文整理汇总了C++中CIRCNetwork::GetUser方法的典型用法代码示例。如果您正苦于以下问题:C++ CIRCNetwork::GetUser方法的具体用法?C++ CIRCNetwork::GetUser怎么用?C++ CIRCNetwork::GetUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIRCNetwork
的用法示例。
在下文中一共展示了CIRCNetwork::GetUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveNetwork
void RemoveNetwork(CIRCNetwork& network) {
const CUser *user = network.GetUser();
const CString& sUsername = user->GetUserName();
std::map<CString, VCString>::iterator it = m_msvsNetworks.find(sUsername);
if (it != m_msvsNetworks.end()) {
VCString &networks = it->second;
for (VCString::iterator it2 = networks.begin(); it2 != networks.end(); ++it2) {
CString &name = *it2;
if (name.Equals(network.GetName())) {
networks.erase(it2);
break;
}
}
if (networks.empty()) {
m_msvsNetworks.erase(it);
}
}
}
示例2: HasNetwork
bool HasNetwork(CIRCNetwork& network) {
bool hasNetwork = false;
const CUser *user = network.GetUser();
const CString& sUsername = user->GetUserName();
std::map<CString, VCString>::iterator it = m_msvsNetworks.find(sUsername);
if (it != m_msvsNetworks.end()) {
VCString &networks = it->second;
for (VCString::iterator it2 = networks.begin(); it2 != networks.end(); ++it2) {
CString &name = *it2;
if (name.Equals(network.GetName())) {
hasNetwork = true;
break;
}
}
}
return hasNetwork;
}
示例3: OnWebRequest
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
if (sPageName == "settings") {
// Admin Check
if (!spSession->IsAdmin()) {
return false;
}
return SettingsPage(WebSock, Tmpl);
} else if (sPageName == "adduser") {
// Admin Check
if (!spSession->IsAdmin()) {
return false;
}
return UserPage(WebSock, Tmpl);
} else if (sPageName == "addnetwork") {
CUser* pUser = SafeGetUserFromParam(WebSock);
// Admin||Self Check
if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) {
return false;
}
if (pUser) {
return NetworkPage(WebSock, Tmpl, pUser);
}
WebSock.PrintErrorPage("No such username");
return true;
} else if (sPageName == "editnetwork") {
CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);
// Admin||Self Check
if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
return false;
}
if (!pNetwork) {
WebSock.PrintErrorPage("No such username or network");
return true;
}
return NetworkPage(WebSock, Tmpl, pNetwork->GetUser(), pNetwork);
} else if (sPageName == "delnetwork") {
CUser* pUser = CZNC::Get().FindUser(WebSock.GetParam("user", false));
// Admin||Self Check
if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pUser)) {
return false;
}
return DelNetwork(WebSock, pUser);
} else if (sPageName == "editchan") {
CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);
// Admin||Self Check
if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
return false;
}
if (!pNetwork) {
WebSock.PrintErrorPage("No such username or network");
return true;
}
CString sChan = WebSock.GetParam("name");
if(sChan.empty() && !WebSock.IsPost()) {
sChan = WebSock.GetParam("name", false);
}
CChan* pChan = pNetwork->FindChan(sChan);
if (!pChan) {
WebSock.PrintErrorPage("No such channel");
return true;
}
return ChanPage(WebSock, Tmpl, pNetwork, pChan);
} else if (sPageName == "addchan") {
CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);
// Admin||Self Check
if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
return false;
}
if (pNetwork) {
return ChanPage(WebSock, Tmpl, pNetwork);
}
WebSock.PrintErrorPage("No such username or network");
return true;
} else if (sPageName == "delchan") {
CIRCNetwork* pNetwork = SafeGetNetworkFromParam(WebSock);
// Admin||Self Check
if (!spSession->IsAdmin() && (!spSession->GetUser() || spSession->GetUser() != pNetwork->GetUser())) {
return false;
}
//.........这里部分代码省略.........
示例4: AddNetwork
void AddNetwork(CIRCNetwork& network) {
CUser *user = network.GetUser();
const CString& sUsername = user->GetUserName();
m_msvsNetworks[sUsername].push_back(network.GetName());
}
示例5: OnDeleteNetwork
virtual EModRet OnDeleteNetwork(CIRCNetwork& Network) {
DelNV("Enabled_" + Network.GetUser()->GetUserName() + "/" + Network.GetName());
return CONTINUE;
}