summaryrefslogtreecommitdiff
path: root/iris
diff options
context:
space:
mode:
Diffstat (limited to 'iris')
-rw-r--r--iris/backend.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/iris/backend.go b/iris/backend.go
index 787db96..7b1c058 100644
--- a/iris/backend.go
+++ b/iris/backend.go
@@ -249,7 +249,7 @@ func msgToIris(article *nntp.Article) (*irisMsg, error) {
var msg irisMsg
msg.Data.Author = irisAuthor(article.Header.Get("From"))
msg.Data.Timestamp = postTime
- msg.Data.Message = string(body)
+ msg.Data.Message = irisBody(article.Header.Get("Subject"), string(body))
refs := article.Header.Get("References")
if refs != "" {
spl := strings.SplitN(refs, " ", 2)
@@ -266,6 +266,14 @@ func msgToIris(article *nntp.Article) (*irisMsg, error) {
return &msg, nil
}
+func irisBody(subject, body string) string {
+ firstline, _, _ := strings.Cut(body, "\n")
+ if subject != "" && subject != firstline {
+ body = subject + "\n\n" + body
+ }
+ return body
+}
+
func irisAuthor(nntpAuthor string) string {
addr, err := mail.ParseAddress(nntpAuthor)
if err != nil {