|
@@ -15,6 +15,7 @@ import (
|
15
|
15
|
"net/http"
|
16
|
16
|
"os"
|
17
|
17
|
"os/signal"
|
|
18
|
+ "regexp"
|
18
|
19
|
"strconv"
|
19
|
20
|
"strings"
|
20
|
21
|
"syscall"
|
|
@@ -94,6 +95,10 @@ func NewServer(config *Config) *Server {
|
94
|
95
|
}
|
95
|
96
|
}
|
96
|
97
|
|
|
98
|
+ //TODO(dan): Hot damn this is an ugly hack. Fix it properly at some point.
|
|
99
|
+ ChannelNameExpr = regexp.MustCompile(fmt.Sprintf(`^[&!#+][\pL\pN]{1,%d}$`, config.Limits.ChannelLen))
|
|
100
|
+ NicknameExpr = regexp.MustCompile(fmt.Sprintf("^[\\pL\\pN\\pP\\pS]{1,%d}$", config.Limits.NickLen))
|
|
101
|
+
|
97
|
102
|
if config.Server.Password != "" {
|
98
|
103
|
server.password = config.Server.PasswordBytes()
|
99
|
104
|
}
|
|
@@ -114,7 +119,7 @@ func NewServer(config *Config) *Server {
|
114
|
119
|
server.isupport = NewISupportList()
|
115
|
120
|
server.isupport.Add("CASEMAPPING", "ascii")
|
116
|
121
|
// server.isupport.Add("CHANMODES", "") //TODO(dan): Channel mode list here
|
117
|
|
- // server.isupport.Add("CHANNELLEN", "") //TODO(dan): Support channel length
|
|
122
|
+ server.isupport.Add("CHANNELLEN", strconv.Itoa(config.Limits.ChannelLen))
|
118
|
123
|
server.isupport.Add("CHANTYPES", "#")
|
119
|
124
|
server.isupport.Add("EXCEPTS", "")
|
120
|
125
|
server.isupport.Add("INVEX", "")
|
|
@@ -122,7 +127,7 @@ func NewServer(config *Config) *Server {
|
122
|
127
|
// server.isupport.Add("MAXLIST", "") //TODO(dan): Support max list length?
|
123
|
128
|
// server.isupport.Add("MODES", "") //TODO(dan): Support max modes?
|
124
|
129
|
server.isupport.Add("NETWORK", config.Network.Name)
|
125
|
|
- // server.isupport.Add("NICKLEN", "") //TODO(dan): Support nick length
|
|
130
|
+ server.isupport.Add("NICKLEN", strconv.Itoa(config.Limits.NickLen))
|
126
|
131
|
server.isupport.Add("PREFIX", "(qaohv)~&@%+")
|
127
|
132
|
// server.isupport.Add("STATUSMSG", "@+") //TODO(dan): Autogenerate based on PREFIXes, support STATUSMSG
|
128
|
133
|
// server.isupport.Add("TARGMAX", "") //TODO(dan): Support this
|