aboutsummaryrefslogtreecommitdiffstats
path: root/lib/structure_helpers.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-05-24 07:36:07 +0200
committerRobin Jarry <robin@jarry.cc>2022-05-31 14:32:24 +0200
commit62982a9a679e667b7a1b0e7be1adfa3561c7eac4 (patch)
treec107063eed0bb5ff6d8e7217d6a9c3e44b625c51 /lib/structure_helpers.go
parent6f5c6e148f08266e92875e813105997317bc212b (diff)
downloadaerc-62982a9a679e667b7a1b0e7be1adfa3561c7eac4.tar.gz
invites: reply with accept, accept-tentative or decline
Reply to iCalendar invitations with three commands: :accept, :accept-tentative or :decline. Parse a text/calendar request, create a reply and append it to the composer. Suggested-by: Ondřej Synáček <ondrej@synacek.org> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/structure_helpers.go')
-rw-r--r--lib/structure_helpers.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/structure_helpers.go b/lib/structure_helpers.go
index 95719dd7..ac6950af 100644
--- a/lib/structure_helpers.go
+++ b/lib/structure_helpers.go
@@ -22,6 +22,22 @@ func FindPlaintext(bs *models.BodyStructure, path []int) []int {
return nil
}
+func FindCalendartext(bs *models.BodyStructure, path []int) []int {
+ for i, part := range bs.Parts {
+ cur := append(path, i+1)
+ if strings.ToLower(part.MIMEType) == "text" &&
+ strings.ToLower(part.MIMESubType) == "calendar" {
+ return cur
+ }
+ if strings.ToLower(part.MIMEType) == "multipart" {
+ if path := FindCalendartext(part, cur); path != nil {
+ return path
+ }
+ }
+ }
+ return nil
+}
+
func FindFirstNonMultipart(bs *models.BodyStructure, path []int) []int {
for i, part := range bs.Parts {
cur := append(path, i+1)