EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CorpRegistryService.cpp
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur, Allan
24 */
25 
26 #include "eve-server.h"
27 
28 #include "EVEServerConfig.h"
29 #include "PyBoundObject.h"
30 #include "PyServiceCD.h"
31 #include "cache/ObjCacheService.h"
34 
35 /*
36  * CORP__ERROR
37  * CORP__WARNING
38  * CORP__INFO
39  * CORP__MESSAGE
40  * CORP__TRACE
41  * CORP__CALL
42  * CORP__CALL_DUMP
43  * CORP__RSP_DUMP
44  * CORP__DB_ERROR
45  * CORP__DB_WARNING
46  * CORP__DB_INFO
47  * CORP__DB_MESSAGE
48  */
49 
50 
52 
54 : PyService(mgr, "corpRegistry"),
55  m_dispatch(new Dispatcher(this))
56 {
57  _SetCallDispatcher(m_dispatch);
58 
61  PyCallable_REG_CALL(CorpRegistryService, GetRecentKillsAndLosses);
62  PyCallable_REG_CALL(CorpRegistryService, GetCorporateContacts);
63  PyCallable_REG_CALL(CorpRegistryService, AddCorporateContact);
64  PyCallable_REG_CALL(CorpRegistryService, EditCorporateContact);
65  PyCallable_REG_CALL(CorpRegistryService, RemoveCorporateContacts);
66  PyCallable_REG_CALL(CorpRegistryService, EditContactsRelationshipID);
74 }
75 
77  delete m_dispatch;
78 }
79 
81 {
82  if (!bind_args->IsTuple()){
83  sLog.Error( "CorpRegistryService::CreateBoundObject", "%s: bind_args is not tuple: '%s'. ", pClient->GetName(), bind_args->TypeString() );
84  pClient->SendErrorMsg("Could not bind object for Corp Registry. Ref: ServerError 02808.");
85  return nullptr;
86  }
87 
88  return new CorpRegistryBound(m_manager, m_db, PyRep::IntegerValue(bind_args->AsTuple()->GetItem(0)));
89 }
90 
91 PyResult CorpRegistryService::Handle_GetCorporateContacts(PyCallArgs &call)
92 {
93  return m_db.GetContacts(call.client->GetCorporationID());
94 }
95 
106 PyResult CorpRegistryService::Handle_ResignFromCEO(PyCallArgs &call) {
107  // self.GetCorpRegistry().ResignFromCEO(newCeoID)
108  _log(CORP__CALL, "CorpRegistryService::Handle_ResignFromCEO()");
109  call.Dump(CORP__CALL_DUMP);
110 
111  return nullptr;
112 }
113 
114 PyResult CorpRegistryService::Handle_CreateAlliance(PyCallArgs &call) {
115  _log(CORP__CALL, "CorpRegistryService::Handle_CreateAlliance()");
116  call.Dump(CORP__CALL_DUMP);
117 
118  return nullptr;
119 }
120 
121 PyResult CorpRegistryService::Handle_GetRecentKillsAndLosses(PyCallArgs &call) {
122  _log(CORP__CALL, "CorpRegistryService::Handle_GetRecentKillsAndLosses()");
123  call.Dump(CORP__CALL_DUMP);
124 
125  return nullptr;
126 }
127 
128 
129 PyResult CorpRegistryService::Handle_AddCorporateContact(PyCallArgs &call) {
130  /* def AddCorporateContact(self, contactID, relationshipID):
131  * self.GetCorpRegistry().AddCorporateContact(contactID, relationshipID)
132  */
133  _log(CORP__CALL, "CorpRegistryService::Handle_AddCorporateContact()");
134  call.Dump(CORP__CALL_DUMP);
135 
136  return nullptr;
137 }
138 
139 PyResult CorpRegistryService::Handle_EditCorporateContact(PyCallArgs &call) {
140  /* def EditCorporateContact(self, contactID, relationshipID):
141  * self.GetCorpRegistry().EditCorporateContact(contactID, relationshipID)
142  */
143  _log(CORP__CALL, "CorpRegistryService::Handle_EditCorporateContact)");
144  call.Dump(CORP__CALL_DUMP);
145 
146  return nullptr;
147 }
148 
149 PyResult CorpRegistryService::Handle_RemoveCorporateContacts(PyCallArgs &call) {
150  /* def RemoveCorporateContacts(self, contactIDs):
151  * self.GetCorpRegistry().RemoveCorporateContacts(contactIDs)
152  */
153  _log(CORP__CALL, "CorpRegistryService::Handle_RemoveCorporateContacts()");
154  call.Dump(CORP__CALL_DUMP);
155 
156  return nullptr;
157 }
158 
159 PyResult CorpRegistryService::Handle_EditContactsRelationshipID(PyCallArgs &call) {
160  /* def EditContactsRelationshipID(self, contactIDs, relationshipID):
161  * self.GetCorpRegistry().EditContactsRelationshipID(contactIDs, relationshipID)
162  */
163  _log(CORP__CALL, "CorpRegistryService::Handle_EditContactsRelationshipID()");
164  call.Dump(CORP__CALL_DUMP);
165 
166  return nullptr;
167 }
168 
169 PyResult CorpRegistryService::Handle_GetLabels(PyCallArgs &call) {
170  _log(CORP__CALL, "CorpRegistryService::Handle_GetLabels()");
171  call.Dump(CORP__CALL_DUMP);
172 
173  return m_db.GetLabels(call.client->GetCorporationID());
174 }
175 
176 PyResult CorpRegistryService::Handle_CreateLabel(PyCallArgs &call) {
177  /* def CreateLabel(self, name, color = 0):
178  * return self.GetCorpRegistry().CreateLabel(name, color)
179  */
180  _log(CORP__CALL, "CorpRegistryService::Handle_CreateLabel()");
181  call.Dump(CORP__CALL_DUMP);
182 
183  return nullptr;
184 }
185 
186 PyResult CorpRegistryService::Handle_DeleteLabel(PyCallArgs &call) {
187  /* def DeleteLabel(self, labelID):
188  * self.GetCorpRegistry().DeleteLabel(labelID)
189  */
190  _log(CORP__CALL, "CorpRegistryService::Handle_DeleteLabel()");
191  call.Dump(CORP__CALL_DUMP);
192 
193  return nullptr;
194 }
195 
196 PyResult CorpRegistryService::Handle_EditLabel(PyCallArgs &call) {
197  /* def EditLabel(self, labelID, name = None, color = None):
198  * self.GetCorpRegistry().EditLabel(labelID, name, color)
199  */
200  _log(CORP__CALL, "CorpRegistryService::Handle_EditLabel()");
201  call.Dump(CORP__CALL_DUMP);
202 
203  return nullptr;
204 }
205 
206 PyResult CorpRegistryService::Handle_AssignLabels(PyCallArgs &call) {
207  /* def AssignLabels(self, contactIDs, labelMask):
208  * self.GetCorpRegistry().AssignLabels(contactIDs, labelMask)
209  */
210  _log(CORP__CALL, "CorpRegistryService::Handle_AssignLabels()");
211  call.Dump(CORP__CALL_DUMP);
212 
213  return nullptr;
214 }
215 
216 PyResult CorpRegistryService::Handle_RemoveLabels(PyCallArgs &call) {
217 /* def RemoveLabels(self, contactIDs, labelMask):
218  * self.GetCorpRegistry().RemoveLabels(contactIDs, labelMask)
219  */
220  _log(CORP__CALL, "CorpRegistryService::Handle_RemoveLabels()");
221  call.Dump(CORP__CALL_DUMP);
222 
223 
224  return nullptr;
225 }
Base Python wire object.
Definition: PyRep.h:66
PyCallable_Make_InnerDispatcher(CorpRegistryService) CorpRegistryService
PyTuple * AsTuple()
Definition: PyRep.h:138
Dispatcher *const m_dispatch
void SendErrorMsg(const char *fmt,...)
Definition: Client.cpp:2719
#define _log(type, fmt,...)
Definition: logsys.h:124
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
Dispatcher *const m_dispatch
bool IsTuple() const
Definition: PyRep.h:108
PyRep * GetLabels(uint32 corpID)
int32 GetCorporationID() const
Definition: Client.h:123
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
virtual PyBoundObject * CreateBoundObject(Client *pClient, const PyRep *bind_args)
PyRep * GetContacts(uint32 corpID)
PyServiceMgr *const m_manager
Definition: PyService.h:91
const char * GetName() const
Definition: Client.h:94
Client *const client
Definition: PyCallable.h:49
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
Definition: Client.h:66
void Dump(LogType type) const
Definition: PyCallable.cpp:81
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118
const char * TypeString() const
Definition: PyRep.cpp:76