Dont allow channel names not beginning with '#'

This commit is contained in:
Andreas Neue 2016-08-06 20:16:01 +02:00
parent ace62fe367
commit 5f47deeb94
1 changed files with 4 additions and 0 deletions

View File

@ -71,6 +71,10 @@ func handleCmdJoin(sv *Server, msg *irc.Message) {
first := false
clid := strings.ToLower(msg.Pre)
chid := strings.ToLower(msg.Args[0])
if !strings.HasPrefix(chid, "#") {
sv.sendReply(msg.Pre, ERR_NOSUCHCHANNEL, msg.Args[0], "No such channel")
return
}
if _, exists := sv.chUsers[chid]; !exists {
sv.chUsers[chid] = make(map[string]string)
sv.chTopics[chid] = ""