Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do something on calendar put event #84

Open
f1-outsourcing opened this issue Jun 2, 2024 · 4 comments
Open

do something on calendar put event #84

f1-outsourcing opened this issue Jun 2, 2024 · 4 comments

Comments

@f1-outsourcing
Copy link

I am not really sure if I describe this correctly. Say a user is putting a new calendar item into their calendar with the subject "exportthiseventtodisk", how do I go about checking this efficiently, when these calendar items are received by the server so in the case of this example, copy the item to disk?

Should I analyse content when it is being received or are there 'things' in cosmo I can use to trigger the save action? I would expect these cases of having the subject "exportthiseventtodisk" to be very rare. Maybe 1 in 5000 or even less.

 BEGIN:VCALENDAR
 PRODID:-//xyz Corp//NONSGML PDA Calendar Version 1.0//EN
 VERSION:2.0
 BEGIN:VEVENT
 DTSTAMP:19960704T120000Z
 UID:[email protected]
 ORGANIZER:mailto:[email protected]
 DTSTART:19960918T143000Z
 DTEND:19960920T220000Z
 STATUS:CONFIRMED
 CATEGORIES:CONFERENCE
 SUMMARY:exportthiseventtodisk
 DESCRIPTION:Networld+Interop Conference
   and Exhibit\nAtlanta World Congress Center\n
  Atlanta\, Georgia
 END:VEVENT
 END:VCALENDAR
@f1-outsourcing
Copy link
Author

Hi @danielgrigore Daniel We implemented incomong event interception via EventAddHandler. We intercept it in beforeAdd. The wveint is successfully intercepted - we can see it in log. But when we try to update the description of event - it does not change. Why? Or is this successfully changed in the server, but just not synced to the client?

    public boolean handleCalendarEvent(CollectionItem collection, ContentItem item) {
        // Get event
        EventStamp eventStamp = StampUtils.getEventStamp(item);
        VEvent masterEvent = eventStamp.getMasterEvent();
        if (isValidManagementEvent(masterEvent)) {
            boolean success = processEvent(masterEvent);
            if (success) {
                // TODO
                item.addStamp(eventStamp);
            }
            return success;
        } else {
            return false;
        }
    }

    private boolean processEvent(VEvent event) {
        // Based on the event's SUMMARY, process the management command
        String summary = event.getSummary().getValue().trim();
        switch (summary) {
            case COMMAND:
                // Process sharing read permissions
                LOG.info("Processing event");
                java.util.Calendar calendar = java.util.Calendar.getInstance();
                SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
                try {
                    event.getProperty(Property.DESCRIPTION).setValue("======= update (" + format.format(calendar.getTime()) + ") =======");
                } catch (Exception e) {
                    LOG.error(e.toString());
                    return false;
                }
                break;

@f1-outsourcing
Copy link
Author

@danielgrigore Hi Daniel, can you help a bit with this please. A link to this documentation would also be great.

@f1-outsourcing
Copy link
Author

@cosminh11 Hi Cosmin I saw you committed a bit here, do you know to intercept there events?

@f1-outsourcing
Copy link
Author

@danielgrigore Can you assist in any way? I have a developer who is stuck here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant