本文整理汇总了C++中SOAPCommand::hasCommandSucceeded方法的典型用法代码示例。如果您正苦于以下问题:C++ SOAPCommand::hasCommandSucceeded方法的具体用法?C++ SOAPCommand::hasCommandSucceeded怎么用?C++ SOAPCommand::hasCommandSucceeded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SOAPCommand
的用法示例。
在下文中一共展示了SOAPCommand::hasCommandSucceeded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ns1__executeCommand
/*
Code used for generating stubs:
int ns1__executeCommand(char* command, char** result);
*/
int ns1__executeCommand(soap* soap, char* command, char** result)
{
// security check
if (!soap->userid || !soap->passwd)
{
DEBUG_LOG("MaNGOSsoap: Client didn't provide login information");
return 401;
}
uint32 accountId = sAccountMgr.GetId(soap->userid);
if (!accountId)
{
DEBUG_LOG("MaNGOSsoap: Client used invalid username '%s'", soap->userid);
return 401;
}
if (!sAccountMgr.CheckPassword(accountId, soap->passwd))
{
DEBUG_LOG("MaNGOSsoap: invalid password for account '%s'", soap->userid);
return 401;
}
if (sAccountMgr.GetSecurity(accountId) < SEC_ADMINISTRATOR)
{
DEBUG_LOG("MaNGOSsoap: %s's gmlevel is too low", soap->userid);
return 403;
}
if (!command || !*command)
return soap_sender_fault(soap, "Command mustn't be empty", "The supplied command was an empty string");
DEBUG_LOG("MaNGOSsoap: got command '%s'", command);
SOAPCommand connection;
// Commands are executed in the world thread. We have to wait for them to be completed
{
// CliCommandHolder will be deleted from world, accessing after queueing is NOT save
CliCommandHolder* cmd = new CliCommandHolder(accountId, SEC_CONSOLE, &connection, command, &SOAPCommand::print, &SOAPCommand::commandFinished);
sWorld.QueueCliCommand(cmd);
}
// Wait for callback to complete command
int acc = connection.pendingCommands.acquire();
if (acc)
sLog.outError("MaNGOSsoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
// Alright, command finished
char* printBuffer = soap_strdup(soap, connection.m_printBuffer.c_str());
if (connection.hasCommandSucceeded())
{
*result = printBuffer;
return SOAP_OK;
}
else
return soap_sender_fault(soap, printBuffer, printBuffer);
}
示例2: ns1__executeCommand
/*
Code used for generating stubs:
int ns1__executeCommand(char* command, char** result);
*/
int ns1__executeCommand(soap* soap, char* command, char** result)
{
// security check
if (!soap->userid || !soap->passwd)
{
TC_LOG_INFO("network.soap", "Client didn't provide login information");
return 401;
}
uint32 accountId = AccountMgr::GetId(soap->userid);
if (!accountId)
{
TC_LOG_INFO("network.soap", "Client used invalid username '%s'", soap->userid);
return 401;
}
if (!AccountMgr::CheckPassword(accountId, soap->passwd))
{
TC_LOG_INFO("network.soap", "Invalid password for account '%s'", soap->userid);
return 401;
}
if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR)
{
TC_LOG_INFO("network.soap", "%s's gmlevel is too low", soap->userid);
return 403;
}
if (!command || !*command)
return soap_sender_fault(soap, "Command can not be empty", "The supplied command was an empty string");
TC_LOG_INFO("network.soap", "Received command '%s'", command);
SOAPCommand connection;
// commands are executed in the world thread. We have to wait for them to be completed
{
// CliCommandHolder will be deleted from world, accessing after queueing is NOT save
CliCommandHolder* cmd = new CliCommandHolder(&connection, command, &SOAPCommand::print, &SOAPCommand::commandFinished);
sWorld->QueueCliCommand(cmd);
}
// wait for callback to complete command
int acc = connection.pendingCommands.acquire();
if (acc)
TC_LOG_ERROR("network.soap", "Error while acquiring lock, acc = %i, errno = %u", acc, errno);
// alright, command finished
char* printBuffer = soap_strdup(soap, connection.m_printBuffer.c_str());
if (connection.hasCommandSucceeded())
{
*result = printBuffer;
return SOAP_OK;
}
else
return soap_sender_fault(soap, printBuffer, printBuffer);
}