2014-05-16 11:03:23 +04:00
|
|
|
package server
|
2014-05-02 13:08:20 +04:00
|
|
|
|
2014-05-03 10:55:12 +04:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
2014-05-02 13:08:20 +04:00
|
|
|
|
2014-08-25 10:18:23 +04:00
|
|
|
type CommandFunc func(c *client) error
|
2014-05-02 13:08:20 +04:00
|
|
|
|
|
|
|
var regCmds = map[string]CommandFunc{}
|
2014-05-03 10:55:12 +04:00
|
|
|
|
|
|
|
func register(name string, f CommandFunc) {
|
|
|
|
if _, ok := regCmds[strings.ToLower(name)]; ok {
|
|
|
|
panic(fmt.Sprintf("%s has been registered", name))
|
|
|
|
}
|
|
|
|
|
|
|
|
regCmds[name] = f
|
|
|
|
}
|