added HandleInfoHandler.c with lookup_authname()
[NeonServV5.git] / main.c
1
2 #include "main.h"
3 #include "ClientSocket.h"
4 #include "UserNode.h"
5 #include "ChanNode.h"
6 #include "IRCEvents.h"
7 #include "IRCParser.h"
8 #include "modcmd.h"
9 #include "WHOHandler.h"
10 #include "bots.h"
11 #include "mysqlConn.h"
12 #include "HandleInfoHandler.h"
13 #include "lang.h"
14
15 void cleanup() {
16     free_sockets();
17     free_parser();
18     free_UserNode();
19     free_ChanNode();
20     free_bind();
21     free_modcmd();
22     free_whoqueue();
23     free_bots();
24     free_mysql();
25     free_handleinfohandler();
26     free_lang();
27 }
28
29 int main(void)
30 {
31     init_mysql();
32     init_lang();
33     init_parser();
34     init_UserNode();
35     init_ChanNode();
36     init_bind();
37         init_modcmd();
38     init_handleinfohandler();
39     init_bots();
40     
41     time_t socket_wait;
42     while(1) {
43         socket_wait = time(0) + SOCKET_SELECT_TIME;
44         do {
45             socket_loop(SOCKET_SELECT_TIME);
46         } while(time(0) > socket_wait);
47         clearTempUsers();
48     }
49 }
50
51 int stricmp (const char *s1, const char *s2)
52 {
53    if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
54    if (s2 == NULL) return *s1;
55    char c1, c2;
56    while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
57    {
58      if (*s1 == '\0') break;
59      ++s1; ++s2;
60    }
61    return c1 - c2;
62 }
63
64 int stricmplen (const char *s1, const char *s2, int len)
65 {
66    if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
67    if (s2 == NULL) return *s1;
68    char c1, c2;
69    int i = 0;
70    while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
71    {
72      i++;
73      if (*s1 == '\0') break;
74      ++s1; ++s2;
75      if(i == len) break;
76    }
77    return c1 - c2;
78 }
79