insanum/gcalcli — pull request #35 by tresni (2012-12-22 22:30:05+00:00)
Title: Add organizer and attendees

Fix for #27 . I've tested this using the following ICS:

{{{
BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Romance Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
ORGANIZER;CN="Hansen, Sune":MAILTO:Sune.Hansen@acme.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=tnielse3@csc.com:MAILTO:tnielse3@acme.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Kent Michaelsen (kmichaelsen@acme.com):MAILTO:kmichaelsen@acme.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="Costa, Jorge":MAILTO:Jorge.Costa@acme.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:mholden6@acme.com
DESCRIPTION;LANGUAGE=en-US:All\,\n\nThis is a Placeholder for next week’s TOI –\nWebex and Con Call details will follow.\n\n/Sune\n\n
SUMMARY;LANGUAGE=en-US:SnapCreator TOI
DTSTART;TZID=Romance Standard Time:20121024T113000
DTEND;TZID=Romance Standard Time:20121024T133000
UID:040000008200E00074C5B7101A82E00800000000E082784ADAADCD0100000000000000001000000078F78DCB98419F4889FE6A4B96A6DAF2
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20121019T071532Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
LOCATION;LANGUAGE=en-US:Webex and Con Call
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-OWNERAPPTID:2104731612
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DISALLOW-COUNTER:FALSE
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT15M
END:VALARM
END:VEVENT
END:VCALENDAR
}}}

I've removed the `CN` from one attendee. Format requires that a `MAILTO:` in the `ATTENDEE`, but we check and only strip if it's actually there. Roles are not currently used, but could be added, same goes for status.

Interesting side note: Using `event.organizer` always leads to a Redirect error. Might be because this is using the deprecated 2.0 GData libraries instead of the 3.0 API. I'll probably look at what it will take to move the new API.