本文整理汇总了C++中CUser::GetUsername方法的典型用法代码示例。如果您正苦于以下问题:C++ CUser::GetUsername方法的具体用法?C++ CUser::GetUsername怎么用?C++ CUser::GetUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetUsername方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterceptClientMessage
bool InterceptClientMessage(CClientConnection* Client, int argc, const char** argv) {
g_Ret = true;
CUser* User = Client->GetOwner();
CallBinds(Type_PreScript, NULL, NULL, 0, NULL);
g_CurrentClient = Client;
CallBinds(Type_Client, User ? User->GetUsername() : "", Client, argc, argv);
CallBinds(Type_PostScript, NULL, NULL, 0, NULL);
return g_Ret;
}
示例2: HandleCallbackClientApprove
void CServerContext::HandleCallbackClientApprove( GSClientApprove_t *pClientApprove )
{
std::cout << "[SERVER] Back-end approved " << pClientApprove->m_SteamID << std::endl;
SteamUserMap::iterator iter = clientSteamMap.find( pClientApprove->m_SteamID );
if( iter != clientSteamMap.end() )
{
CUser *user = iter->second;
std::cout << "[SERVER] User " << *user << " was authed, updating user data." << std::endl;
gameserver->UpdateUserData(user->GetSteamID(), user->GetUsername().c_str(), 0);
gameserveritems->LoadItems(user->GetSteamID());
}
}
示例3: Block
bool Block(const CString& sUser) {
CUser* pUser = CZNC::Get().FindUser(sUser);
if (!pUser) return false;
// Disconnect all clients
vector<CClient*> vpClients = pUser->GetAllClients();
vector<CClient*>::iterator it;
for (it = vpClients.begin(); it != vpClients.end(); ++it) {
(*it)->PutStatusNotice(MESSAGE);
(*it)->Close(Csock::CLT_AFTERWRITE);
}
// Disconnect all networks from irc
vector<CIRCNetwork*> vNetworks = pUser->GetNetworks();
for (vector<CIRCNetwork*>::iterator it2 = vNetworks.begin();
it2 != vNetworks.end(); ++it2) {
(*it2)->SetIRCConnectEnabled(false);
}
SetNV(pUser->GetUsername(), "");
return true;
}
示例4: Build
//.........这里部分代码省略.........
bSubmission = true;
}
}
}
if ((pViewer != NULL) && pViewer->GetIsBannedFromPosting())
{
bUpdateWasValid = false;
sUpdateError = "Not allowed";
sUpdateType = "restricteduser";
}
if ( bUpdateWasValid && bSubmission && bUpdateWasValid )
{
bUpdateWasValid = UpdateUserDetails(pViewer, sUpdateError, sUpdateType);
}
bSuccess = bSuccess && InitPage(pWholePage, "USERDETAILS",true);
// now add the XML for the FORM and its contents
int iUserID = pViewer->GetUserID();
CTDVString sUsername;
// CTDVString sFirstNames;
// CTDVString sLastName;
CTDVString sEmail;
CTDVString sPrefSkin;
int iPrefUserMode;
int iPrefForumStyle;
CTDVString sPrefXML;
CTDVString sSiteSuffix;
CTDVString sRegion;
// get the users settings, which may have just been updated...
bSuccess = bSuccess && pViewer->GetUsername(sUsername);
// bSuccess = bSuccess && pViewer->GetFirstNames(sFirstNames);
// bSuccess = bSuccess && pViewer->GetLastName(sLastName);
bSuccess = bSuccess && pViewer->GetEmail(sEmail);
bSuccess = bSuccess && pViewer->GetPrefSkin(&sPrefSkin);
bSuccess = bSuccess && pViewer->GetPrefUserMode(&iPrefUserMode);
bSuccess = bSuccess && pViewer->GetPrefForumStyle(&iPrefForumStyle);
bSuccess = bSuccess && pViewer->GetPrefXML(&sPrefXML);
bSuccess = bSuccess && pViewer->GetSiteSuffix(sSiteSuffix);
bSuccess = bSuccess && pViewer->GetRegion(sRegion);
// construct the XML for the FORM and then insert it inside the body of the page
if (bSuccess)
{
// TODO: is this the only XML we need to output?
CTDVString sMessage;
CTDVString sMessageType = "";
if (sUpdateError.IsEmpty() && bSubmission)
{
sMessage = "Your details have been updated";
sMessageType="detailsupdated";
}
else
{
sMessage = sUpdateError;
sMessageType = sUpdateType;
}
// escape all XML sequences in the name fields before showing them in the form
CXMLObject::EscapeAllXML(&sUsername);
// CXMLObject::EscapeAllXML(&sFirstNames);
示例5: InterceptClientCommand
bool InterceptClientCommand(CClientConnection* Client, const char* Subcommand, int argc, const char** argv, bool NoticeUser) {
CUser* User = Client->GetOwner();
g_NoticeUser = NoticeUser;
g_CurrentClient = Client;
g_Ret = true;
CallBinds(Type_Command, Client->GetOwner()->GetUsername(), Client, argc, argv);
if (g_Ret && strcasecmp(Subcommand, "help") == 0 && User && User->IsAdmin()) {
commandlist_t *Commands = Client->GetCommandList();
AddCommand(Commands, "tcl", "Admin", "executes tcl commands", "Syntax: "
"tcl command\nExecutes the specified tcl command.");
g_Ret = false;
}
if (g_Ret && strcasecmp(Subcommand, "tcl") == 0 && User && User->IsAdmin()) {
if (argc <= 1) {
if (NoticeUser)
Client->RealNotice("Syntax: tcl :command");
else
Client->Privmsg("Syntax: tcl :command");
return true;
}
setctx(User->GetUsername());
Tcl_DString dsScript;
const char **argvdup;
argvdup = ArgDupArray(argv);
ArgRejoinArray(argvdup, 1);
g_CurrentClient = Client;
int Code = Tcl_EvalEx(g_Interp, Tcl_UtfToExternalDString(g_Encoding, argvdup[1], -1, &dsScript),
-1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT);
ArgFreeArray(argvdup);
Tcl_DStringFree(&dsScript);
Tcl_Obj* Result = Tcl_GetObjResult(g_Interp);
const char* strResult = Tcl_GetString(Result);
if (Code == TCL_ERROR) {
if (NoticeUser)
Client->RealNotice("An error occured in the tcl script:");
else
Client->Privmsg("An error occured in the tcl script:");
}
if (strResult && *strResult) {
Tcl_DString dsResult;
char* Dup = strdup(Tcl_UtfToExternalDString(g_Encoding, strResult, -1, &dsResult));
Tcl_DStringFree(&dsResult);
char* token = strtok(Dup, "\n");
while (token != NULL) {
if (NoticeUser)
Client->RealNotice(*token ? token : "empty string.");
else
Client->Privmsg(*token ? token : "empty string.");
token = strtok(NULL, "\n");
}
free(Dup);
} else {
if (NoticeUser)
Client->RealNotice("<no error>");
else
Client->Privmsg("<no error>");
}
g_Ret = false;
}
return !g_Ret;
}