From c2525d8e9b9bb671ce855c20f644c43e71e1e7ef Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 22 May 2021 02:26:20 +0200 Subject: 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. --- src/main.rs | 30 +++++++++++++++++------------- 1 file 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; + } } } } -- cgit v1.2.3