package webui

import (
	"net/http"
	"strings"
)

// webmailSearch searches across every folder in the mailbox (or one, if ?folder= is
// given) — the all-folders case webmailFolderView's own ?q= support (scoped to
// whatever folder is already in the URL path) can't reach, since that route always
// has a folder segment.
func (a *App) webmailSearch(w http.ResponseWriter, r *http.Request) {
	folder := r.URL.Query().Get("folder")
	query := strings.TrimSpace(r.URL.Query().Get("q"))
	a.renderFolderOrSearch(w, r, folder, query)
}
