cheogram-smtp

created pr with cheogram-smtp/ignore-empty.1 on 2026-10-21T15:32:06Z · by 9e834e0d
changed pr name to Do not send empty emails for empty messages on 2026-10-21T15:32:32Z · by 9e834e0d
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-smtp:ignore-empty | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-smtp:ignore-empty [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-smtp:ignore-empty
add comment to patch request:
ssh pr.pico.sh comment cheogram-smtp:ignore-empty "lgtm!"
+5 -5 Email.hs #
......@@ -597,12 +597,12 @@ messageToMIME ::
597597 (MIME.Boundary, MIME.Boundary)
598598 -> [Attachment]
599599 -> XMPP.Message
600- -> Either XMPP.Message MIME.MIMEMessage
600+ -> MIME.MIMEMessage
601601 messageToMIME
602602 (b1, b2)
603603 attachments
604604 message@XMPP.Message { XMPP.messagePayloads = payload }
605- | [xdc] <- XML.isNamed (s"{urn:xmpp:webxdc:0}x") =<< payload = Right $
605+ | [xdc] <- XML.isNamed (s"{urn:xmpp:webxdc:0}x") =<< payload =
606606 MIME.createMultipartMixedMessage b1 (NonEmpty.fromList [
607607 createMultipartMessage b2
608608 (MIME.Report $ s"status-update")
......@@ -616,8 +616,8 @@ messageToMIME
616616 ])
617617 | Just bodyTxt <- getBody message,
618618 null attachments =
619- Right $ MIME.createTextPlainMessage bodyTxt
620- | otherwise = Right $
619+ MIME.createTextPlainMessage bodyTxt
620+ | otherwise =
621621 MIME.createMultipartMixedMessage b1 $ NonEmpty.fromList $
622622 justZ (MIME.createTextPlainMessage <$> getBody message) ++
623623 map (\(Attachment mime name bytes) ->
......@@ -635,7 +635,7 @@ messageToEmailIO domain message = do
635635 now <- fromIO_ getCurrentTime
636636 let mime = messageToMIME boundaries attachments message
637637 let xdc = any (matchWebXDC . mimeType) attachments
638- return $ messageToEmail domain now xdc message =<< mime
638+ return $ messageToEmail domain now xdc message mime
639639
640640 matchWebXDC :: MIME.ContentType -> Bool
641641 matchWebXDC = MIME.matchContentType (s"application") (Just $ s"webxdc+zip")
+1 -1 test/EmailTest.hs #
......@@ -70,7 +70,7 @@ messageToEmailTest ::
7070 -> Either XMPP.Message EmailWithEnvelope
7171 messageToEmailTest d now as m =
7272 messageToEmail d now xdc m =<<
73- messageToMIME (boundary1, boundary2) as m
73+ pure (messageToMIME (boundary1, boundary2) as m)
7474 where
7575 xdc = any (matchWebXDC . mimeType) as
7676
Back to top