openidec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c9645a0952657ff1c49181f308cb979f789ac4c5
parent 9ce397f2456fb400246d046062775c2e76f0a58b
Author: Peter Kosyh <p.kosyh@gmail.com>
Date:   Mon, 26 Oct 2020 16:15:13 +0000

Merge branch 'master' of https://github.com/gl00my/ii-go

Diffstat:
Mii-node/web.go | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/ii-node/web.go b/ii-node/web.go @@ -656,7 +656,7 @@ func www_reply(ctx *WebContext, w http.ResponseWriter, r *http.Request, quote bo msg.Subj = "Re: " + strings.TrimPrefix(msg.Subj, "Re: ") msg.Tags.Add("repto/" + id) if quote { - msg.Text = msg_quote(msg.Text) + msg.Text = msg_quote(msg.Text, msg.From) } else { msg.Text = "" } @@ -686,18 +686,25 @@ func msg_clean(txt string) string { txt = strings.TrimRight(txt, "\n") return txt } -func msg_quote(txt string) string { +func msg_quote(txt string, from string) string { txt = msg_clean(txt) f := "" + names := strings.Split(from, " ") + if len(names) >= 2 { + from = fmt.Sprintf("%v%v", + string([]rune(names[0])[0]), + string([]rune(names[1])[0])) + } for _, l := range strings.Split(txt, "\n") { if strings.Trim(l, " ") == "" { f += l + "\n" continue } - if strings.HasPrefix(l, ">") { - f += ">" + l + "\n" + if quoteRegex.MatchString(l) { + s := strings.Index(l, ">") + f += l[:s] + ">>" + l[s+1:] + "\n" } else { - f += "> " + l + "\n" + f += from + "> " + l + "\n" } } return f