EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AuthService.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
24 */
25 
26 #include "eve-server.h"
27 
28 #include "EVEServerConfig.h"
29 #include "PyServiceCD.h"
30 #include "account/AuthService.h"
31 
33 
35 : PyService(mgr, "authentication"),
36 m_dispatch(new Dispatcher(this))
37 {
38  _SetCallDispatcher(m_dispatch);
39 
41  PyCallable_REG_CALL(AuthService, GetPostAuthenticationMessage);
42  PyCallable_REG_CALL(AuthService, AmUnderage);
43  PyCallable_REG_CALL(AuthService, AccruedTime);
44  PyCallable_REG_CALL(AuthService, SetLanguageID);
45 
46 }
47 
49  delete m_dispatch;
50 }
51 
52 PyResult AuthService::Handle_Ping(PyCallArgs &call) {
53  return new PyLong(GetFileTimeNow());
54 }
55 
56 PyResult AuthService::Handle_GetPostAuthenticationMessage(PyCallArgs &call)
57 {
58  if (sConfig.account.loginMessage.empty())
59  return PyStatic.NewNone();
60 
61  PyDict* args = new PyDict;
62  args->SetItemString( "message", new PyString( sConfig.account.loginMessage ) );
63  return new PyObject( "util.KeyVal", args );
64 }
65 
66 PyResult AuthService::Handle_AmUnderage(PyCallArgs &call)
67 {
68  // return sm.RemoteSvc('authentication').AmUnderage()
69  sLog.Warning("AuthService", "Handle_AmUnderage() size=%u", call.tuple->size() );
70  call.Dump(SERVICE__CALL_DUMP);
71 
72  // return boolean
73  return new PyBool(false);
74 }
75 
76 PyResult AuthService::Handle_AccruedTime(PyCallArgs &call)
77 {
78  // return sm.RemoteSvc('authentication').AccruedTime()
79  sLog.Warning("AuthService", "Handle_AccruedTime() size=%u", call.tuple->size() );
80  call.Dump(SERVICE__CALL_DUMP);
81 
82  return nullptr;
83 }
84 
85 PyResult AuthService::Handle_SetLanguageID(PyCallArgs &call)
86 {
87  //sm.RemoteSvc('authentication').SetLanguageID(setlanguageID)
88  sLog.Warning("AuthService", "Handle_SetLanguageID() size=%u", call.tuple->size() );
89  call.Dump(SERVICE__CALL_DUMP);
90 
91  return nullptr;
92 }
#define sConfig
A macro for easier access to the singleton.
Dispatcher *const m_dispatch
Python string.
Definition: PyRep.h:430
Python's dictionary.
Definition: PyRep.h:719
size_t size() const
Definition: PyRep.h:591
PyCallable_Make_InnerDispatcher(AuthService) AuthService
Definition: AuthService.cpp:32
* args
Python boolean.
Definition: PyRep.h:323
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
Python object.
Definition: PyRep.h:826
#define PyStatic
Definition: PyRep.h:1209
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
double GetFileTimeNow()
Definition: utils_time.cpp:84
Dispatcher *const m_dispatch
Definition: AuthService.h:38
void Dump(LogType type) const
Definition: PyCallable.cpp:81
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
Python long integer.
Definition: PyRep.h:261
PyTuple * tuple
Definition: PyCallable.h:50
virtual ~AuthService()
Definition: AuthService.cpp:48