Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/srndv2/src/srnd/frontend_multi.go

57 lines
1.1 KiB
Go
Raw Normal View History

//
// frontend_multi.go
// frontend multiplexer
//
package srnd
// muxed frontend for holding many frontends
type multiFrontend struct {
2017-09-26 18:50:14 +05:00
frontends []Frontend
}
2017-10-10 21:17:38 +05:00
func (self multiFrontend) GetCacheHandler() CacheHandler {
// TODO: fixme :^)
return nil
}
func (self multiFrontend) ArchiveMode() {
for _, f := range self.frontends {
f.ArchiveMode()
}
}
func (self multiFrontend) AllowNewsgroup(newsgroup string) bool {
return true
}
func (self multiFrontend) Regen(msg ArticleEntry) {
for _, front := range self.frontends {
front.Regen(msg)
}
}
func (self multiFrontend) Mainloop() {
for idx := range self.frontends {
go self.frontends[idx].Mainloop()
}
}
2017-09-26 18:50:14 +05:00
func (self multiFrontend) HandleNewPost(nntp frontendPost) {
for idx := range self.frontends {
self.frontends[idx].HandleNewPost(nntp)
}
}
2017-04-04 16:48:45 +05:00
func (self multiFrontend) RegenOnModEvent(newsgroup, msgid, root string, page int) {
for idx := range self.frontends {
self.frontends[idx].RegenOnModEvent(newsgroup, msgid, root, page)
}
}
func MuxFrontends(fronts ...Frontend) Frontend {
var front multiFrontend
front.frontends = fronts
return front
}