コード例 #1
0
//makeSubjectCachelist returns thread.Caches in all thread.Cache and in recentlist sorted by recent stamp.
//if board is specified,  returns thread.Caches whose tagstr=board.
func (m *mchCGI) makeSubjectCachelist(board string) []*thread.Cache {
	result := thread.MakeRecentCachelist()
	if board == "" {
		return result
	}
	var result2 []*thread.Cache
	for _, c := range result {
		if user.Has(c.Datfile, board) {
			result2 = append(result2, c)
		}
	}
	return result2
}
コード例 #2
0
ファイル: cgi.go プロジェクト: shingetsu-gou/shingetsu-gou
//checkCache checks cache ca has specified tag and datfile doesn't contains filterd string.
func checkCache(ca *thread.Cache, target, filter, tag string) (string, bool) {
	x := util.FileDecode(ca.Datfile)
	if x == "" {
		return "", false
	}
	if filter != "" && !strings.Contains(strings.ToLower(x), filter) {
		return "", false
	}
	if tag != "" {
		switch {
		case user.Has(ca.Datfile, strings.ToLower(tag)):
		case target == "recent" && suggest.HasTagstr(ca.Datfile, strings.ToLower(tag)):
		default:
			return "", false
		}
	}
	return x, true
}