Remove distinction between /# and / commands
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 13 Aug 2011 15:09:23 +0000 (17:09 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 22 Aug 2011 11:02:08 +0000 (13:02 +0200)
No need to make the server command syntax more complicated than
necessary. If the need ever arise, we'll find some other way to
distinguish the client commands. Also, the /# syntax is deprecated and
will be made obsolete in time.

src/game.cpp
src/server.cpp

index ab3852137bd5bb5786bc8bc1f633ce195d2a9b76..22fab706c53246420bad6bf764c7734a1cfe6950 100644 (file)
@@ -114,18 +114,6 @@ struct TextDestChat : public TextDest
                // Discard empty line
                if(text == L"")
                        return;
-               
-               // Parse command (server command starts with "/#")
-               if(text[0] == L'/' && text[1] != L'#')
-               {
-                       std::wstring reply = L"Local: ";
-
-                       reply += L"Local commands not yet supported. "
-                                       L"Server prefix is \"/#\".";
-                       
-                       m_client->addChatMessage(reply);
-                       return;
-               }
 
                // Send to others
                m_client->sendChatMessage(text);
index 5b657bc2efe8c51853798ad840c5fca7ccdd9895..1f33a66f526eeb475a229ed45c75cf21a1a585d2 100644 (file)
@@ -3245,12 +3245,14 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                u64 privs = getPlayerPrivs(player);
 
                // Parse commands
-               std::wstring commandprefix = L"/#";
-               if(message.substr(0, commandprefix.size()) == commandprefix)
+               if(message[0] == L'/')
                {
                        line += L"Server: ";
 
-                       message = message.substr(commandprefix.size());
+                       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