-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (36 loc) · 860 Bytes
/
main.cpp
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
#include "main.h"
int main(int argc, char *argv[])
{
pthread_t api_thread;
pthread_t bot_thread;
APIServer* api = new APIServer(31337);
cout << "a " << api << endl;
if (pthread_create(&bot_thread, NULL, &createBotThread, (void*) api) != 0)
{
cout << "error creating bot thread" << endl;
}
api->Run();
//pthread_join(api_thread, NULL);
pthread_join(bot_thread, NULL);
}
/*
void* createAPIThread (void* api)
{
api = (void*) (new APIServer());
((APIServer*) api)->Run();
pthread_exit(0);
return api;
}
*/
void* createBotThread (void* api)
{
IRCBot* bot = new IRCBot((APIServer*) api);
bot->setNick("Othi");
bot->setPassword("*****");
bot->setUser("bot");
bot->setServer("**********");
bot->setPort("8080");
bot->Connect();
pthread_exit(0);
return api;
}