1 /*  Copyright (C) 2013, 2018  Vladimir Panteleev <vladimir@thecybershadow.net>
2  *
3  *  This program is free software: you can redistribute it and/or modify
4  *  it under the terms of the GNU Affero General Public License as
5  *  published by the Free Software Foundation, either version 3 of the
6  *  License, or (at your option) any later version.
7  *
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU Affero General Public License for more details.
12  *
13  *  You should have received a copy of the GNU Affero General Public License
14  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 module mywormnet2;
18 
19 import std.getopt;
20 import std.stdio;
21 
22 import ae.net.asockets;
23 import ae.sys.log;
24 import ae.utils.sini;
25 
26 import common;
27 import http;
28 import irc;
29 
30 alias common.configuration configuration; // 314
31 
32 class WormNETServer
33 {
34 	WormNETHttpServer http;
35 	WormNETIrcServer irc;
36 	Logger log;
37 
38 	this()
39 	{
40 		http = new WormNETHttpServer;
41 		irc = new WormNETIrcServer;
42 	}
43 
44 	void start()
45 	{
46 		irc.log = log;
47 		irc.listen(configuration.irc.port, configuration.irc.address);
48 
49 		http.server.log = log;
50 		http.server.listen(configuration.http.port, configuration.http.address);
51 	}
52 }
53 
54 void main()
55 {
56 	configuration = File("mywormnet2.ini").byLine.parseStructuredIni!Configuration;
57 
58 	auto server = new WormNETServer();
59 	server.log = createLogger("MyWormNET2");
60 	server.start();
61 	socketManager.loop();
62 }