1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "nel/net/module.h"
22 #include "nel/net/module_builder_parts.h"
24 #include "command_executor_itf.h"
28 using namespace NLMISC
;
29 using namespace NLNET
;
30 using namespace CMDEXE
;
33 void commandExecutor_forcelink()
38 class CCommandExecutor
: public CEmptyModuleServiceBehav
<CEmptyModuleCommBehav
<CEmptySocketBehav
<CModuleBase
> > >,
39 public CCommandExecutorSkel
45 CCommandExecutorSkel::init(this);
48 // bool onProcessModuleMessage(IModuleProxy *sender, const CMessage &message)
50 // if (CCommandExecutorSkel::onDispatchMessage(sender, message))
53 // nlwarning("CCommandExecutor : Unknown message '%s' received", message.getName().c_str());
58 std::string
buildModuleManifest() const
60 string
ret("ServiceName=");
61 ret
+= IService::getInstance()->getServiceShortName();
67 ///////////////////////////////////////////////////////////////////////////////
68 ///////// CCommandExecutorSkel implementation ////////////////////////////////
69 ///////////////////////////////////////////////////////////////////////////////
71 void sendCommand(NLNET::IModuleProxy
*sender
, const std::string
&commandName
, const NLMISC::CEntityId
&senderEId
, bool haveTarget
, const NLMISC::CEntityId
&targetEId
, const std::string
&arg
)
73 // rebuild the command line
74 string cmdLine
= commandName
+" "+senderEId
.toString();
77 cmdLine
+= " "+targetEId
.toString();
81 // execute the command
82 NLMISC::CCommandRegistry::getInstance().execute(cmdLine
, InfoLog());
87 NLNET_REGISTER_MODULE_FACTORY(CCommandExecutor
, "CommandExecutor");