EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LookupService.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, Aknor Jaden
24 */
25 
26 
27 #include "eve-server.h"
28 
29 #include "PyServiceCD.h"
30 #include "chat/LookupService.h"
31 
32 
34 
36 : PyService(mgr, "lookupSvc"),
37  m_dispatch(new Dispatcher(this))
38 {
39  _SetCallDispatcher(m_dispatch);
40 
41  PyCallable_REG_CALL(LookupService, LookupCharacters);
42  PyCallable_REG_CALL(LookupService, LookupOwners);
43  PyCallable_REG_CALL(LookupService, LookupPlayerCharacters);
44  PyCallable_REG_CALL(LookupService, LookupCorporations);
45  PyCallable_REG_CALL(LookupService, LookupFactions);
46  PyCallable_REG_CALL(LookupService, LookupCorporationTickers);
47  PyCallable_REG_CALL(LookupService, LookupStations);
48  PyCallable_REG_CALL(LookupService, LookupKnownLocationsByGroup);
49  PyCallable_REG_CALL(LookupService, LookupEvePlayerCharacters);
50  PyCallable_REG_CALL(LookupService, LookupPCOwners);
51  PyCallable_REG_CALL(LookupService, LookupNoneNPCAccountOwners);
52 }
53 
55  delete m_dispatch;
56 }
57 
58 PyResult LookupService::Handle_LookupEvePlayerCharacters(PyCallArgs& call) {
59  Call_LookupStringInt args;
60  if (!args.Decode(&call.tuple)) {
61  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
62  return nullptr;
63  }
64 
65  return ServiceDB::LookupChars(args.searchString.c_str(), args.searchOption ? true : false);
66 }
67 
68 PyResult LookupService::Handle_LookupCharacters(PyCallArgs &call) {
69  Call_LookupStringInt args;
70  if (!args.Decode(&call.tuple)) {
71  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
72  return nullptr;
73  }
74 
75  return ServiceDB::LookupChars(args.searchString.c_str(), args.searchOption ? true : false);
76 }
77 
78 // this may actually be a call to search for player corps by name.
79 PyResult LookupService::Handle_LookupPCOwners(PyCallArgs &call) {
80  Call_LookupStringInt args;
81  if (!args.Decode(&call.tuple)) {
82  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
83  return nullptr;
84  }
85 
86  return ServiceDB::LookupChars(args.searchString.c_str(), args.searchOption ? true : false);
87 }
88 //LookupOwners
89 PyResult LookupService::Handle_LookupOwners(PyCallArgs &call) {
90  Call_LookupStringInt args;
91  if (!args.Decode(&call.tuple)) {
92  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
93  return nullptr;
94  }
95 
96  return ServiceDB::LookupOwners(args.searchString.c_str(), args.searchOption ? true : false );
97 }
98 
99 PyResult LookupService::Handle_LookupNoneNPCAccountOwners(PyCallArgs &call) {
100  Call_LookupStringInt args;
101  if (!args.Decode(&call.tuple)) {
102  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
103  return nullptr;
104  }
105 
106  return ServiceDB::LookupOwners(args.searchString.c_str(), args.searchOption ? true : false );
107 }
108 
109 PyResult LookupService::Handle_LookupPlayerCharacters(PyCallArgs &call) {
110  Call_LookupStringInt args;
111  if (!args.Decode(&call.tuple)) {
112  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
113  return nullptr;
114  }
115 
116  return ServiceDB::LookupChars(args.searchString.c_str(), false);
117 }
118 PyResult LookupService::Handle_LookupCorporations(PyCallArgs &call) {
119  Call_LookupStringInt args;
120  if (!args.Decode(&call.tuple)) {
121  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
122  return nullptr;
123  }
124 
125  return ServiceDB::LookupCorporations(args.searchString);
126 }
127 PyResult LookupService::Handle_LookupFactions(PyCallArgs &call) {
128  Call_LookupStringInt args;
129  if (!args.Decode(&call.tuple)) {
130  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
131  return nullptr;
132  }
133 
134  return ServiceDB::LookupFactions(args.searchString);
135 }
136 PyResult LookupService::Handle_LookupCorporationTickers(PyCallArgs &call) {
137  Call_LookupStringInt args;
138  if (!args.Decode(&call.tuple)) {
139  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
140  return nullptr;
141  }
142 
143  return ServiceDB::LookupCorporationTickers(args.searchString);
144 }
145 PyResult LookupService::Handle_LookupStations(PyCallArgs &call) {
146  Call_LookupStringInt args;
147  if (!args.Decode(&call.tuple)) {
148  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
149  return nullptr;
150  }
151 
152  return ServiceDB::LookupStations(args.searchString);
153 }
154 
155 PyResult LookupService::Handle_LookupKnownLocationsByGroup(PyCallArgs &call) {
156  Call_LookupIntString args;
157  if (!args.Decode(&call.tuple)) {
158  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
159  return nullptr;
160  }
161 
162  return ServiceDB::LookupKnownLocationsByGroup(args.searchString, args.searchOption);
163 }
Dispatcher *const m_dispatch
Definition: LookupService.h:41
Dispatcher *const m_dispatch
static PyRep * LookupCorporationTickers(const std::string &)
Definition: ServiceDB.cpp:483
static PyRep * LookupOwners(const char *match, bool exact=false)
Definition: ServiceDB.cpp:391
const char * GetName() const
Definition: PyService.h:54
* args
static PyRep * LookupKnownLocationsByGroup(const std::string &, uint32)
Definition: ServiceDB.cpp:521
static PyRep * LookupCorporations(const std::string &)
Definition: ServiceDB.cpp:445
#define codelog(type, fmt,...)
Definition: logsys.h:128
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
virtual ~LookupService()
static PyRep * LookupChars(const char *match, bool exact=false)
Definition: ServiceDB.cpp:358
static PyRep * LookupStations(const std::string &)
Definition: ServiceDB.cpp:502
PyCallable_Make_InnerDispatcher(LookupService) LookupService
static PyRep * LookupFactions(const std::string &)
Definition: ServiceDB.cpp:464
PyTuple * tuple
Definition: PyCallable.h:50