]> Cypherpunks.ru repositories - goircd.git/blobdiff - room.go
Continuation after negative replies
[goircd.git] / room.go
diff --git a/room.go b/room.go
index f58d70845d3a0277b43fc5181ffbfb43b408e422..f92d0e6b08811f89758111420da09ba80204416c 100644 (file)
--- a/room.go
+++ b/room.go
@@ -25,12 +25,14 @@ import (
        "strings"
 )
 
+var (
+       RE_ROOM = regexp.MustCompile("^#[^\x00\x07\x0a\x0d ,:/]{1,200}$")
+)
+
 // Sanitize room's name. It can consist of 1 to 50 ASCII symbols
 // with some exclusions. All room names will have "#" prefix.
-func RoomNameSanitize(name string) (n string, valid bool) {
-       n = strings.TrimLeft(strings.ToLower(name), "&#+!")
-       valid, _ = regexp.MatchString("^[^\x00\x07\x0a\x0d ,:/]{1,50}$", n)
-       return "#" + n, valid
+func RoomNameValid(name string) bool {
+       return RE_ROOM.MatchString(name)
 }
 
 type Room struct {
@@ -121,7 +123,7 @@ func (room *Room) Processor(events chan ClientEvent) {
                        for m := range room.members {
                                client.ReplyNicknamed("352", room.name, m.username, m.conn.RemoteAddr().String(), room.hostname, m.nickname, "H", "0 "+m.realname)
                        }
-                       client.ReplyNicknamed("315", room.name, "End of WHO list")
+                       client.ReplyNicknamed("315", room.name, "End of /WHO list")
                case EVENT_MODE:
                        if event.text == "" {
                                mode := "+"