Add infos into target window
[ryzomcore.git] / ryzom / server / src / server_share / command_executor.cpp
blob9787bbaf4d957341bf3d4287a10c543b9e5b3417
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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/>.
19 #include "stdpch.h"
21 #include "nel/net/module.h"
22 #include "nel/net/module_builder_parts.h"
24 #include "command_executor_itf.h"
27 using namespace std;
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
41 public:
43 CCommandExecutor()
45 CCommandExecutorSkel::init(this);
48 // bool onProcessModuleMessage(IModuleProxy *sender, const CMessage &message)
49 // {
50 // if (CCommandExecutorSkel::onDispatchMessage(sender, message))
51 // return true;
53 // nlwarning("CCommandExecutor : Unknown message '%s' received", message.getName().c_str());
55 // return false;
56 // }
58 std::string buildModuleManifest() const
60 string ret("ServiceName=");
61 ret += IService::getInstance()->getServiceShortName();
63 return ret;
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();
75 if (haveTarget)
77 cmdLine += " "+targetEId.toString();
80 cmdLine += " " + arg;
81 // execute the command
82 NLMISC::CCommandRegistry::getInstance().execute(cmdLine, InfoLog());
87 NLNET_REGISTER_MODULE_FACTORY(CCommandExecutor, "CommandExecutor");