Ajout d'un mutex pour pouvoir mettre à jour via une goroutine la liste des messages

This commit is contained in:
Laurent Ulrich
2025-08-08 10:59:51 +02:00
parent 614a6059f5
commit 9f88d84513
5 changed files with 42 additions and 31 deletions

View File

@@ -168,11 +168,9 @@ func (mb *MailBox) GetMessages() ([]Post, error) {
post.HTML = ""
break
}
log.Println("Trying to generate html for", htmlNode.Data)
var buf bytes.Buffer
err = nil
for child := htmlNode.FirstChild; child != nil; child = child.NextSibling {
log.Println("html for", child.Data)
if err = html.Render(&buf, child); err != nil {
post.HTML = ""
break
@@ -201,15 +199,10 @@ func (mb *MailBox) Close() {
}
func findHTMLNode(node *html.Node) (*html.Node, error) {
if node.Type == html.ElementNode {
log.Println(node.Data)
}
if node.Type == html.ElementNode && node.Data == "body" {
log.Println("Found", node.Data)
return node, nil
}
for e := node.FirstChild; e != nil; e = node.NextSibling {
log.Println("Search in", e.Data)
n, err := findHTMLNode(e)
if err == nil {
return n, nil