This repository has been archived on 2023-08-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2017-04-03 10:00:38 -04:00
|
|
|
//
|
|
|
|
|
// frontend_multi.go
|
|
|
|
|
// frontend multiplexer
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
package srnd
|
|
|
|
|
|
|
|
|
|
// muxed frontend for holding many frontends
|
|
|
|
|
type multiFrontend struct {
|
2017-09-26 09:50:14 -04:00
|
|
|
frontends []Frontend
|
2017-04-03 10:00:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 09:50:14 -04:00
|
|
|
func (self multiFrontend) HandleNewPost(nntp frontendPost) {
|
|
|
|
|
for idx := range self.frontends {
|
|
|
|
|
self.frontends[idx].HandleNewPost(nntp)
|
|
|
|
|
}
|
2017-04-03 10:00:38 -04:00
|
|
|
}
|
|
|
|
|
|
2017-04-04 07:48:45 -04:00
|
|
|
func (self multiFrontend) RegenOnModEvent(newsgroup, msgid, root string, page int) {
|
|
|
|
|
for idx := range self.frontends {
|
|
|
|
|
self.frontends[idx].RegenOnModEvent(newsgroup, msgid, root, page)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-03 10:00:38 -04:00
|
|
|
func MuxFrontends(fronts ...Frontend) Frontend {
|
|
|
|
|
var front multiFrontend
|
|
|
|
|
front.frontends = fronts
|
|
|
|
|
return front
|
|
|
|
|
}
|