EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CalendarMgrService.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: Allan
24 */
25 
26 #include "eve-server.h"
27 
28 #include "PyServiceCD.h"
29 #include "system/CalendarDB.h"
31 #include "packets/Calendar.h"
32 
34 
36 : PyService(mgr, "calendarMgr"),
37  m_dispatch(new Dispatcher(this))
38 {
39  _SetCallDispatcher(m_dispatch);
40 
41  PyCallable_REG_CALL(CalendarMgrService, CreatePersonalEvent);
42  PyCallable_REG_CALL(CalendarMgrService, CreateCorporationEvent);
43  PyCallable_REG_CALL(CalendarMgrService, CreateAllianceEvent);
44  PyCallable_REG_CALL(CalendarMgrService, UpdateEventParticipants);
45  PyCallable_REG_CALL(CalendarMgrService, EditPersonalEvent);
46  PyCallable_REG_CALL(CalendarMgrService, EditCorporationEvent);
47  PyCallable_REG_CALL(CalendarMgrService, EditAllianceEvent);
48  PyCallable_REG_CALL(CalendarMgrService, GetResponsesForCharacter);
49  PyCallable_REG_CALL(CalendarMgrService, SendEventResponse);
51  PyCallable_REG_CALL(CalendarMgrService, GetResponsesToEvent);
52 }
53 
55 {
56  delete m_dispatch;
57 }
58 
59 PyResult CalendarMgrService::Handle_GetResponsesForCharacter(PyCallArgs& call) {
61 }
62 
63 PyResult CalendarMgrService::Handle_GetResponsesToEvent(PyCallArgs& call)
64 {
65  Call_TwoIntegerArgs args; //(eventID, ownerID)
66  if (!args.Decode(&call.tuple)) {
67  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
68  return nullptr;
69  }
70 
71  return CalendarDB::GetResponsesToEvent(args.arg1); // eventID
72 }
73 
74 PyResult CalendarMgrService::Handle_DeleteEvent( PyCallArgs& call )
75 {
76  Call_TwoIntegerArgs args; //(eventID, ownerID)
77  if (!args.Decode(&call.tuple)) {
78  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
79  return nullptr;
80  }
81 
82  CalendarDB::DeleteEvent(args.arg1); // eventID
83 
84  // Calendar must be reloaded or the event won't actually show as deleted.
85  call.client->SendNotification("OnReloadCalendar", "charid", new PyTuple(0), false);
86 
87  return nullptr;
88 }
89 
90 PyResult CalendarMgrService::Handle_SendEventResponse( PyCallArgs& call )
91 {
92  Call_SendEventResponse args;
93  if (!args.Decode(&call.tuple)) {
94  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
95  return PyStatic.NewNone();
96  }
97 
99 
100  // if this is an invitation, update calendar for non-denial responses
101 
102  return nullptr;
103 }
104 
105 PyResult CalendarMgrService::Handle_CreatePersonalEvent( PyCallArgs& call )
106 {
107  // newEventID = self.calendarMgr.CreatePersonalEvent(dateTime, duration, title, description, important, invitees)
108 
109  sLog.Cyan( "CalendarMgrService::Handle_CreatePersonalEvent()", "size= %u", call.tuple->size() );
110  call.Dump(SERVICE__CALL_DUMP);
111 
112  Call_CreateEventWithInvites args;
113  if (!args.Decode(&call.tuple)) {
114  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
115  return PyStatic.NewNone();
116  }
117 
118  // returns eventID
120 }
121 
122 PyResult CalendarMgrService::Handle_CreateCorporationEvent( PyCallArgs& call )
123 {
124  Call_CreateEvent args;
125  if (!args.Decode(&call.tuple)) {
126  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
127  return PyStatic.NewNone();
128  }
129 
130  // returns eventID
132 }
133 
134 PyResult CalendarMgrService::Handle_CreateAllianceEvent( PyCallArgs& call )
135 {
136  Call_CreateEvent args;
137  if (!args.Decode(&call.tuple)) {
138  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
139  return PyStatic.NewNone();
140  }
141 
142  // returns eventID
144 }
145 
146 PyResult CalendarMgrService::Handle_EditPersonalEvent( PyCallArgs& call )
147 {
148  //self.calendarMgr.EditPersonalEvent(eventID, oldDateTime, dateTime, duration, title, description, important)
149 
150  sLog.Cyan( "CalendarMgrService::Handle_EditPersonalEvent()", "size= %u", call.tuple->size() );
151  call.Dump(SERVICE__CALL_DUMP);
152 
153  Call_EditEvent args;
154  if (!args.Decode(&call.tuple)) {
155  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
156  return PyStatic.NewNone();
157  }
158 
159  return nullptr;
160 }
161 
162 PyResult CalendarMgrService::Handle_EditCorporationEvent( PyCallArgs& call )
163 {
164  // self.calendarMgr.EditCorporationEvent(eventID, oldDateTime, dateTime, duration, title, description, important)
165 
166  sLog.Cyan( "CalendarMgrService::Handle_EditCorporationEvent()", "size= %u", call.tuple->size() );
167  call.Dump(SERVICE__CALL_DUMP);
168 
169  Call_EditEvent args;
170  if (!args.Decode(&call.tuple)) {
171  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
172  return PyStatic.NewNone();
173  }
174 
175  return nullptr;
176 }
177 
178 PyResult CalendarMgrService::Handle_EditAllianceEvent( PyCallArgs& call )
179 {
180  //self.calendarMgr.EditAllianceEvent(eventID, oldDateTime, dateTime, duration, title, description, important)
181 
182  sLog.Cyan( "CalendarMgrService::Handle_EditAllianceEvent()", "size= %u", call.tuple->size() );
183  call.Dump(SERVICE__CALL_DUMP);
184 
185  Call_EditEvent args;
186  if (!args.Decode(&call.tuple)) {
187  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
188  return PyStatic.NewNone();
189  }
190 
191  return nullptr;
192 }
193 
194 PyResult CalendarMgrService::Handle_UpdateEventParticipants( PyCallArgs& call )
195 {
196  // self.calendarMgr.UpdateEventParticipants(eventID, charsToAdd, charsToRemove)
197 
198  sLog.Cyan( "CalendarMgrService::Handle_UpdateEventParticipants()", "size= %u", call.tuple->size() );
199  call.Dump(SERVICE__CALL_DUMP);
200 
201  Call_UpdateEventParticipants args;
202  if (!args.Decode(&call.tuple)) {
203  codelog(SERVICE__ERROR, "%s: Failed to decode arguments.", GetName());
204  return PyStatic.NewNone();
205  }
206 
208 
209  // this will need to update invitees and inform them of the invitation
210  // their calendar is updated based on their response (SendEventResponse)
211 
212  return nullptr;
213 }
214 
Dispatcher *const m_dispatch
void SendNotification(const PyAddress &dest, EVENotificationStream &noti, bool seq=true)
Definition: Client.cpp:2245
static PyRep * SaveNewEvent(uint32 ownerID, Call_CreateEventWithInvites &args)
Definition: CalendarDB.cpp:40
static void SaveEventResponse(uint32 charID, Call_SendEventResponse &args)
Definition: CalendarDB.cpp:229
size_t size() const
Definition: PyRep.h:591
int32 GetCharacterID() const
Definition: Client.h:113
int32 GetCorporationID() const
Definition: Client.h:123
Python tuple.
Definition: PyRep.h:567
const char * GetName() const
Definition: PyService.h:54
int32 GetAllianceID() const
Definition: Client.h:125
static void UpdateEventParticipants(Call_UpdateEventParticipants &args)
Definition: CalendarDB.cpp:279
* args
#define sLog
Evaluates to a NewLog instance.
Definition: LogNew.h:250
static PyRep * GetResponsesForCharacter(uint32 charID)
Definition: CalendarDB.cpp:237
#define codelog(type, fmt,...)
Definition: logsys.h:128
#define PyStatic
Definition: PyRep.h:1209
Client *const client
Definition: PyCallable.h:49
#define PyCallable_REG_CALL(c, m)
Definition: PyServiceCD.h:78
PyCallable_Make_InnerDispatcher(CalendarMgrService) CalendarMgrService
static PyRep * GetResponsesToEvent(uint32 eventID)
Definition: CalendarDB.cpp:258
void Dump(LogType type) const
Definition: PyCallable.cpp:81
Dispatcher *const m_dispatch
static void DeleteEvent(uint32 eventID)
Definition: CalendarDB.cpp:33
PyTuple * tuple
Definition: PyCallable.h:50