TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CalendarMgr Class Reference

#include <CalendarMgr.h>

Public Member Functions

void LoadFromDB ()
 
CalendarEventGetEvent (uint64 eventId) const
 
CalendarEventStore constGetEvents () const
 
CalendarEventStore GetPlayerEvents (ObjectGuid guid)
 
CalendarInviteGetInvite (uint64 inviteId) const
 
CalendarEventInviteStore constGetInvites () const
 
CalendarInviteStore constGetEventInvites (uint64 eventId)
 
CalendarInviteStore GetPlayerInvites (ObjectGuid guid)
 
void FreeEventId (uint64 id)
 
uint64 GetFreeEventId ()
 
void FreeInviteId (uint64 id)
 
uint64 GetFreeInviteId ()
 
uint32 GetPlayerNumPending (ObjectGuid guid)
 
void AddEvent (CalendarEvent *calendarEvent, CalendarSendEventType sendType)
 
void RemoveEvent (uint64 eventId, ObjectGuid remover)
 
void UpdateEvent (CalendarEvent *calendarEvent)
 
void AddInvite (CalendarEvent *calendarEvent, CalendarInvite *invite)
 
void AddInvite (CalendarEvent *calendarEvent, CalendarInvite *invite, SQLTransaction &trans)
 
void RemoveInvite (uint64 inviteId, uint64 eventId, ObjectGuid remover)
 
void UpdateInvite (CalendarInvite *invite)
 
void UpdateInvite (CalendarInvite *invite, SQLTransaction &trans)
 
void RemoveAllPlayerEventsAndInvites (ObjectGuid guid)
 
void RemovePlayerGuildEventsAndSignups (ObjectGuid guid, ObjectGuid::LowType guildId)
 
void SendCalendarEvent (ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarSendEventType sendType)
 
void SendCalendarEventInvite (CalendarInvite const &invite)
 
void SendCalendarEventInviteAlert (CalendarEvent const &calendarEvent, CalendarInvite const &invite)
 
void SendCalendarEventInviteRemove (CalendarEvent const &calendarEvent, CalendarInvite const &invite, uint32 flags)
 
void SendCalendarEventInviteRemoveAlert (ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarInviteStatus status)
 
void SendCalendarEventUpdateAlert (CalendarEvent const &calendarEvent, time_t originalDate)
 
void SendCalendarEventStatus (CalendarEvent const &calendarEvent, CalendarInvite const &invite)
 
void SendCalendarEventRemovedAlert (CalendarEvent const &calendarEvent)
 
void SendCalendarEventModeratorStatusAlert (CalendarEvent const &calendarEvent, CalendarInvite const &invite)
 
void SendCalendarClearPendingAction (ObjectGuid guid)
 
void SendCalendarCommandResult (ObjectGuid guid, CalendarError err, char const *param=NULL)
 
void SendPacketToAllEventRelatives (WorldPacket const *packet, CalendarEvent const &calendarEvent)
 

Static Public Member Functions

static CalendarMgrinstance ()
 

Private Member Functions

 CalendarMgr ()
 
 ~CalendarMgr ()
 

Private Attributes

CalendarEventStore _events
 
CalendarEventInviteStore _invites
 
std::deque< uint64_freeEventIds
 
std::deque< uint64_freeInviteIds
 
uint64 _maxEventId
 
uint64 _maxInviteId
 

Constructor & Destructor Documentation

CalendarMgr::CalendarMgr ( )
private
37 : _maxEventId(0), _maxInviteId(0) { }
uint64 _maxInviteId
Definition: CalendarMgr.h:283
uint64 _maxEventId
Definition: CalendarMgr.h:282
CalendarMgr::~CalendarMgr ( )
private
40 {
41  for (CalendarEventStore::iterator itr = _events.begin(); itr != _events.end(); ++itr)
42  delete *itr;
43 
44  for (CalendarEventInviteStore::iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
45  for (CalendarInviteStore::iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
46  delete *itr2;
47 }
CalendarEventStore _events
Definition: CalendarMgr.h:277
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278

Member Function Documentation

void CalendarMgr::AddEvent ( CalendarEvent calendarEvent,
CalendarSendEventType  sendType 
)
129 {
130  _events.insert(calendarEvent);
131  UpdateEvent(calendarEvent);
132  SendCalendarEvent(calendarEvent->GetOwnerGUID(), *calendarEvent, sendType);
133 }
void UpdateEvent(CalendarEvent *calendarEvent)
Definition: CalendarMgr.cpp:234
CalendarEventStore _events
Definition: CalendarMgr.h:277
void SendCalendarEvent(ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarSendEventType sendType)
Definition: CalendarMgr.cpp:549
ObjectGuid GetOwnerGUID() const
Definition: CalendarMgr.h:222

+ Here is the call graph for this function:

void CalendarMgr::AddInvite ( CalendarEvent calendarEvent,
CalendarInvite invite 
)
136 {
137  SQLTransaction dummy;
138  AddInvite(calendarEvent, invite, dummy);
139 }
void AddInvite(CalendarEvent *calendarEvent, CalendarInvite *invite)
Definition: CalendarMgr.cpp:135
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
void CalendarMgr::AddInvite ( CalendarEvent calendarEvent,
CalendarInvite invite,
SQLTransaction trans 
)
142 {
143  if (!calendarEvent->IsGuildAnnouncement() && calendarEvent->GetOwnerGUID() != invite->GetInviteeGUID())
144  SendCalendarEventInvite(*invite);
145 
146  if (!calendarEvent->IsGuildEvent() || invite->GetInviteeGUID() == calendarEvent->GetOwnerGUID())
147  SendCalendarEventInviteAlert(*calendarEvent, *invite);
148 
149  if (!calendarEvent->IsGuildAnnouncement())
150  {
151  _invites[invite->GetEventId()].push_back(invite);
152  UpdateInvite(invite, trans);
153  }
154 }
ObjectGuid GetInviteeGUID() const
Definition: CalendarMgr.h:166
void UpdateInvite(CalendarInvite *invite)
Definition: CalendarMgr.cpp:249
void SendCalendarEventInviteAlert(CalendarEvent const &calendarEvent, CalendarInvite const &invite)
Definition: CalendarMgr.cpp:521
uint64 GetEventId() const
Definition: CalendarMgr.h:160
void SendCalendarEventInvite(CalendarInvite const &invite)
Definition: CalendarMgr.cpp:427
bool IsGuildAnnouncement() const
Definition: CalendarMgr.h:246
bool IsGuildEvent() const
Definition: CalendarMgr.h:245
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
ObjectGuid GetOwnerGUID() const
Definition: CalendarMgr.h:222

+ Here is the call graph for this function:

void CalendarMgr::FreeEventId ( uint64  id)
315 {
316  if (id == _maxEventId)
317  --_maxEventId;
318  else
319  _freeEventIds.push_back(id);
320 }
std::deque< uint64 > _freeEventIds
Definition: CalendarMgr.h:280
uint64 _maxEventId
Definition: CalendarMgr.h:282
void CalendarMgr::FreeInviteId ( uint64  id)
333 {
334  if (id == _maxInviteId)
335  --_maxInviteId;
336  else
337  _freeInviteIds.push_back(id);
338 }
uint64 _maxInviteId
Definition: CalendarMgr.h:283
std::deque< uint64 > _freeInviteIds
Definition: CalendarMgr.h:281
CalendarEvent * CalendarMgr::GetEvent ( uint64  eventId) const
294 {
295  for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
296  if ((*itr)->GetEventId() == eventId)
297  return *itr;
298 
299  TC_LOG_DEBUG("calendar", "CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
300  return NULL;
301 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
CalendarEventStore _events
Definition: CalendarMgr.h:277
#define UI64FMTD
Definition: Define.h:137

+ Here is the caller graph for this function:

CalendarInviteStore const & CalendarMgr::GetEventInvites ( uint64  eventId)
369 {
370  return _invites[eventId];
371 }
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
CalendarEventStore const& CalendarMgr::GetEvents ( ) const
inline
291 { return _events; }
CalendarEventStore _events
Definition: CalendarMgr.h:277
uint64 CalendarMgr::GetFreeEventId ( )
323 {
324  if (_freeEventIds.empty())
325  return ++_maxEventId;
326 
327  uint64 eventId = _freeEventIds.front();
328  _freeEventIds.pop_front();
329  return eventId;
330 }
std::deque< uint64 > _freeEventIds
Definition: CalendarMgr.h:280
uint64 _maxEventId
Definition: CalendarMgr.h:282
uint64_t uint64
Definition: Define.h:149
uint64 CalendarMgr::GetFreeInviteId ( )
341 {
342  if (_freeInviteIds.empty())
343  return ++_maxInviteId;
344 
345  uint64 inviteId = _freeInviteIds.front();
346  _freeInviteIds.pop_front();
347  return inviteId;
348 }
uint64 _maxInviteId
Definition: CalendarMgr.h:283
std::deque< uint64 > _freeInviteIds
Definition: CalendarMgr.h:281
uint64_t uint64
Definition: Define.h:149
CalendarInvite * CalendarMgr::GetInvite ( uint64  inviteId) const
304 {
305  for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
306  for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
307  if ((*itr2)->GetInviteId() == inviteId)
308  return *itr2;
309 
310  TC_LOG_DEBUG("calendar", "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
311  return NULL;
312 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
#define UI64FMTD
Definition: Define.h:137
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278

+ Here is the caller graph for this function:

CalendarEventInviteStore const& CalendarMgr::GetInvites ( ) const
inline
295 { return _invites; }
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
CalendarEventStore CalendarMgr::GetPlayerEvents ( ObjectGuid  guid)
351 {
352  CalendarEventStore events;
353 
354  for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
355  for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
356  if ((*itr2)->GetInviteeGUID() == guid)
357  if (CalendarEvent* event = GetEvent(itr->first)) // NULL check added as attempt to fix #11512
358  events.insert(event);
359 
360  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
361  for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
362  if ((*itr)->GetGuildId() == player->GetGuildId())
363  events.insert(*itr);
364 
365  return events;
366 }
CalendarEventStore _events
Definition: CalendarMgr.h:277
std::set< CalendarEvent * > CalendarEventStore
Definition: CalendarMgr.h:268
Definition: CalendarMgr.h:191
CalendarEvent * GetEvent(uint64 eventId) const
Definition: CalendarMgr.cpp:293
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function:

CalendarInviteStore CalendarMgr::GetPlayerInvites ( ObjectGuid  guid)
374 {
375  CalendarInviteStore invites;
376 
377  for (CalendarEventInviteStore::const_iterator itr = _invites.begin(); itr != _invites.end(); ++itr)
378  for (CalendarInviteStore::const_iterator itr2 = itr->second.begin(); itr2 != itr->second.end(); ++itr2)
379  if ((*itr2)->GetInviteeGUID() == guid)
380  invites.push_back(*itr2);
381 
382  return invites;
383 }
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278

+ Here is the caller graph for this function:

uint32 CalendarMgr::GetPlayerNumPending ( ObjectGuid  guid)
386 {
387  CalendarInviteStore const& invites = GetPlayerInvites(guid);
388 
389  uint32 pendingNum = 0;
390  for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
391  {
392  switch ((*itr)->GetStatus())
393  {
397  ++pendingNum;
398  break;
399  default:
400  break;
401  }
402  }
403 
404  return pendingNum;
405 }
Definition: CalendarMgr.h:84
CalendarInviteStore GetPlayerInvites(ObjectGuid guid)
Definition: CalendarMgr.cpp:373
Definition: CalendarMgr.h:83
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267
uint32_t uint32
Definition: Define.h:150
Definition: CalendarMgr.h:76

+ Here is the call graph for this function:

CalendarMgr * CalendarMgr::instance ( )
static
50 {
51  static CalendarMgr instance;
52  return &instance;
53 }
static CalendarMgr * instance()
Definition: CalendarMgr.cpp:49
Definition: CalendarMgr.h:271
void CalendarMgr::LoadFromDB ( )
56 {
57  uint32 count = 0;
58  _maxEventId = 0;
59  _maxInviteId = 0;
60 
61  // 0 1 2 3 4 5 6 7 8
62  if (QueryResult result = CharacterDatabase.Query("SELECT EventID, Owner, Title, Description, EventType, TextureID, Date, Flags, LockDate FROM calendar_events"))
63  do
64  {
65  Field* fields = result->Fetch();
66 
67  uint64 eventID = fields[0].GetUInt64();
68  ObjectGuid ownerGUID = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt64());
69  std::string title = fields[2].GetString();
70  std::string description = fields[3].GetString();
71  CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
72  int32 textureID = fields[5].GetInt32();
73  uint32 date = fields[6].GetUInt32();
74  uint32 flags = fields[7].GetUInt32();
75  uint32 lockDate = fields[8].GetUInt32();
76  ObjectGuid::LowType guildID = UI64LIT(0);
77 
79  guildID = Player::GetGuildIdFromDB(ownerGUID);
80 
81  CalendarEvent* calendarEvent = new CalendarEvent(eventID, ownerGUID, guildID, type, textureID, time_t(date), flags, title, description, time_t(lockDate));
82  _events.insert(calendarEvent);
83 
84  _maxEventId = std::max(_maxEventId, eventID);
85 
86  ++count;
87  }
88  while (result->NextRow());
89 
90  TC_LOG_INFO("server.loading", ">> Loaded %u calendar events", count);
91  count = 0;
92 
93  // 0 1 2 3 4 5 6 7
94  if (QueryResult result = CharacterDatabase.Query("SELECT InviteID, EventID, Invitee, Sender, Status, ResponseTime, ModerationRank, Note FROM calendar_invites"))
95  do
96  {
97  Field* fields = result->Fetch();
98 
99  uint64 inviteId = fields[0].GetUInt64();
100  uint64 eventId = fields[1].GetUInt64();
101  ObjectGuid invitee = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
102  ObjectGuid senderGUID = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64());
103  CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
104  uint32 responseTime = fields[5].GetUInt32();
105  CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
106  std::string note = fields[7].GetString();
107 
108  CalendarInvite* invite = new CalendarInvite(inviteId, eventId, invitee, senderGUID, time_t(responseTime), status, rank, note);
109  _invites[eventId].push_back(invite);
110 
111  _maxInviteId = std::max(_maxInviteId, inviteId);
112 
113  ++count;
114  }
115  while (result->NextRow());
116 
117  TC_LOG_INFO("server.loading", ">> Loaded %u calendar invites", count);
118 
119  for (uint64 i = 1; i < _maxEventId; ++i)
120  if (!GetEvent(i))
121  _freeEventIds.push_back(i);
122 
123  for (uint64 i = 1; i < _maxInviteId; ++i)
124  if (!GetInvite(i))
125  _freeInviteIds.push_back(i);
126 }
uint64 GetUInt64() const
Definition: Field.h:184
uint64 _maxInviteId
Definition: CalendarMgr.h:283
std::deque< uint64 > _freeInviteIds
Definition: CalendarMgr.h:281
Definition: CalendarMgr.h:38
Class used to access individual fields of database query result.
Definition: Field.h:56
CalendarEventType
Definition: CalendarMgr.h:56
#define UI64LIT(N)
Definition: Define.h:138
CalendarInvite * GetInvite(uint64 inviteId) const
Definition: CalendarMgr.cpp:303
std::deque< uint64 > _freeEventIds
Definition: CalendarMgr.h:280
CalendarEventStore _events
Definition: CalendarMgr.h:277
uint64 LowType
Definition: ObjectGuid.h:199
CalendarModerationRank
Definition: CalendarMgr.h:42
T max(const T &x, const T &y)
Definition: g3dmath.h:320
Definition: CalendarMgr.h:39
Definition: CalendarMgr.h:191
uint64 _maxEventId
Definition: CalendarMgr.h:282
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
CalendarEvent * GetEvent(uint64 eventId) const
Definition: CalendarMgr.cpp:293
int32 GetInt32() const
Definition: Field.h:165
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
CalendarInviteStatus
Definition: CalendarMgr.h:74
Definition: ObjectGuid.h:189
uint8 flags
Definition: DisableMgr.cpp:44
Definition: CalendarMgr.h:131
std::string GetString() const
Definition: Field.h:276

+ Here is the call graph for this function:

void CalendarMgr::RemoveAllPlayerEventsAndInvites ( ObjectGuid  guid)
270 {
271  for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
272  if ((*itr)->GetOwnerGUID() == guid)
273  RemoveEvent((*itr)->GetEventId(), ObjectGuid::Empty); // don't send mail if removing a character
274 
275  CalendarInviteStore playerInvites = GetPlayerInvites(guid);
276  for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
277  RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
278 }
void RemoveEvent(uint64 eventId, ObjectGuid remover)
Definition: CalendarMgr.cpp:156
void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover)
Definition: CalendarMgr.cpp:199
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
CalendarInviteStore GetPlayerInvites(ObjectGuid guid)
Definition: CalendarMgr.cpp:373
CalendarEventStore _events
Definition: CalendarMgr.h:277
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267

+ Here is the call graph for this function:

void CalendarMgr::RemoveEvent ( uint64  eventId,
ObjectGuid  remover 
)
157 {
158  CalendarEvent* calendarEvent = GetEvent(eventId);
159 
160  if (!calendarEvent)
161  {
163  return;
164  }
165 
166  SendCalendarEventRemovedAlert(*calendarEvent);
167 
169  PreparedStatement* stmt;
170  MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());
171 
172  CalendarInviteStore& eventInvites = _invites[eventId];
173  for (size_t i = 0; i < eventInvites.size(); ++i)
174  {
175  CalendarInvite* invite = eventInvites[i];
177  stmt->setUInt64(0, invite->GetInviteId());
178  trans->Append(stmt);
179 
180  // guild events only? check invite status here?
181  // When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
182  if (!remover.IsEmpty() && invite->GetInviteeGUID() != remover)
183  mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID().GetCounter()), calendarEvent, MAIL_CHECK_MASK_COPIED);
184 
185  delete invite;
186  }
187 
188  _invites.erase(eventId);
189 
191  stmt->setUInt64(0, eventId);
192  trans->Append(stmt);
194 
195  delete calendarEvent;
196  _events.erase(calendarEvent);
197 }
ObjectGuid GetInviteeGUID() const
Definition: CalendarMgr.h:166
Definition: CharacterDatabase.h:519
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:521
CalendarEventStore _events
Definition: CalendarMgr.h:277
This mail was returned. Do not allow returning mail back again.
Definition: Mail.h:50
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: Mail.h:118
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267
uint64 GetInviteId() const
Definition: CalendarMgr.h:157
Definition: CalendarMgr.h:191
Definition: CalendarMgr.h:96
std::string BuildCalendarMailBody() const
Definition: CalendarMgr.cpp:414
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
CalendarEvent * GetEvent(uint64 eventId) const
Definition: CalendarMgr.cpp:293
std::string BuildCalendarMailSubject(ObjectGuid remover) const
Definition: CalendarMgr.cpp:407
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
void SendCalendarCommandResult(ObjectGuid guid, CalendarError err, char const *param=NULL)
Definition: CalendarMgr.cpp:616
Definition: CalendarMgr.h:131
Definition: Mail.h:104
bool IsEmpty() const
Definition: ObjectGuid.h:242
LowType GetCounter() const
Definition: ObjectGuid.h:221
void SendCalendarEventRemovedAlert(CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:489
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::RemoveInvite ( uint64  inviteId,
uint64  eventId,
ObjectGuid  remover 
)
200 {
201  CalendarEvent* calendarEvent = GetEvent(eventId);
202 
203  if (!calendarEvent)
204  return;
205 
206  CalendarInviteStore::iterator itr = _invites[eventId].begin();
207  for (; itr != _invites[eventId].end(); ++itr)
208  if ((*itr)->GetInviteId() == inviteId)
209  break;
210 
211  if (itr == _invites[eventId].end())
212  return;
213 
216  stmt->setUInt64(0, (*itr)->GetInviteId());
217  trans->Append(stmt);
219 
220  if (!calendarEvent->IsGuildEvent())
221  SendCalendarEventInviteRemoveAlert((*itr)->GetInviteeGUID(), *calendarEvent, CALENDAR_STATUS_REMOVED);
222 
223  SendCalendarEventInviteRemove(*calendarEvent, **itr, calendarEvent->GetFlags());
224 
225  // we need to find out how to use CALENDAR_INVITE_REMOVED_MAIL_SUBJECT to force client to display different mail
226  //if ((*itr)->GetInviteeGUID() != remover)
227  // MailDraft(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody())
228  // .SendMailTo(trans, MailReceiver((*itr)->GetInvitee()), calendarEvent, MAIL_CHECK_MASK_COPIED);
229 
230  delete *itr;
231  _invites[eventId].erase(itr);
232 }
void SendCalendarEventInviteRemove(CalendarEvent const &calendarEvent, CalendarInvite const &invite, uint32 flags)
Definition: CalendarMgr.cpp:499
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:521
void SendCalendarEventInviteRemoveAlert(ObjectGuid guid, CalendarEvent const &calendarEvent, CalendarInviteStatus status)
Definition: CalendarMgr.cpp:596
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
Definition: CalendarMgr.h:191
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
CalendarEvent * GetEvent(uint64 eventId) const
Definition: CalendarMgr.cpp:293
bool IsGuildEvent() const
Definition: CalendarMgr.h:245
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CalendarMgr.h:85
uint32 GetFlags() const
Definition: CalendarMgr.h:243
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::RemovePlayerGuildEventsAndSignups ( ObjectGuid  guid,
ObjectGuid::LowType  guildId 
)
281 {
282  for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
283  if ((*itr)->GetOwnerGUID() == guid && ((*itr)->IsGuildEvent() || (*itr)->IsGuildAnnouncement()))
284  RemoveEvent((*itr)->GetEventId(), guid);
285 
286  CalendarInviteStore playerInvites = GetPlayerInvites(guid);
287  for (CalendarInviteStore::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
288  if (CalendarEvent* calendarEvent = GetEvent((*itr)->GetEventId()))
289  if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == guildId)
290  RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
291 }
void RemoveEvent(uint64 eventId, ObjectGuid remover)
Definition: CalendarMgr.cpp:156
void RemoveInvite(uint64 inviteId, uint64 eventId, ObjectGuid remover)
Definition: CalendarMgr.cpp:199
CalendarInviteStore GetPlayerInvites(ObjectGuid guid)
Definition: CalendarMgr.cpp:373
CalendarEventStore _events
Definition: CalendarMgr.h:277
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267
Definition: CalendarMgr.h:191
CalendarEvent * GetEvent(uint64 eventId) const
Definition: CalendarMgr.cpp:293

+ Here is the call graph for this function:

void CalendarMgr::SendCalendarClearPendingAction ( ObjectGuid  guid)
611 {
612  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
613  player->SendDirectMessage(WorldPackets::Calendar::CalendarClearPendingAction().Write());
614 }
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function:

void CalendarMgr::SendCalendarCommandResult ( ObjectGuid  guid,
CalendarError  err,
char const param = NULL 
)
617 {
618  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
619  {
621  packet.Command = 1; // FIXME
622  packet.Result = err;
623 
624  switch (err)
625  {
629  packet.Name = param;
630  break;
631  default:
632  break;
633  }
634 
635  player->SendDirectMessage(packet.Write());
636  }
637 }
uint8 Command
Definition: CalendarPackets.h:471
Definition: CalendarMgr.h:103
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:401
std::string Name
Definition: CalendarPackets.h:473
Definition: CalendarMgr.h:100
Definition: CalendarMgr.h:94
uint8 Result
Definition: CalendarPackets.h:472
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
Definition: CalendarPackets.h:463

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEvent ( ObjectGuid  guid,
CalendarEvent const calendarEvent,
CalendarSendEventType  sendType 
)
550 {
552  if (!player)
553  return;
554 
555  CalendarInviteStore const& eventInviteeList = _invites[calendarEvent.GetEventId()];
556 
558  packet.Date = calendarEvent.GetDate();
559  packet.Description = calendarEvent.GetDescription();
560  packet.EventID = calendarEvent.GetEventId();
561  packet.EventName = calendarEvent.GetTitle();
562  packet.EventType = sendType;
563  packet.Flags = calendarEvent.GetFlags();
564  packet.GetEventType = calendarEvent.GetType();
565  packet.LockDate = calendarEvent.GetLockDate(); // Always 0 ?
566  packet.OwnerGuid = calendarEvent.GetOwnerGUID();
567  packet.TextureID = calendarEvent.GetTextureId();
568 
569  Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId());
570  packet.EventGuildID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
571 
572  for (auto const& calendarInvite : eventInviteeList)
573  {
574  ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
575  Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);
576 
577  uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
578  ObjectGuid::LowType inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
579 
581  inviteInfo.Guid = inviteeGuid;
582  inviteInfo.Level = inviteeLevel;
583  inviteInfo.Status = calendarInvite->GetStatus();
584  inviteInfo.Moderator = calendarInvite->GetRank();
585  inviteInfo.InviteType = calendarEvent.IsGuildEvent() && calendarEvent.GetGuildId() == inviteeGuildId;
586  inviteInfo.InviteID = calendarInvite->GetInviteId();
587  inviteInfo.ResponseTime = calendarInvite->GetResponseTime();
588  inviteInfo.Notes = calendarInvite->GetNote();
589 
590  packet.Invites.push_back(inviteInfo);
591  }
592 
593  player->SendDirectMessage(packet.Write());
594 }
Definition: CalendarPackets.h:206
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
uint8 EventType
Definition: CalendarPackets.h:233
uint32 Flags
Definition: CalendarPackets.h:230
time_t ResponseTime
Definition: CalendarPackets.h:210
std::vector< CalendarEventInviteInfo > Invites
Definition: CalendarPackets.h:236
#define sGuildMgr
Definition: GuildMgr.h:61
uint8 Level
Definition: CalendarPackets.h:211
uint64 LowType
Definition: ObjectGuid.h:199
ObjectGuid OwnerGuid
Definition: CalendarPackets.h:225
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
uint64 EventID
Definition: CalendarPackets.h:227
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267
std::string Notes
Definition: CalendarPackets.h:215
uint8 GetEventType
Definition: CalendarPackets.h:232
uint8 Moderator
Definition: CalendarPackets.h:213
std::string Description
Definition: CalendarPackets.h:234
uint8 Status
Definition: CalendarPackets.h:212
time_t Date
Definition: CalendarPackets.h:228
ObjectGuid GetGUID() const
Definition: Guild.h:764
ObjectGuid EventGuildID
Definition: CalendarPackets.h:226
time_t LockDate
Definition: CalendarPackets.h:229
ObjectGuid Guid
Definition: CalendarPackets.h:208
uint8 InviteType
Definition: CalendarPackets.h:214
std::string EventName
Definition: CalendarPackets.h:235
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
uint8_t uint8
Definition: Define.h:152
uint64 InviteID
Definition: CalendarPackets.h:209
Definition: ObjectGuid.h:189
Definition: CalendarPackets.h:218
Definition: Guild.h:320
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
int32 TextureID
Definition: CalendarPackets.h:231
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:264

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEventInvite ( CalendarInvite const invite)
428 {
429  CalendarEvent* calendarEvent = GetEvent(invite.GetEventId());
430 
431  ObjectGuid invitee = invite.GetInviteeGUID();
432  Player* player = ObjectAccessor::FindConnectedPlayer(invitee);
433 
434  uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
435 
437  packet.EventID = calendarEvent ? calendarEvent->GetEventId() : 0;
438  packet.InviteGuid = invitee;
439  packet.InviteID = calendarEvent ? invite.GetInviteId() : 0;
440  packet.Level = level;
441  packet.ResponseTime = invite.GetResponseTime();
442  packet.Status = invite.GetStatus();
443  packet.Type = calendarEvent ? calendarEvent->IsGuildEvent() : 0; // Correct ?
444  packet.ClearPending = calendarEvent ? !calendarEvent->IsGuildEvent() : true; // Correct ?
445 
446  if (!calendarEvent) // Pre-invite
447  {
448  if (Player* playerSender = ObjectAccessor::FindConnectedPlayer(invite.GetSenderGUID()))
449  playerSender->SendDirectMessage(packet.Write());
450  }
451  else
452  {
453  if (calendarEvent->GetOwnerGUID() != invite.GetInviteeGUID()) // correct?
454  SendPacketToAllEventRelatives(packet.Write(), *calendarEvent);
455  }
456 }
uint64 InviteID
Definition: CalendarPackets.h:143
time_t ResponseTime
Definition: CalendarPackets.h:144
uint64 EventID
Definition: CalendarPackets.h:147
uint8 Status
Definition: CalendarPackets.h:150
bool ClearPending
Definition: CalendarPackets.h:149
uint64 GetEventId() const
Definition: CalendarMgr.h:219
Definition: CalendarPackets.h:136
Definition: CalendarMgr.h:191
uint8 Level
Definition: CalendarPackets.h:145
uint8 Type
Definition: CalendarPackets.h:148
ObjectGuid InviteGuid
Definition: CalendarPackets.h:146
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:223
CalendarEvent * GetEvent(uint64 eventId) const
Definition: CalendarMgr.cpp:293
void SendPacketToAllEventRelatives(WorldPacket const *packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:639
bool IsGuildEvent() const
Definition: CalendarMgr.h:245
uint8_t uint8
Definition: Define.h:152
Definition: ObjectGuid.h:189
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
ObjectGuid GetOwnerGUID() const
Definition: CalendarMgr.h:222

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEventInviteAlert ( CalendarEvent const calendarEvent,
CalendarInvite const invite 
)
522 {
524  packet.Date = calendarEvent.GetDate();
525  packet.EventID = calendarEvent.GetEventId();
526  packet.EventName = calendarEvent.GetTitle();
527  packet.EventType = calendarEvent.GetType();
528  packet.Flags = calendarEvent.GetFlags();
529  packet.InviteID = invite.GetInviteId();
530  packet.InvitedByGuid = invite.GetSenderGUID();
531  packet.ModeratorStatus = invite.GetRank();
532  packet.OwnerGuid = calendarEvent.GetOwnerGUID();
533  packet.Status = invite.GetStatus();
534  packet.TextureID = calendarEvent.GetTextureId();
535 
536  Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId());
537  packet.EventGuildID = guild ? guild->GetGUID() : ObjectGuid::Empty;
538 
539  if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
540  {
541  if (guild)
542  guild->BroadcastPacket(packet.Write());
543  }
544  else
545  if (Player* player = ObjectAccessor::FindConnectedPlayer(invite.GetInviteeGUID()))
546  player->SendDirectMessage(packet.Write());
547 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
std::string EventName
Definition: CalendarPackets.h:257
#define sGuildMgr
Definition: GuildMgr.h:61
uint8 Status
Definition: CalendarPackets.h:254
uint8 ModeratorStatus
Definition: CalendarPackets.h:256
void BroadcastPacket(WorldPacket const *packet) const
Definition: Guild.cpp:2520
ObjectGuid InvitedByGuid
Definition: CalendarPackets.h:248
time_t Date
Definition: CalendarPackets.h:252
ObjectGuid GetGUID() const
Definition: Guild.h:764
ObjectGuid EventGuildID
Definition: CalendarPackets.h:247
Definition: CalendarPackets.h:239
uint64 InviteID
Definition: CalendarPackets.h:249
uint32 Flags
Definition: CalendarPackets.h:251
ObjectGuid OwnerGuid
Definition: CalendarPackets.h:246
int32 TextureID
Definition: CalendarPackets.h:253
uint8 EventType
Definition: CalendarPackets.h:255
Definition: Guild.h:320
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:290
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
uint64 EventID
Definition: CalendarPackets.h:250

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEventInviteRemove ( CalendarEvent const calendarEvent,
CalendarInvite const invite,
uint32  flags 
)
500 {
502  packet.ClearPending = true; // FIXME
503  packet.EventID = calendarEvent.GetEventId();
504  packet.Flags = flags;
505  packet.InviteGuid = invite.GetInviteeGUID();
506 
507  SendPacketToAllEventRelatives(packet.Write(), calendarEvent);
508 }
bool ClearPending
Definition: CalendarPackets.h:312
uint64 EventID
Definition: CalendarPackets.h:310
ObjectGuid InviteGuid
Definition: CalendarPackets.h:309
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:328
uint32 Flags
Definition: CalendarPackets.h:311
void SendPacketToAllEventRelatives(WorldPacket const *packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:639
uint8 flags
Definition: DisableMgr.cpp:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEventInviteRemoveAlert ( ObjectGuid  guid,
CalendarEvent const calendarEvent,
CalendarInviteStatus  status 
)
597 {
598  if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
599  {
601  packet.Date = calendarEvent.GetDate();
602  packet.EventID = calendarEvent.GetEventId();
603  packet.Flags = calendarEvent.GetFlags();
604  packet.Status = status;
605 
606  player->SendDirectMessage(packet.Write());
607  }
608 }
uint64 EventID
Definition: CalendarPackets.h:335
uint32 Flags
Definition: CalendarPackets.h:337
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:352
time_t Date
Definition: CalendarPackets.h:336
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
uint8 Status
Definition: CalendarPackets.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEventModeratorStatusAlert ( CalendarEvent const calendarEvent,
CalendarInvite const invite 
)
511 {
513  packet.ClearPending = true; // FIXME
514  packet.EventID = calendarEvent.GetEventId();
515  packet.InviteGuid = invite.GetInviteeGUID();
516  packet.Status = invite.GetStatus();
517 
518  SendPacketToAllEventRelatives(packet.Write(), calendarEvent);
519 }
uint8 Status
Definition: CalendarPackets.h:324
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:340
bool ClearPending
Definition: CalendarPackets.h:325
void SendPacketToAllEventRelatives(WorldPacket const *packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:639
ObjectGuid InviteGuid
Definition: CalendarPackets.h:322
uint64 EventID
Definition: CalendarPackets.h:323

+ Here is the call graph for this function:

void CalendarMgr::SendCalendarEventRemovedAlert ( CalendarEvent const calendarEvent)
490 {
492  packet.ClearPending = true; // FIXME
493  packet.Date = calendarEvent.GetDate();
494  packet.EventID = calendarEvent.GetEventId();
495 
496  SendPacketToAllEventRelatives(packet.Write(), calendarEvent);
497 }
bool ClearPending
Definition: CalendarPackets.h:377
Definition: CalendarPackets.h:368
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:384
void SendPacketToAllEventRelatives(WorldPacket const *packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:639
time_t Date
Definition: CalendarPackets.h:376
uint64 EventID
Definition: CalendarPackets.h:375

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::SendCalendarEventStatus ( CalendarEvent const calendarEvent,
CalendarInvite const invite 
)
476 {
478  packet.ClearPending = true; // FIXME
479  packet.Date = calendarEvent.GetDate();
480  packet.EventID = calendarEvent.GetEventId();
481  packet.Flags = calendarEvent.GetFlags();
482  packet.InviteGuid = invite.GetInviteeGUID();
483  packet.ResponseTime = invite.GetResponseTime();
484  packet.Status = invite.GetStatus();
485 
486  SendPacketToAllEventRelatives(packet.Write(), calendarEvent);
487 }
time_t ResponseTime
Definition: CalendarPackets.h:297
bool ClearPending
Definition: CalendarPackets.h:296
time_t Date
Definition: CalendarPackets.h:298
Definition: CalendarPackets.h:286
ObjectGuid InviteGuid
Definition: CalendarPackets.h:299
uint32 Flags
Definition: CalendarPackets.h:293
uint8 Status
Definition: CalendarPackets.h:295
void SendPacketToAllEventRelatives(WorldPacket const *packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:639
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:313
uint64 EventID
Definition: CalendarPackets.h:294

+ Here is the call graph for this function:

void CalendarMgr::SendCalendarEventUpdateAlert ( CalendarEvent const calendarEvent,
time_t  originalDate 
)
459 {
461  packet.ClearPending = true; // FIXME
462  packet.Date = calendarEvent.GetDate();
463  packet.Description = calendarEvent.GetDescription();
464  packet.EventID = calendarEvent.GetEventId();
465  packet.EventName = calendarEvent.GetTitle();
466  packet.EventType = calendarEvent.GetType();
467  packet.Flags = calendarEvent.GetFlags();
468  packet.LockDate = calendarEvent.GetLockDate(); // Always 0 ?
469  packet.OriginalDate = originalDate;
470  packet.TextureID = calendarEvent.GetTextureId();
471 
472  SendPacketToAllEventRelatives(packet.Write(), calendarEvent);
473 }
uint32 Flags
Definition: CalendarPackets.h:358
time_t OriginalDate
Definition: CalendarPackets.h:360
uint64 EventID
Definition: CalendarPackets.h:356
time_t Date
Definition: CalendarPackets.h:357
bool ClearPending
Definition: CalendarPackets.h:363
std::string EventName
Definition: CalendarPackets.h:365
uint8 EventType
Definition: CalendarPackets.h:362
std::string Description
Definition: CalendarPackets.h:364
void SendPacketToAllEventRelatives(WorldPacket const *packet, CalendarEvent const &calendarEvent)
Definition: CalendarMgr.cpp:639
time_t LockDate
Definition: CalendarPackets.h:359
WorldPacket const * Write() override
Definition: CalendarPackets.cpp:362
int32 TextureID
Definition: CalendarPackets.h:361
Definition: CalendarPackets.h:349

+ Here is the call graph for this function:

void CalendarMgr::SendPacketToAllEventRelatives ( WorldPacket const packet,
CalendarEvent const calendarEvent 
)
640 {
641  // Send packet to all guild members
642  if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
643  if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
644  guild->BroadcastPacket(packet);
645 
646  // Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
647  CalendarInviteStore invites = _invites[calendarEvent.GetEventId()];
648  for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr)
649  if (Player* player = ObjectAccessor::FindConnectedPlayer((*itr)->GetInviteeGUID()))
650  if (!calendarEvent.IsGuildEvent() || (calendarEvent.IsGuildEvent() && player->GetGuildId() != calendarEvent.GetGuildId()))
651  player->SendDirectMessage(packet);
652 }
#define sGuildMgr
Definition: GuildMgr.h:61
std::vector< CalendarInvite * > CalendarInviteStore
Definition: CalendarMgr.h:267
CalendarEventInviteStore _invites
Definition: CalendarMgr.h:278
Definition: Guild.h:320
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::UpdateEvent ( CalendarEvent calendarEvent)
235 {
237  stmt->setUInt64(0, calendarEvent->GetEventId());
238  stmt->setUInt64(1, calendarEvent->GetOwnerGUID().GetCounter());
239  stmt->setString(2, calendarEvent->GetTitle());
240  stmt->setString(3, calendarEvent->GetDescription());
241  stmt->setUInt8(4, calendarEvent->GetType());
242  stmt->setInt32(5, calendarEvent->GetTextureId());
243  stmt->setUInt32(6, uint32(calendarEvent->GetDate()));
244  stmt->setUInt32(7, calendarEvent->GetFlags());
245  stmt->setUInt32(8, uint32(calendarEvent->GetLockDate()));
247 }
Definition: CharacterDatabase.h:518
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
std::string GetTitle() const
Definition: CalendarMgr.h:228
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
CalendarEventType GetType() const
Definition: CalendarMgr.h:234
Definition: PreparedStatement.h:74
int32 GetTextureId() const
Definition: CalendarMgr.h:237
uint64 GetEventId() const
Definition: CalendarMgr.h:219
std::string GetDescription() const
Definition: CalendarMgr.h:231
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
time_t GetDate() const
Definition: CalendarMgr.h:240
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32_t uint32
Definition: g3dmath.h:168
time_t GetLockDate() const
Definition: CalendarMgr.h:250
uint32 GetFlags() const
Definition: CalendarMgr.h:243
LowType GetCounter() const
Definition: ObjectGuid.h:221
ObjectGuid GetOwnerGUID() const
Definition: CalendarMgr.h:222

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CalendarMgr::UpdateInvite ( CalendarInvite invite)
250 {
251  SQLTransaction dummy;
252  UpdateInvite(invite, dummy);
253 }
void UpdateInvite(CalendarInvite *invite)
Definition: CalendarMgr.cpp:249
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the caller graph for this function:

void CalendarMgr::UpdateInvite ( CalendarInvite invite,
SQLTransaction trans 
)
256 {
258  stmt->setUInt64(0, invite->GetInviteId());
259  stmt->setUInt64(1, invite->GetEventId());
260  stmt->setUInt64(2, invite->GetInviteeGUID().GetCounter());
261  stmt->setUInt64(3, invite->GetSenderGUID().GetCounter());
262  stmt->setUInt8(4, invite->GetStatus());
263  stmt->setUInt32(5, uint32(invite->GetResponseTime()));
264  stmt->setUInt8(6, invite->GetRank());
265  stmt->setString(7, invite->GetNote());
266  CharacterDatabase.ExecuteOrAppend(trans, stmt);
267 }
Definition: CharacterDatabase.h:520
ObjectGuid GetInviteeGUID() const
Definition: CalendarMgr.h:166
void ExecuteOrAppend(SQLTransaction &trans, PreparedStatement *stmt)
Definition: DatabaseWorkerPool.h:236
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: PreparedStatement.h:74
time_t GetResponseTime() const
Definition: CalendarMgr.h:169
std::string GetNote() const
Definition: CalendarMgr.h:172
uint64 GetInviteId() const
Definition: CalendarMgr.h:157
uint64 GetEventId() const
Definition: CalendarMgr.h:160
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid GetSenderGUID() const
Definition: CalendarMgr.h:163
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32_t uint32
Definition: g3dmath.h:168
CalendarInviteStatus GetStatus() const
Definition: CalendarMgr.h:175
CalendarModerationRank GetRank() const
Definition: CalendarMgr.h:178
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

Member Data Documentation

CalendarEventStore CalendarMgr::_events
private
std::deque<uint64> CalendarMgr::_freeEventIds
private
std::deque<uint64> CalendarMgr::_freeInviteIds
private
CalendarEventInviteStore CalendarMgr::_invites
private
uint64 CalendarMgr::_maxEventId
private
uint64 CalendarMgr::_maxInviteId
private

The documentation for this class was generated from the following files: