本文整理汇总了C++中CalendarEvent::HasInvite方法的典型用法代码示例。如果您正苦于以下问题:C++ CalendarEvent::HasInvite方法的具体用法?C++ CalendarEvent::HasInvite怎么用?C++ CalendarEvent::HasInvite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CalendarEvent
的用法示例。
在下文中一共展示了CalendarEvent::HasInvite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckPermisions
CalendarEvent* CalendarMgr::CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank)
{
if (!player)
return NULL; // CALENDAR_ERROR_INTERNAL
CalendarEvent* calendarEvent = GetEvent(eventId);
if (!calendarEvent)
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_EVENT_INVALID);
return NULL;
}
CalendarInvite* invite = GetInvite(inviteId);
if (!invite)
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NO_INVITE);
return NULL;
}
if (!calendarEvent->HasInvite(inviteId))
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NOT_INVITED);
return NULL;
}
if (invite->GetEventId() != calendarEvent->GetEventId() || invite->GetInvitee() != player->GetGUID())
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_INTERNAL);
return NULL;
}
if (invite->GetRank() < minRank)
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_PERMISSIONS);
return NULL;
}
return calendarEvent;
}
示例2: AddAction
//.........这里部分代码省略.........
calendarEvent->AddInvite(action.Invite.GetInviteId());
SendCalendarEventInvite(action.Invite, (!(calendarEvent->GetFlags() & CALENDAR_FLAG_INVITES_LOCKED) &&
!action.Invite.GetStatusTime()));
SendCalendarEventInviteAlert(*calendarEvent, action.Invite);
}
break;
}
case CALENDAR_ACTION_SIGNUP_TO_EVENT:
{
uint64 eventId = action.Event.GetEventId();
CalendarEvent* calendarEvent = GetEvent(eventId);
CheckPermisions(eventId,
action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent || !(calendarEvent->GetFlags() & CALENDAR_FLAG_GUILD_ONLY)
|| !calendarEvent->GetGuildId() || calendarEvent->GetGuildId() != action.GetExtraData())
return;
uint8 status = action.Invite.GetStatus();
if (status == CALENDAR_STATUS_INVITED)
status = CALENDAR_STATUS_CONFIRMED;
else if (status == CALENDAR_STATUS_ACCEPTED)
status = CALENDAR_STATUS_8;
CalendarInvite newInvite(GetFreeInviteId());
newInvite.SetStatus(status);
newInvite.SetStatusTime(uint32(time(NULL)));
newInvite.SetEventId(eventId);
newInvite.SetInvitee(action.GetGUID());
newInvite.SetSenderGUID(action.GetGUID());
if (AddInvite(newInvite))
SendCalendarEventInvite(newInvite, false);
break;
}
case CALENDAR_ACTION_MODIFY_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
uint64 inviteId = action.Invite.GetInviteId();
CalendarEvent* calendarEvent;
if (action.GetInviteId() != action.Invite.GetInviteId())
calendarEvent = CheckPermisions(eventId, action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
else
calendarEvent = GetEvent(eventId);
CalendarInvite* invite = GetInvite(inviteId);
if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId))
return;
invite->SetStatus(action.Invite.GetStatus());
SendCalendarEventStatus(invite->GetSenderGUID(), *calendarEvent, *invite);
break;
}
case CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
uint64 inviteId = action.Invite.GetInviteId();
CalendarEvent* calendarEvent;
if (action.GetInviteId() != action.Invite.GetInviteId())
calendarEvent = CheckPermisions(eventId, action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_OWNER);
else
calendarEvent = GetEvent(eventId);
CalendarInvite* invite = GetInvite(inviteId);
if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId))
return;
sLog->outError("SPP: CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE: All OK");
invite->SetStatus(action.Invite.GetStatus());
SendCalendarEventModeratorStatusAlert(*invite);
break;
}
case CALENDAR_ACTION_REMOVE_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
uint64 inviteId = action.Invite.GetInviteId();
CalendarEvent* calendarEvent = CheckPermisions(eventId,
action.GetGUID(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent)
return;
if (uint64 invitee = RemoveInvite(inviteId))
{
SendCalendarEventInviteRemoveAlert(invitee, *calendarEvent, CALENDAR_STATUS_9);
SendCalendarEventInviteRemove(action.GetGUID(), action.Invite, calendarEvent->GetFlags());
}
break;
}
default:
break;
}
}