Add SOAP-implementation (based on Benjys patch and adapted for latest core by xk1)
--HG-- branch : trunk
This commit is contained in:
@@ -2402,8 +2402,8 @@ bool CliHandler::isAvailable(ChatCommand const& cmd) const
|
||||
|
||||
void CliHandler::SendSysMessage(const char *str)
|
||||
{
|
||||
m_print(str);
|
||||
m_print("\r\n");
|
||||
m_print(m_callbackArg, str);
|
||||
m_print(m_callbackArg, "\r\n");
|
||||
}
|
||||
|
||||
std::string CliHandler::GetNameLink() const
|
||||
|
||||
@@ -76,6 +76,7 @@ class ChatHandler
|
||||
static ChatCommand* getCommandTable();
|
||||
|
||||
bool isValidChatMessage(const char* msg);
|
||||
bool HasSentErrorMessage() { return sentErrorMessage;}
|
||||
void SendGlobalSysMessage(const char *str);
|
||||
protected:
|
||||
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
|
||||
@@ -652,8 +653,8 @@ class ChatHandler
|
||||
class CliHandler : public ChatHandler
|
||||
{
|
||||
public:
|
||||
typedef void Print(char const*);
|
||||
explicit CliHandler(Print* zprint) : m_print(zprint) {}
|
||||
typedef void Print(void*, char const*);
|
||||
explicit CliHandler(void* callbackArg, Print* zprint) : m_callbackArg(callbackArg), m_print(zprint) {}
|
||||
|
||||
// overwrite functions
|
||||
const char *GetTrinityString(int32 entry) const;
|
||||
@@ -665,6 +666,7 @@ class CliHandler : public ChatHandler
|
||||
int GetSessionDbLocaleIndex() const;
|
||||
|
||||
private:
|
||||
void* m_callbackArg;
|
||||
Print* m_print;
|
||||
};
|
||||
|
||||
|
||||
@@ -2445,19 +2445,19 @@ void World::UpdateSessions(uint32 diff)
|
||||
void World::ProcessCliCommands()
|
||||
{
|
||||
CliCommandHolder::Print* zprint = NULL;
|
||||
|
||||
void* callbackArg = NULL;
|
||||
CliCommandHolder* command;
|
||||
while (cliCmdQueue.next(command))
|
||||
{
|
||||
sLog.outDebug("CLI command under processing...");
|
||||
zprint = command->m_print;
|
||||
CliHandler(zprint).ParseCommands(command->m_command);
|
||||
callbackArg = command->m_callbackArg;
|
||||
CliHandler handler(callbackArg, zprint);
|
||||
handler.ParseCommands(command->m_command);
|
||||
if(command->m_commandFinished)
|
||||
command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
|
||||
delete command;
|
||||
}
|
||||
|
||||
// print the console message here so it looks right
|
||||
if (zprint)
|
||||
zprint("TC> ");
|
||||
}
|
||||
|
||||
void World::SendRNDBroadcast()
|
||||
|
||||
@@ -464,19 +464,23 @@ enum WorldStates
|
||||
/// Storage class for commands issued for delayed execution
|
||||
struct CliCommandHolder
|
||||
{
|
||||
typedef void Print(const char*);
|
||||
|
||||
typedef void Print(void*, const char*);
|
||||
typedef void CommandFinished(void*, bool success);
|
||||
|
||||
void* m_callbackArg;
|
||||
char *m_command;
|
||||
Print* m_print;
|
||||
|
||||
CliCommandHolder(const char *command, Print* zprint)
|
||||
: m_print(zprint)
|
||||
CommandFinished* m_commandFinished;
|
||||
|
||||
CliCommandHolder(void* callbackArg, const char *command, Print* zprint, CommandFinished* commandFinished)
|
||||
: m_callbackArg(callbackArg), m_print(zprint), m_commandFinished(commandFinished)
|
||||
{
|
||||
size_t len = strlen(command)+1;
|
||||
m_command = new char[len];
|
||||
memcpy(m_command, command, len);
|
||||
}
|
||||
|
||||
|
||||
~CliCommandHolder() { delete[] m_command; }
|
||||
};
|
||||
|
||||
@@ -657,7 +661,7 @@ class World
|
||||
static int32 GetVisibilityNotifyPeriodInBGArenas() { return m_visibility_notify_periodInBGArenas; }
|
||||
|
||||
void ProcessCliCommands();
|
||||
void QueueCliCommand(CliCommandHolder::Print* zprintf, char const* input) { cliCmdQueue.add(new CliCommandHolder(input, zprintf)); }
|
||||
void QueueCliCommand(CliCommandHolder* commandHolder) { cliCmdQueue.add(commandHolder); }
|
||||
|
||||
void UpdateResultQueue();
|
||||
void InitResultQueue();
|
||||
|
||||
Reference in New Issue
Block a user