summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2022-06-29 09:34:39 +0200
committercos <cos>2022-07-22 08:06:01 +0200
commit958a5eb7221705f07d9d831f7f6f5836e8718a24 (patch)
tree8e15eeeae54febed1d731b88a1051bc4fdebd3c6
parent46e9845f4fa8c9d4dd790b5241b09072dd0e9761 (diff)
downloadcph.rs-958a5eb7221705f07d9d831f7f6f5836e8718a24.zip
Make the ics an actual scheduling request
-rw-r--r--_invitation-mailer/src/main.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/_invitation-mailer/src/main.rs b/_invitation-mailer/src/main.rs
index cf1a271..369d6fe 100644
--- a/_invitation-mailer/src/main.rs
+++ b/_invitation-mailer/src/main.rs
@@ -15,11 +15,14 @@ use {
escape_text,
Event,
ICalendar,
+ components::Parameter,
properties::{
+ Attendee,
Description,
DtEnd,
DtStart,
Location,
+ Method,
Organizer,
Summary,
},
@@ -150,19 +153,27 @@ impl HackNight {
Ok(HackNight::new(title, desc, start, end, location))
}
- fn ics<'a>(&'a self, organizer: &str) -> Result<ICalendar<'a>> {
+ fn ics<'a>(&'a self, input: &Input) -> Result<ICalendar<'a>> {
let mut calendar = ICalendar::new("2.0", "-//cph.rs//Hack Night inviter//EN");
+ calendar.push(Method::new("REQUEST"));
let uuid = Uuid::new_v4().to_string();
let timestamp = to_iso8601(Local::now());
let mut event = Event::new(uuid, timestamp);
- event.push(Organizer::new(format!("mailto:{organizer}")));
+ let mut attendee = Attendee::new(format!("mailto:{}",
+ input.recipient_email));
+ attendee.add(Parameter::new("RSVP", "TRUE"));
+ attendee.add(Parameter::new("CUTYPE", "GROUP"));
+ attendee.add(Parameter::new("CN", input.recipient_name.clone()));
+
+ event.push(Organizer::new(format!("mailto:{}", input.organizer_email)));
event.push(DtStart::new(to_iso8601(self.start)));
event.push(DtEnd::new(to_iso8601(self.end)));
event.push(Summary::new(format!("Rust {}", self.title)));
event.push(Location::new(self.location.clone()));
event.push(Description::new(escape_text(self.desc.plain.clone())));
+ event.push(attendee);
calendar.add_event(event);
@@ -261,7 +272,7 @@ fn main() -> Result<()> {
let hacknight = HackNight::from_html(&matches.opt_str("jekyll-input-file")
.unwrap_or_else(|| String::from("../index.html")))?;
- let calendar = hacknight.ics(&input.organizer_email)?;
+ let calendar = hacknight.ics(&input)?;
let body = hacknight.mail_body(&input)?;
let email = hacknight.mime_message(&input, &body, &calendar)?;