aboutsummaryrefslogtreecommitdiffstats
path: root/lib/structure_helpers.go
diff options
context:
space:
mode:
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)