aboutsummaryrefslogtreecommitdiffstats
path: root/lib/structure_helpers.go
Commit message (Collapse)AuthorAgeFilesLines
* lib: introduce FindMIMEPart, adapt Find{Plain,Calendar}textSebastien Binet2023-12-301-15/+10
| | | | | | | | | | introduce a general FindMIMEPart function to find a message part with the given MIME type. reimplement FindPlaintext and FindCalendartext in terms of this new FindMIMEPart function. Signed-off-by: Sebastien Binet <s@sbinet.org> Acked-by: Robin Jarry <robin@jarry.cc>
* msgpart: factorize mime type and filename constructionRobin Jarry2022-10-161-4/+2
| | | | | | | Reduce code duplication. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-041-4/+4
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lib: fix tests for 386 platformsKoni Marti2022-07-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests in lib/structure_helpers_test.go pass on amd64 platforms but fail on 386 platforms. This can be reproduced with the following steps: 1. Create a Dockerfile in aerc's source folder: FROM i386/alpine:edge RUN apk update && apk upgrade RUN apk add --no-cache go make scdoc WORKDIR aerc COPY . . RUN make CMD make tests 2. Build the image: $ docker buildx build --platform=linux/386 -t test . 3. Run the image: $ docker run --rm --platform=linux/386 -it test The test in lib/structure_helpers_test.go will fail. If the same above steps are done with this patch applied, all tests pass. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* forward: provide option to append all attachmentsKoni Marti2022-07-021-0/+27
| | | | | | | | | Append all non-multipart attachments with the -A flag. Rename the flag for forwarding a full message as an RFC2822 attachments to -F. Suggested-by: psykose Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* invites: reply with accept, accept-tentative or declineKoni Marti2022-05-311-0/+16
| | | | | | | | | | 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>
* go.mod: change base git urlRobin Jarry2021-11-051-1/+1
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* FindFirstNonMultipart: return the proper pathReto Brunner2021-03-071-1/+1
| | | | There was a bug that lead to the wrong path being returned by the function.
* Remove hard coded bodystruct path everywhereReto Brunner2020-07-271-0/+38
Aerc usually used the path []int{1} if it didn't know what the proper path is. However this only works for multipart messages and breaks if it isn't one. This patch removes all the hard coding and extracts the necessary helpers to lib.