EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OnlineStatusService.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 "PyServiceCD.h"
29 #include "EntityList.h"
31 
33 
35 : PyService(mgr, "onlineStatus"),
36 m_dispatch(new Dispatcher(this))
37 {
38  _SetCallDispatcher(m_dispatch);
39 
40  PyCallable_REG_CALL(OnlineStatusService, GetInitialState);
41  PyCallable_REG_CALL(OnlineStatusService, GetOnlineStatus);
42 }
43 
45  delete m_dispatch;
46 }
47 
49 PyResult OnlineStatusService::Handle_GetInitialState(PyCallArgs &call) {
50 /*
51 21:35:16 L OnlineStatusService::Handle_GetInitialState(): size= 0
52 21:35:16 [SvcCall] Call Arguments:
53 21:35:16 [SvcCall] Tuple: Empty
54 21:35:16 [SvcCall] Call Named Arguments:
55 21:35:16 [SvcCall] Argument 'machoVersion':
56 21:35:16 [SvcCall] Integer field: 1
57  sLog.White( "OnlineStatusService::Handle_GetInitialState()", "size= %u", call.tuple->size() );
58  call.Dump(SERVICE__CALL_DUMP);
59 
60 
61  [PySubStream 1861 bytes]
62  [PyObjectEx Type2]
63  [PyTuple 2 items]
64  [PyTuple 1 items]
65  [PyToken dbutil.CRowset]
66  [PyDict 1 kvp]
67  [PyString "header"]
68  [PyObjectEx Normal]
69  [PyTuple 2 items]
70  [PyToken blue.DBRowDescriptor]
71  [PyTuple 1 items]
72  [PyTuple 2 items]
73  [PyTuple 2 items]
74  [PyString "contactID"]
75  [PyInt 3]
76  [PyTuple 2 items]
77  [PyString "online"]
78  [PyInt 3]
79  [PyPackedRow 9 bytes]
80  ["contactID" => <108985089> [I4]]
81  ["online" => <0> [I4]]
82  [PyPackedRow 9 bytes]
83  ["contactID" => <116081192> [I4]]
84  ["online" => <0> [I4]]
85  [PyPackedRow 9 bytes]
86  ["contactID" => <116844755> [I4]]
87  ["online" => <0> [I4]]
88  [PyPackedRow 9 bytes]
89  ["contactID" => <118879785> [I4]]
90  ["online" => <1> [I4]]
91  */
92  // this is used to query the initial online state of all contacts.
93 
94  DBRowDescriptor *header = new DBRowDescriptor();
95  header->AddColumn("contactID", DBTYPE_I4);
96  header->AddColumn("online", DBTYPE_BOOL);
97  CRowSet *rowset = new CRowSet( &header );
98  // loop thru contact list and fill following row accordingly
99  //PyPackedRow* row = rowset->NewRow();
100  //row->SetField(new PyInt(*charID*), sEntityList.PyIsOnline(PyRep::IntegerValue(charID)))); // charID/online
101  return rowset;
102 }
103 
104 PyResult OnlineStatusService::Handle_GetOnlineStatus(PyCallArgs &call) {
105  // this is used to query the online state of a character by charID.
106  return sEntityList.PyIsOnline(PyRep::IntegerValue(call.tuple->GetItem(0)));
107 }
108 
109 /*
110 ==================== Sent from Server 81 bytes
111 
112 [PyObjectData Name: macho.Notification]
113  [PyTuple 7 items]
114  [PyInt 12]
115  [PyObjectData Name: macho.MachoAddress]
116  [PyTuple 4 items]
117  [PyInt 1]
118  [PyInt 806438]
119  [PyNone]
120  [PyNone]
121  [PyObjectData Name: macho.MachoAddress]
122  [PyTuple 4 items]
123  [PyInt 4]
124  [PyString "OnContactLoggedOn"]
125  [PyList 0 items]
126  [PyString "clientID"]
127  [PyInt 5654387]
128  [PyTuple 1 items]
129  [PyTuple 2 items]
130  [PyInt 0]
131  [PySubStream 15 bytes]
132  [PyTuple 2 items]
133  [PyInt 0]
134  [PyTuple 2 items]
135  [PyInt 1]
136  [PyTuple 1 items]
137  [PyInt 649670823]
138  [PyNone]
139  [PyNone]
140 
141 ==================== Sent from Server 81 bytes
142 
143 [PyObjectData Name: macho.Notification]
144  [PyTuple 6 items]
145  [PyInt 12]
146  [PyObjectData Name: macho.MachoAddress]
147  [PyTuple 4 items]
148  [PyInt 1]
149  [PyInt 698462]
150  [PyNone]
151  [PyNone]
152  [PyObjectData Name: macho.MachoAddress]
153  [PyTuple 4 items]
154  [PyInt 4]
155  [PyString "OnContactLoggedOff"]
156  [PyList 0 items]
157  [PyString "clientID"]
158  [PyInt 5654387]
159  [PyTuple 1 items]
160  [PyTuple 2 items]
161  [PyInt 0]
162  [PySubStream 15 bytes]
163  [PyTuple 2 items]
164  [PyInt 0]
165  [PyTuple 2 items]
166  [PyInt 1]
167  [PyTuple 1 items]
168  [PyInt 1610990724]
169  [PyNone]
170 
171 
172 */
Dispatcher *const m_dispatch
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
void AddColumn(const char *name, DBTYPE type)
Definition: PyDatabase.cpp:96
Dispatcher *const m_dispatch
#define sEntityList
Definition: EntityList.h:208
PyCallable_Make_InnerDispatcher(OnlineStatusService) OnlineStatusService
Python object "blue.DBRowDescriptor".
Definition: PyDatabase.h:41
Python object "dbutil.CRowset".
Definition: PyDatabase.h:124
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118
PyTuple * tuple
Definition: PyCallable.h:50