Server now supports replies without prefix

This commit is contained in:
Giuseppe Bilotta 2011-08-13 17:37:31 +02:00
parent d2c0b4905a
commit da19aee307
2 changed files with 9 additions and 4 deletions

@ -3247,13 +3247,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
// Parse commands
if(message[0] == L'/')
{
line += L"Server: ";
size_t strip_size = 1;
if (message[1] == L'#') // support old-style commans
++strip_size;
message = message.substr(strip_size);
WStrfnd f1(message);
f1.next(L" "); // Skip over /#whatever
std::wstring paramstring = f1.next(L"");
@ -3266,9 +3264,15 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
player,
privs);
line += processServerCommand(ctx);
std::wstring reply(processServerCommand(ctx));
send_to_sender = ctx->flags & SEND_TO_SENDER;
send_to_others = ctx->flags & SEND_TO_OTHERS;
if (ctx->flags & SEND_NO_PREFIX)
line += reply;
else
line += L"Server: " + reply;
delete ctx;
}

@ -27,6 +27,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define SEND_TO_SENDER (1<<0)
#define SEND_TO_OTHERS (1<<1)
#define SEND_NO_PREFIX (1<<2)
struct ServerCommandContext
{