/me command
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 13 Aug 2011 15:41:18 +0000 (17:41 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 22 Aug 2011 11:02:08 +0000 (13:02 +0200)
src/servercommand.cpp

index 31f18c53c3c603217fa19feecff44a9b2c06089c..89ba0771fe93f8ed91be720ab408b1398c9da34d 100644 (file)
@@ -25,6 +25,14 @@ void cmd_status(std::wostringstream &os,
        os<<ctx->server->getStatusString();
 }
 
+void cmd_me(std::wostringstream &os,
+       ServerCommandContext *ctx)
+{
+       std::wstring name = narrow_to_wide(ctx->player->getName());
+       os << L"* " << name << L" " << ctx->paramstring;
+       ctx->flags |= SEND_TO_OTHERS | SEND_NO_PREFIX;
+}
+
 void cmd_privs(std::wostringstream &os,
        ServerCommandContext *ctx)
 {
@@ -283,6 +291,10 @@ std::wstring processServerCommand(ServerCommandContext *ctx)
        {
                cmd_banunban(os, ctx);
        }
+       else if(ctx->parms[0] == L"me")
+       {
+               cmd_me(os, ctx);
+       }
        else
        {
                os<<L"-!- Invalid command: " + ctx->parms[0];