+void cmd_setclearpassword(std::wostringstream &os,
+ ServerCommandContext *ctx)
+{
+ if((ctx->privs & PRIV_PASSWORD) == 0)
+ {
+ os<<L"-!- You don't have permission to do that";
+ return;
+ }
+
+ std::string playername;
+ std::wstring password;
+
+ if(ctx->parms[0] == L"setpassword")
+ {
+ if(ctx->parms.size() != 3)
+ {
+ os<<L"-!- Missing parameter";
+ return;
+ }
+
+ playername = wide_to_narrow(ctx->parms[1]);
+ password = ctx->parms[2];
+
+ actionstream<<ctx->player->getName()<<" sets password of "
+ <<playername<<std::endl;
+ }
+ else
+ {
+ // clearpassword
+
+ if(ctx->parms.size() != 2)
+ {
+ os<<L"-!- Missing parameter";
+ return;
+ }
+
+ playername = wide_to_narrow(ctx->parms[1]);
+ password = L"";
+
+ actionstream<<ctx->player->getName()<<" clears password of"
+ <<playername<<std::endl;
+ }
+
+ ctx->server->setPlayerPassword(playername, password);
+
+ std::wostringstream msg;
+ msg<<ctx->player->getName()<<L" changed your password";
+ ctx->server->notifyPlayer(playername.c_str(), msg.str());
+
+ os<<L"-!- Password change for "<<narrow_to_wide(playername)<<" successful";
+}
+
+void cmd_clearobjects(std::wostringstream &os,
+ ServerCommandContext *ctx)
+{
+ if((ctx->privs & PRIV_SERVER) ==0)
+ {
+ os<<L"-!- You don't have permission to do that";
+ return;
+ }
+
+ actionstream<<ctx->player->getName()
+ <<" clears all objects"<<std::endl;
+
+ {
+ std::wstring msg;
+ msg += L"Clearing all objects. This may take long.";
+ msg += L" You may experience a timeout. (by ";
+ msg += narrow_to_wide(ctx->player->getName());
+ msg += L")";
+ ctx->server->notifyPlayers(msg);
+ }
+
+ ctx->env->clearAllObjects();
+
+ actionstream<<"object clearing done"<<std::endl;
+
+ os<<L"*** cleared all objects";
+ ctx->flags |= SEND_TO_OTHERS;
+}
+