1
0
Fork 0
forked from External/grumble

Add 'grumble ctl'.

This commit is contained in:
Mikkel Krautz 2011-05-13 15:06:54 +02:00
parent 01182d36b3
commit 41f6af2334
10 changed files with 343 additions and 34 deletions

View file

@ -14,10 +14,10 @@ import (
)
type frozenServer struct {
Id int "id"
MaxUsers int "max_user"
Channels []frozenChannel "channels"
Users []frozenUser "users"
Id int "id"
Config map[string]string "config"
Channels []frozenChannel "channels"
Users []frozenUser "users"
}
type frozenUser struct {
@ -98,7 +98,7 @@ func (server *Server) FreezeToFile(filename string) (err os.Error) {
// Freeze a server
func (server *Server) Freeze() (fs frozenServer, err os.Error) {
fs.Id = int(server.Id)
fs.MaxUsers = server.MaxUsers
fs.Config = server.cfg
channels := []frozenChannel{}
for _, c := range server.Channels {
@ -224,6 +224,10 @@ func NewServerFromFrozen(filename string) (s *Server, err os.Error) {
return nil, err
}
if fs.Config != nil {
s.cfg = fs.Config
}
// Add all channels, but don't hook up parent/child relationships
// until all of them are loaded.
for _, fc := range fs.Channels {