Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / backup_service / backup_service_mod.cpp
blobdca38632b9611006812bdd92c82cc6883997fec9
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/>.
17 #include "nel/misc/types_nl.h"
18 #include "nel/net/module.h"
19 #include "nel/net/module_builder_parts.h"
21 #include "../server_share/backup_service_itf.h"
23 #include "backup_service.h"
26 using namespace std;
27 using namespace NLMISC;
28 using namespace NLNET;
31 namespace BS
35 class CBackupServiceMod:
36 public CEmptyModuleServiceBehav<CEmptyModuleCommBehav<CEmptySocketBehav<CModuleBase> > >,
37 public CBackupServiceSkel
39 public:
41 CBackupServiceMod()
43 CBackupServiceSkel::init(this);
46 // static const std::string &getInitStringHelp()
47 // {
48 // static string help("ring_db(host=<mysql_hostname> user=<user> password=<password> base=<database_name>)");
49 // return help;
50 // }
52 // bool initModule(const TParsedCommandLine &initInfo)
53 // {
54 // return CModuleBase::initModule(initInfo);
56 // }
58 void onModuleDown(IModuleProxy *proxy)
60 // we must check that this module is not in the listener list
61 CBackupService::getInstance()->onModuleDown(proxy);
64 // bool onProcessModuleMessage(IModuleProxy *sender, const CMessage &message)
65 // {
66 // if (CBackupServiceSkel::onDispatchMessage(sender, message))
67 // return true;
69 // nlwarning("CBackupServiceMod: Unknown message '%s' received", message.getName().c_str());
71 // return false;
72 // }
75 /////////////////////////////////////////////////////////////
76 //// CBackupServiceSkel interface impl
77 /////////////////////////////////////////////////////////////
79 // A module ask to save a file in the backup repository
80 void saveFile(NLNET::IModuleProxy *sender, const std::string &fileName, const NLNET::TBinBuffer &data)
82 CWriteFile* access = new CWriteFile(fileName, TRequester(sender), 0, data.getBuffer(), data.getBufferSize());
84 access->FailureMode = CWriteFile::MajorFailureIfFileUnwritable | CWriteFile::MajorFailureIfFileUnbackupable;
85 access->BackupFile = true;
86 access->Append = false;
88 CBackupService::getInstance()->FileManager.stackFileAccess(access);
92 // A module ask to load a file
93 void loadFile(NLNET::IModuleProxy *sender, const std::string &fileName, uint32 requestId)
95 CLoadFile* access = new CLoadFile(fileName, TRequester(sender), requestId);
97 CBackupService::getInstance()->FileManager.stackFileAccess(access);
101 /////////////////////////////////////////////////////////////
102 //// commands
103 /////////////////////////////////////////////////////////////
105 NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CBackupServiceMod, CModuleBase)
106 NLMISC_COMMAND_HANDLER_ADD(CBackupServiceMod, dump, "dump the module internal state", "no param");
107 // NLMISC_COMMAND_HANDLER_ADD(CMailForumNotifierFwd, simMailNotify, "Simulate a mail notification", "<charId>");
108 NLMISC_COMMAND_HANDLER_TABLE_END
110 NLMISC_CLASS_COMMAND_DECL(dump)
112 // call the base class dump
113 NLMISC_CLASS_COMMAND_CALL_BASE(CModuleBase, dump);
115 return true;
119 NLNET_REGISTER_MODULE_FACTORY(CBackupServiceMod, "BackupServiceMod");
123 } // namespace RSMGR
125 // force module linking
126 void forceBackupServiceModLink()