当前位置: 首页>>代码示例>>C++>>正文


C++ CalendarEvent类代码示例

本文整理汇总了C++中CalendarEvent的典型用法代码示例。如果您正苦于以下问题:C++ CalendarEvent类的具体用法?C++ CalendarEvent怎么用?C++ CalendarEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CalendarEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetEvent

void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
{
    CalendarEvent* calendarEvent = GetEvent(eventId);

    if (!calendarEvent)
    {
        SendCalendarCommandResult(remover, CALENDAR_ERROR_EVENT_INVALID);
        return;
    }

    SendCalendarEventRemovedAlert(*calendarEvent);

    SQLTransaction trans = CharacterDatabase.BeginTransaction();
    PreparedStatement* stmt;
    MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());

    CalendarInviteStore& eventInvites = _invites[eventId];
    for (size_t i = 0; i < eventInvites.size(); ++i)
    {
        CalendarInvite* invite = eventInvites[i];
        stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
        stmt->setUInt64(0, invite->GetInviteId());
        trans->Append(stmt);

        // guild events only? check invite status here?
        // When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
        if (remover && invite->GetInviteeGUID() != remover)
            mail.SendMailTo(trans, MailReceiver(invite->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);

        delete invite;
    }

    _invites.erase(eventId);

    stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_EVENT);
    stmt->setUInt64(0, eventId);
    trans->Append(stmt);
    CharacterDatabase.CommitTransaction(trans);

    delete calendarEvent;
    _events.erase(calendarEvent);
}
开发者ID:boom8866,项目名称:new,代码行数:42,代码来源:CalendarMgr.cpp

示例2: TC_LOG_DEBUG

void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
{
    ObjectGuid guid = _player->GetGUID();
    uint64 eventId;
    uint64 inviteId;
    uint32 eventTime;

    recvData >> eventId >> inviteId;
    recvData.ReadPackedTime(eventTime);
    TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [%s], EventId [" UI64FMTD
        "] inviteId [" UI64FMTD "] Time: %u", guid.ToString().c_str(), eventId, inviteId, eventTime);

    // prevent events in the past
    // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
    if (time_t(eventTime) < (time(NULL) - time_t(86400L)))
    {
        recvData.rfinish();
        return;
    }

    if (CalendarEvent* oldEvent = sCalendarMgr->GetEvent(eventId))
    {
        CalendarEvent* newEvent = new CalendarEvent(*oldEvent, sCalendarMgr->GetFreeEventId());
        newEvent->SetEventTime(time_t(eventTime));
        sCalendarMgr->AddEvent(newEvent, CALENDAR_SENDTYPE_COPY);

        CalendarInviteStore invites = sCalendarMgr->GetEventInvites(eventId);
        SQLTransaction trans;
        if (invites.size() > 1)
            trans = CharacterDatabase.BeginTransaction();

        for (CalendarInviteStore::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
            sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId()), trans);

        if (invites.size() > 1)
            CharacterDatabase.CommitTransaction(trans);
        // should we change owner when somebody makes a copy of event owned by another person?
    }
    else
        sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
开发者ID:mysql1,项目名称:TournamentCore,代码行数:41,代码来源:CalendarHandler.cpp

示例3: AddEvent

bool CalendarMgr::AddEvent(CalendarEvent const& newEvent)
{
    uint64 eventId = newEvent.GetEventId();
    if (_events.find(eventId) != _events.end())
    {
        sLog->outError("CalendarMgr::addEvent: Event [" UI64FMTD "] exists", eventId);
        return false;
    }

    _events[eventId] = newEvent;
    return true;
}
开发者ID:scymex,项目名称:TrinityCore,代码行数:12,代码来源:CalendarMgr.cpp

示例4: while

// remove all events and invite of player related to a specific guild
// used when player quit a guild
void CalendarMgr::RemoveGuildCalendar(ObjectGuid const& playerGuid, uint32 GuildId)
{
    CalendarEventStore::iterator itr = m_EventStore.begin();

    while (itr != m_EventStore.end())
    {
        CalendarEvent* event = &itr->second;
        if (event->CreatorGuid == playerGuid && (event->IsGuildEvent() || event->IsGuildAnnouncement()))
        {
            // all invite will be automaticaly deleted
            m_EventStore.erase(itr++);
            // itr already incremented so go recheck event owner
            continue;
        }

        // event not owned by playerGuid but an guild invite can still be found
        if (event->GuildId != GuildId || !(event->IsGuildEvent() || event->IsGuildAnnouncement()))
        {
            ++itr;
            continue;
        }

        event->RemoveInviteByGuid(playerGuid);
        ++itr;
    }
}
开发者ID:OrAlien,项目名称:server,代码行数:28,代码来源:Calendar.cpp

示例5: foreach

	// Iterate over the list of events
	foreach (const CalendarEvent &event, events2) {
		// Copy the data into a model entry
		QVariantMap entry;
		entry["myType"] = QVariant(trUtf8("tomorrow"));
		entry["eventId"] = event.id();
		entry["accountId"] = event.accountId();
		entry["subject"] = event.subject().replace('&', "&amp;").replace('<', "&lt;").replace('>', "&gt;").replace('"', "&quot;");
		entry["order"] = order++;
		entry["startTime"] = event.startTime();
		entry["endTime"] = event.endTime();
		entry["timeString"] = "";
		entry["account"] = event.accountId();

		std::stringstream keyStream;
		keyStream << event.accountId() << event.folderId();
		std::string key = keyStream.str();
		entry["color24"] = QString::number(accountColor[key], 16);

		qDebug() << "FMI ######### key:" <<  QString::fromStdString(key) << "=" << accountColor[key];
		qDebug() << "FMI #########    id:" << event.id() << " subject" << event.subject() << " startTime:" << event.startTime().toString(Qt::DefaultLocaleShortDate);
		entries.append(entry);
	}
开发者ID:Jendorski,项目名称:WeekViewer,代码行数:23,代码来源:customgroupmodel.cpp

示例6: GetPlayerInvitesList

// fill all player invites in provided CalendarInvitesList
void CalendarMgr::GetPlayerInvitesList(ObjectGuid const& guid, CalendarInvitesList& calInvList)
{
    for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
    {
        CalendarEvent* event = &itr->second;

        if (event->IsGuildAnnouncement())
            continue;

        CalendarInviteMap const* cInvMap = event->GetInviteMap();
        CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
        while (ci_itr != cInvMap->end())
        {
            if (ci_itr->second->InviteeGuid == guid)
            {
                calInvList.push_back(ci_itr->second);
                break;
            }
            ++ci_itr;
        }
    }
}
开发者ID:OrAlien,项目名称:server,代码行数:23,代码来源:Calendar.cpp

示例7: GetEvent

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;
}
开发者ID:Remix99,项目名称:ArkCoreRemix,代码行数:39,代码来源:CalendarMgr.cpp

示例8: SendCalendarEventUpdateAlert

void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime)
{
    WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 +
        calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
    data << uint8(1);       // unk
    data << uint64(calendarEvent.GetEventId());
    data.AppendPackedTime(oldEventTime);
    data << uint32(calendarEvent.GetFlags());
    data.AppendPackedTime(calendarEvent.GetEventTime());
    data << uint8(calendarEvent.GetType());
    data << int32(calendarEvent.GetDungeonId());
    data << calendarEvent.GetTitle();
    data << calendarEvent.GetDescription();
    data << uint8(CALENDAR_REPEAT_NEVER);   // repeatable
    data << uint32(CALENDAR_MAX_INVITES);
    data << uint32(0);      // unk

    SendPacketToAllEventRelatives(data, calendarEvent);
}
开发者ID:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:19,代码来源:CalendarMgr.cpp

示例9: CanAddInviteTo

// check if an invitee have not reached invite limit
bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
{
    uint32 totalInvites = 0;

    for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
    {
        CalendarEvent* event = &itr->second;

        if (event->IsGuildAnnouncement())
            continue;

        CalendarInviteMap const* cInvMap = event->GetInviteMap();
        CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
        while (ci_itr != cInvMap->end())
        {
            if ((ci_itr->second->InviteeGuid == guid) && (++totalInvites >= CALENDAR_MAX_INVITES))
                return false;
            ++ci_itr;
        }
    }

    return true;
}
开发者ID:OrAlien,项目名称:server,代码行数:24,代码来源:Calendar.cpp

示例10: SendCalendarEventInviteAlert

void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
    WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
    data << uint64(calendarEvent.GetEventId());
    data << calendarEvent.GetTitle();
    data.AppendPackedTime(calendarEvent.GetEventTime());
    data << uint32(calendarEvent.GetFlags());
    data << uint32(calendarEvent.GetType());
    data << int32(calendarEvent.GetDungeonId());
    data << uint64(invite.GetInviteId());
    data << uint8(invite.GetStatus());
    data << uint8(invite.GetRank());
    data << calendarEvent.GetCreatorGUID().WriteAsPacked();
    data << invite.GetSenderGUID().WriteAsPacked();

    if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
    {
        if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
            guild->BroadcastPacket(&data);
    }
    else
        if (Player* player = ObjectAccessor::FindConnectedPlayer(invite.GetInviteeGUID()))
            player->SendDirectMessage(&data);
}
开发者ID:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:24,代码来源:CalendarMgr.cpp

示例11: CalendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
    uint64 guid = _player->GetGUID();

    std::string title;
    std::string description;
    uint8 type;
    uint8 repeatable;
    uint32 maxInvites;
    int32 dungeonId;
    uint32 eventPackedTime;
    uint32 unkPackedTime;
    uint32 flags;

    recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId;
    recvData.ReadPackedTime(eventPackedTime);
    recvData.ReadPackedTime(unkPackedTime);
    recvData >> flags;

    CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
        time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);

    if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent->SetGuildId(creator->GetGuildId());

    if (calendarEvent->IsGuildAnnouncement())
    {
        // 946684800 is 01/01/2000 00:00:00 - default response time
        CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        sCalendarMgr->AddInvite(calendarEvent, invite);
    }
    else
    {
        uint32 inviteCount;
        recvData >> inviteCount;

        for (uint32 i = 0; i < inviteCount; ++i)
        {
            uint64 invitee = 0;
            uint8 status = 0;
            uint8 rank = 0;
            recvData.readPackGUID(invitee);
            recvData >> status >> rank;

            // 946684800 is 01/01/2000 00:00:00 - default response time
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
            sCalendarMgr->AddInvite(calendarEvent, invite);
        }
    }

    sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
开发者ID:Caydan,项目名称:DeathCore,代码行数:53,代码来源:CalendarHandler.cpp

示例12: SendPacketToAllEventRelatives

void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket& packet, CalendarEvent const& calendarEvent)
{
    // Send packet to all guild members
    if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
        if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
            guild->BroadcastPacket(&packet);

    // Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
    CalendarInviteStore invites = _invites[calendarEvent.GetEventId()];
    for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr)
        if (Player* player = ObjectAccessor::FindConnectedPlayer((*itr)->GetInviteeGUID()))
            if (!calendarEvent.IsGuildEvent() || player->GetGuildId() != calendarEvent.GetGuildId())
                player->SendDirectMessage(&packet);
}
开发者ID:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:14,代码来源:CalendarMgr.cpp

示例13: CalendarEvent

void WorldSession::HandleCalendarAddEvent(WorldPackets::Calendar::CalendarAddEvent& calendarAddEvent)
{
    ObjectGuid guid = _player->GetGUID();

    // prevent events in the past
    // To Do: properly handle timezones and remove the "- time_t(86400L)" hack
    if (calendarAddEvent.EventInfo.Time < (time(NULL) - time_t(86400L)))
        return;

    CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, UI64LIT(0), CalendarEventType(calendarAddEvent.EventInfo.EventType), calendarAddEvent.EventInfo.TextureID,
        calendarAddEvent.EventInfo.Time, calendarAddEvent.EventInfo.Flags, calendarAddEvent.EventInfo.Title, calendarAddEvent.EventInfo.Description, time_t(0));

    if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
        if (Player* creator = ObjectAccessor::FindPlayer(guid))
            calendarEvent->SetGuildId(creator->GetGuildId());

    if (calendarEvent->IsGuildAnnouncement())
    {
        CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, CALENDAR_DEFAULT_RESPONSE_TIME, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
        // WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
        // of storage of the pointer as it will lead to memory corruption
        sCalendarMgr->AddInvite(calendarEvent, &invite);
    }
    else
    {
        SQLTransaction trans;
        if (calendarAddEvent.EventInfo.Invites.size() > 1)
            trans = CharacterDatabase.BeginTransaction();

        for (uint32 i = 0; i < calendarAddEvent.EventInfo.Invites.size(); ++i)
        {
            CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), calendarAddEvent.EventInfo.Invites[i].Guid,
                guid, CALENDAR_DEFAULT_RESPONSE_TIME, CalendarInviteStatus(calendarAddEvent.EventInfo.Invites[i].Status),
                CalendarModerationRank(calendarAddEvent.EventInfo.Invites[i].Moderator), "");
            sCalendarMgr->AddInvite(calendarEvent, invite, trans);
        }

        if (calendarAddEvent.EventInfo.Invites.size() > 1)
            CharacterDatabase.CommitTransaction(trans);
    }

    sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
开发者ID:beyourself,项目名称:DeathCore_6.x,代码行数:43,代码来源:CalendarHandler.cpp

示例14: loadEvent

//! [2]
void EventEditor::loadEvent(const EventKey &eventKey)
{
    m_eventKey = eventKey;

    // Load the event from the persistent storage
    const CalendarEvent event = m_calendarService->event(m_eventKey.accountId(), m_eventKey.eventId());

    // Update the properties with the data from the event
    m_subject = event.subject();
    m_location = event.location();
    m_startTime = event.startTime();
    m_endTime = event.endTime();
    m_folderId = event.folderId();
    m_accountId = event.accountId();

    // Emit the change notifications
    emit subjectChanged();
    emit locationChanged();
    emit startTimeChanged();
    emit endTimeChanged();
    emit folderIdChanged();
    emit accountIdChanged();
}
开发者ID:13natty,项目名称:Cascades-Samples,代码行数:24,代码来源:EventEditor.cpp

示例15: SendCalendarEvent

void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
{
    Player* player = ObjectAccessor::FindConnectedPlayer(guid);
    if (!player)
        return;

    CalendarInviteStore const& eventInviteeList = _invites[calendarEvent.GetEventId()];

    WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
    data << uint8(sendType);
    data << calendarEvent.GetCreatorGUID().WriteAsPacked();
    data << uint64(calendarEvent.GetEventId());
    data << calendarEvent.GetTitle();
    data << calendarEvent.GetDescription();
    data << uint8(calendarEvent.GetType());
    data << uint8(CALENDAR_REPEAT_NEVER);   // repeatable
    data << uint32(CALENDAR_MAX_INVITES);
    data << int32(calendarEvent.GetDungeonId());
    data << uint32(calendarEvent.GetFlags());
    data.AppendPackedTime(calendarEvent.GetEventTime());
    data.AppendPackedTime(calendarEvent.GetTimeZoneTime());
    data << uint32(calendarEvent.GetGuildId());

    data << uint32(eventInviteeList.size());
    for (CalendarInviteStore::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
    {
        CalendarInvite const* calendarInvite = (*itr);
        ObjectGuid inviteeGuid = calendarInvite->GetInviteeGUID();
        Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);

        uint8 inviteeLevel = invitee ? invitee->getLevel() : sCharacterCache->GetCharacterLevelByGuid(inviteeGuid);
        ObjectGuid::LowType inviteeGuildId = invitee ? invitee->GetGuildId() : sCharacterCache->GetCharacterGuildIdByGuid(inviteeGuid);

        data << inviteeGuid.WriteAsPacked();
        data << uint8(inviteeLevel);
        data << uint8(calendarInvite->GetStatus());
        data << uint8(calendarInvite->GetRank());
        data << uint8(calendarEvent.IsGuildEvent() && calendarEvent.GetGuildId() == inviteeGuildId);
        data << uint64(calendarInvite->GetInviteId());
        data.AppendPackedTime(calendarInvite->GetStatusTime());
        data << calendarInvite->GetText();
    }

    player->SendDirectMessage(&data);
}
开发者ID:ElunaLuaEngine,项目名称:ElunaTrinityWotlk,代码行数:45,代码来源:CalendarMgr.cpp


注:本文中的CalendarEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。