[9466] Implemented SOAP in MaNGOS

- removed deprecated code from RASocket
- allow more than one login at a time on the RA console
- added gsoap library for handling SOAP requests
- removed deprecated mangos_string entry

Thanks to:
- Derex for reporting a bug which occured if more than 1024
    players were connected  [poll() vs select()]
- caeruleaus for adding windowsbuild support
- vladimir for suggesting a different thread starting order
- fdb_ for suggesting SOAP in the first place
This commit is contained in:
arrai 2010-02-26 20:15:46 +01:00
parent 844f032458
commit e520d8409e
33 changed files with 20337 additions and 96 deletions

View file

@ -873,6 +873,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co
SendSysMessage(LANG_CMD_SYNTAX);
ShowHelpForCommand(table[i].ChildCommands,text);
SetSentErrorMessage(true);
}
return true;
@ -900,12 +901,13 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co
}
}
// some commands have custom error messages. Don't send the default one in these cases.
else if(!sentErrorMessage)
else if(!HasSentErrorMessage())
{
if(!table[i].Help.empty())
SendSysMessage(table[i].Help.c_str());
else
SendSysMessage(LANG_CMD_SYNTAX);
SetSentErrorMessage(true);
}
return true;
@ -999,7 +1001,10 @@ int ChatHandler::ParseCommands(const char* text)
std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing.
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
{
SendSysMessage(LANG_NO_CMD);
SetSentErrorMessage(true);
}
return 1;
}
@ -2256,8 +2261,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

View file

@ -71,6 +71,7 @@ class ChatHandler
int ParseCommands(const char* text);
bool isValidChatMessage(const char* msg);
bool HasSentErrorMessage() { return sentErrorMessage;}
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
@ -552,8 +553,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 *GetMangosString(int32 entry) const;
@ -565,6 +566,7 @@ class CliHandler : public ChatHandler
int GetSessionDbLocaleIndex() const;
private:
void* m_callbackArg;
Print* m_print;
};

View file

@ -83,7 +83,7 @@ enum MangosStrings
LANG_USING_WORLD_DB = 57,
LANG_USING_SCRIPT_LIB = 58,
LANG_USING_EVENT_AI = 59,
LANG_RA_BUSY = 60,
//LANG_RA_BUSY = 60, not used
LANG_RA_USER = 61,
LANG_RA_PASS = 62,
// Room for more level 0 63-99 not used

View file

@ -1823,19 +1823,21 @@ 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("mangos>");
}
void World::InitResultQueue()

View file

@ -372,13 +372,16 @@ enum RealmZone
/// 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;
CommandFinished* m_commandFinished;
CliCommandHolder(const char *command, Print* zprint)
: m_print(zprint)
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];
@ -528,7 +531,7 @@ class World
static float GetVisibleObjectGreyDistance() { return m_VisibleObjectGreyDistance; }
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();