Prepared mode handling; removed debug output of cmd lines for security reasons
This commit is contained in:
parent
f844505c17
commit
c27ccdf0e9
|
@ -190,7 +190,6 @@ func (cl *RemoteClient) writeLine(format string, a ...interface{}) {
|
|||
}
|
||||
|
||||
func (cl *RemoteClient) handleCmd(s string) {
|
||||
xlog.Debug("handleCmd: [%s] '%s'", cl.name, s)
|
||||
msg := irc.Parse(s)
|
||||
msg.Cmd = strings.ToUpper(msg.Cmd)
|
||||
if cl.name != "" {
|
||||
|
|
35
server.go
35
server.go
|
@ -38,9 +38,9 @@ type Server struct {
|
|||
|
||||
clients map[string]Client
|
||||
|
||||
chUsers map[string]map[string]string
|
||||
chTopics map[string]string
|
||||
|
||||
chUsers map[string]map[string]string
|
||||
chTopics map[string]string
|
||||
chModes map[string]map[string]bool
|
||||
config *conf.ConfigFile
|
||||
configPath string
|
||||
|
||||
|
@ -62,6 +62,7 @@ func NewServer(configPath, software, version string) *Server {
|
|||
sv.clients = make(map[string]Client)
|
||||
sv.chUsers = make(map[string]map[string]string)
|
||||
sv.chTopics = make(map[string]string)
|
||||
sv.chModes = make(map[string]map[string]bool)
|
||||
|
||||
sv.configPath = configPath
|
||||
sv.loadConfig()
|
||||
|
@ -325,6 +326,7 @@ func handleCmdJoin(sv *Server, msg *irc.Message) {
|
|||
if _, exists := sv.chUsers[chid]; !exists {
|
||||
sv.chUsers[chid] = make(map[string]string)
|
||||
sv.chTopics[chid] = ""
|
||||
sv.chModes[chid] = make(map[string]map[string]bool)
|
||||
}
|
||||
if _, exists := sv.chUsers[chid][clid]; exists {
|
||||
return
|
||||
|
@ -354,7 +356,32 @@ func handleCmdQuit(sv *Server, msg *irc.Message) {
|
|||
}
|
||||
|
||||
func handleCmdMode(sv *Server, msg *irc.Message) {
|
||||
|
||||
if strings.HasPrefix(msg.Args[0], "#") {
|
||||
chid := strings.ToLower(msg.Args[0])
|
||||
if _, exists := chUsers[chid]; !exists {
|
||||
return
|
||||
}
|
||||
if _, exists = msg.Args[1]; !exists {
|
||||
return
|
||||
}
|
||||
modeFlag := strings.ToLower(msg.Args[1])
|
||||
if _, exists = msg.Args[2]; !exists {
|
||||
modeTar := ""
|
||||
} else {
|
||||
modeTar := strings.ToLower(msg.Args[2])
|
||||
}
|
||||
switch modeFlag {
|
||||
case "+o":
|
||||
case "-o":
|
||||
case "+h":
|
||||
case "-h":
|
||||
case "+b":
|
||||
case "-b":
|
||||
case "+v":
|
||||
case "-v":
|
||||
}
|
||||
sv.sendMsg(msg)
|
||||
}
|
||||
}
|
||||
|
||||
func handleCmdTopic(sv *Server, msg *irc.Message) {
|
||||
|
|
Loading…
Reference in New Issue