add multi-server functionality pt. 2 - delete server
This commit is contained in:
@@ -219,6 +219,16 @@ func (c *Config) AddServer(nickname string, connection ServerConnection) *Server
|
||||
return s
|
||||
}
|
||||
|
||||
func (c *Config) DeleteServer(uuid uuid.UUID) {
|
||||
newServers := make([]*ServerConfig, 0, len(c.Servers)-1)
|
||||
for _, s := range c.Servers {
|
||||
if s.ID != uuid {
|
||||
newServers = append(newServers, s)
|
||||
}
|
||||
}
|
||||
c.Servers = newServers
|
||||
}
|
||||
|
||||
func (c *Config) WriteConfigFile(filepath string) error {
|
||||
b, err := toml.Marshal(c)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user