-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (26 loc) · 1.29 KB
/
main.cpp
File metadata and controls
34 lines (26 loc) · 1.29 KB
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
# include "./include/IRC.hpp"
# include "./include/commands/ICommands.hpp"
using namespace IRC;
/*————————————————————————————--------------------------------------------------------------——————————————————————————*/
// socket -> bind -> listen -> accept(pre req (master socket))
int main(int ac,char **av) {
Server* ircServer = new IRC::Server();
ICommands* commands = new IRC::ICommands();
// Allocate memory for all the objects of the commands classes.
commands->registerCommands();
//TODO: check if the port is a number and if the password is a number
if(ac == 3) {
ircServer->setServPass(av[2]);
ircServer->create_socket(av[1]);
ircServer->multi_connection(commands);
}
else {
std::cout << "Please provide the following arguments:" << std::endl;
std::cout << " <port> : The port number to listen on." << std::endl;
std::cout << " <password> : The password for the server." << std::endl;
}
delete (commands);
delete (ircServer);
return (0);
}
/*————————————————————————————--------------------------------------------------------------——————————————————————————*/