diff --git a/irc/constants.go b/irc/constants.go index 49bf4c93..20e07b17 100644 --- a/irc/constants.go +++ b/irc/constants.go @@ -17,13 +17,13 @@ var ( ErrAlreadyDestroyed = errors.New("already destroyed") // regexps - ChannelNameExpr = regexp.MustCompile(`^[&!#+][[:word:]]{1,63}$`) + ChannelNameExpr = regexp.MustCompile(`^[&!#+][\pL\pN]{1,63}$`) NicknameExpr = regexp.MustCompile( - "^[[:alpha:]\\[\\]{}^`][[:word:]\\[\\]{}^`]{1,31}$") + "^[\\pL\\[\\]{}^`][\\pL\\pN\\[\\]{}^`]{1,31}$") ) const ( - SEM_VER = "ergonomadic-1.2.6" + SEM_VER = "ergonomadic-1.2.7" CRLF = "\r\n" MAX_REPLY_LEN = 512 - len(CRLF) diff --git a/irc/server.go b/irc/server.go index e9a4d45c..49c5f4ad 100644 --- a/irc/server.go +++ b/irc/server.go @@ -407,6 +407,11 @@ func (msg *NickCommand) HandleServer(server *Server) { return } + if !IsNickname(msg.nickname) { + client.ErrErroneusNickname(msg.nickname) + return + } + if msg.nickname == client.nick { return }