Ajout d'un mutex pour pouvoir mettre à jour via une goroutine la liste des messages
This commit is contained in:
7
imap.go
7
imap.go
@@ -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
|
||||
|
Reference in New Issue
Block a user