about summary refs log tree commit diff stats
path: root/commands/msg/reply.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-05-17 12:09:34 +0200
committerReto Brunner <reto@labrat.space>2020-05-17 12:15:50 +0200
commitd48ea6231c76fbfff334be647c8c4d05bf9de387 (patch)
tree0ccd12d3cd190407a0918171baf6dac2945316e8 /commands/msg/reply.go
parentcff4476f3bb61510acefd567deb39f58351de215 (diff)
downloadaerc-d48ea6231c76fbfff334be647c8c4d05bf9de387.tar.gz
Move findPlaintext / findFirstNonMultipart to utils
They are used by more than one command and as such need to be in a common file.
Diffstat (limited to 'commands/msg/reply.go')
-rw-r--r--commands/msg/reply.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index e4c4577..762c15e 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -196,34 +196,3 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 		return addTab()
 	}
 }
-
-func findPlaintext(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) == "plain" {
-			return cur
-		}
-		if strings.ToLower(part.MIMEType) == "multipart" {
-			if path := findPlaintext(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)
-		mimetype := strings.ToLower(part.MIMEType)
-		if mimetype != "multipart" {
-			return path
-		} else if mimetype == "multipart" {
-			if path := findPlaintext(part, cur); path != nil {
-				return path
-			}
-		}
-	}
-	return nil
-}
85 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288