-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListenerSection.cs
48 lines (38 loc) · 1000 Bytes
/
ListenerSection.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
namespace oftc_ircd_cs
{
public class ListenerSection : IConfigSection
{
#region ConfigSection Members
public void SetDefaults()
{
}
public void Process(object o)
{
var section = o as List<object>;
if (section == null)
throw new Exception("config section was not an array as expected");
foreach (Dictionary<string, object> element in section)
{
ListenerFlag flags = 0;
string host = "";
long port = 6667;
object tmp;
if (element.TryGetValue("host", out tmp))
host = (string)tmp;
if (element.TryGetValue("port", out tmp))
port = (long)tmp;
if (element.ContainsKey("ssl"))
flags |= ListenerFlag.SSL;
if (port < 1024 || port > ushort.MaxValue)
continue;
Listener.Create(host, (ushort)port, flags);
}
}
public void Verify()
{
}
#endregion
}
}