Browse Source

Support network name

tags/v0.1.0
Daniel Oaks 8 years ago
parent
commit
a013205fd1
3 changed files with 20 additions and 6 deletions
  1. 8
    1
      irc/config.go
  2. 5
    5
      irc/server.go
  3. 7
    0
      oragono.yaml

+ 8
- 1
irc/config.go View File

@@ -21,14 +21,18 @@ func (conf *PassConfig) PasswordBytes() []byte {
21 21
 }
22 22
 
23 23
 type Config struct {
24
+	Network struct {
25
+		Name string
26
+	}
27
+
24 28
 	Server struct {
25 29
 		PassConfig
30
+		Name     string
26 31
 		Database string
27 32
 		Listen   []string
28 33
 		Wslisten string
29 34
 		Log      string
30 35
 		MOTD     string
31
-		Name     string
32 36
 	}
33 37
 
34 38
 	Operator map[string]*PassConfig
@@ -67,6 +71,9 @@ func LoadConfig(filename string) (config *Config, err error) {
67 71
 		return nil, err
68 72
 	}
69 73
 
74
+	if config.Network.Name == "" {
75
+		return nil, errors.New("Network name missing")
76
+	}
70 77
 	if config.Server.Name == "" {
71 78
 		return nil, errors.New("Server name missing")
72 79
 	}

+ 5
- 5
irc/server.go View File

@@ -88,11 +88,11 @@ func NewServer(config *Config) *Server {
88 88
 	server.isupport.Add("CHANTYPES", "#")
89 89
 	server.isupport.Add("EXCEPTS", "")
90 90
 	server.isupport.Add("INVEX", "")
91
-	server.isupport.Add("KICKLEN", "")            //TODO(dan): Support kick length?
92
-	server.isupport.Add("MAXLIST", "")            //TODO(dan): Support max list length?
93
-	server.isupport.Add("MODES", "")              //TODO(dan): Support max modes?
94
-	server.isupport.Add("NETWORK", "NetNameHere") //TODO(dan): Support network name
95
-	server.isupport.Add("NICKLEN", "")            //TODO(dan): Support nick length
91
+	server.isupport.Add("KICKLEN", "") //TODO(dan): Support kick length?
92
+	server.isupport.Add("MAXLIST", "") //TODO(dan): Support max list length?
93
+	server.isupport.Add("MODES", "")   //TODO(dan): Support max modes?
94
+	server.isupport.Add("NETWORK", config.Network.Name)
95
+	server.isupport.Add("NICKLEN", "") //TODO(dan): Support nick length
96 96
 	server.isupport.Add("PREFIX", "(ov)@+")
97 97
 	server.isupport.Add("STATUSMSG", "@+") //TODO(dan): Autogenerate based on PREFIXes, make sure it's actually supported
98 98
 	server.isupport.Add("TARGMAX", "")     //TODO(dan): Support this

+ 7
- 0
oragono.yaml View File

@@ -1,4 +1,11 @@
1 1
 # oragono IRCd config
2
+
3
+# network configuration
4
+network:
5
+    # name of the network
6
+    name: OragonoTest
7
+
8
+# server configuration
2 9
 server:
3 10
     # server name
4 11
     name: oragono.test

Loading…
Cancel
Save