Server now supports replies without prefix
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 13 Aug 2011 15:37:31 +0000 (17:37 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 22 Aug 2011 11:02:08 +0000 (13:02 +0200)
src/server.cpp
src/servercommand.h

index fabfbc84e31c42d11b1829da1d68fc032e27d1e3..f665920477e89790ed79a55ec713942b87630871 100644 (file)
@@ -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;
 
                }
index 15679f333b7ab418bc6dda79285dab19dcda8917..648a57332716ebbbf5f05e42eb830ad2a271aa9d 100644 (file)
@@ -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
 {