diff options
| author | Teddy Wing | 2021-05-22 02:26:20 +0200 |
|---|---|---|
| committer | Teddy Wing | 2021-05-22 02:26:20 +0200 |
| commit | c2525d8e9b9bb671ce855c20f644c43e71e1e7ef (patch) | |
| tree | 2cc626be7fa43cd62380fa4d9951e1793941a662 /src | |
| parent | 65aa6027a76a65d021a5833322b5d33143933202 (diff) | |
| download | google-calendar-rsvp-c2525d8e9b9bb671ce855c20f644c43e71e1e7ef.tar.bz2 | |
Try to get user email from Eid
Tried getting the email from the base64-encoded eid string. Turns out,
though, that the email address in the eid:
1. isn't complete (it's missing the last one or two characters of the
email address as far as I can tell)
2. is not the invitee's email address, it's the organiser's email
address
For both of these reasons (particularly (2)), it looks like we can't
actually use this method and will need to make the Event.get request
after all.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index 18ce4fe..8200b3f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,22 +117,26 @@ async fn rsvp(eid: &Eid, response: &EventResponseStatus) { auth, ); - let result = hub.events() - .get("primary", &eid.event_id) - .doit() - .await - .unwrap(); - let mut event = Event::default(); let mut attendee = EventAttendee::default(); - if let Some(attendees) = result.1.attendees { - for a in &attendees { - if let Some(is_me) = a.self_ { - if is_me { - attendee.email = a.email.clone(); - - break; + if let Some(email) = &eid.email { + attendee.email = Some(email.to_owned()); + } else { + let result = hub.events() + .get("primary", &eid.event_id) + .doit() + .await + .unwrap(); + + if let Some(attendees) = result.1.attendees { + for a in &attendees { + if let Some(is_me) = a.self_ { + if is_me { + attendee.email = a.email.clone(); + + break; + } } } } |
