3 #include "ClientSocket.h"
9 #include "WHOHandler.h"
11 #include "mysqlConn.h"
12 #include "HandleInfoHandler.h"
16 #include "EventLogger.h"
32 free_handleinfohandler();
36 static int load_mysql_config() {
37 char mysql_host[MAXLEN], mysql_port_str[MAXLEN], mysql_user[MAXLEN], mysql_pass[MAXLEN], mysql_base[MAXLEN];
39 if(loadINI("neonserv.ini") == FILE_SUCCESS) {
41 ReadString("MySQL", "host", mysql_host);
43 perror("invalid neonserv.ini: missing MySQL host");
46 mysql_port_str[0] = '\0';
47 ReadString("MySQL", "port", mysql_port_str);
48 mysql_serverport = atoi(mysql_port_str);
50 mysql_serverport = 3306;
52 ReadString("MySQL", "user", mysql_user);
54 perror("invalid neonserv.ini: missing MySQL user");
58 ReadString("MySQL", "pass", mysql_pass);
60 perror("invalid neonserv.ini: missing MySQL pass");
64 ReadString("MySQL", "base", mysql_base);
66 perror("invalid neonserv.ini: missing MySQL base");
70 perror("Unable to load neonserv.ini");
73 init_mysql(mysql_host, mysql_serverport, mysql_user, mysql_pass, mysql_base);
85 // Start Windows Sockets.
86 res = WSAStartup(MAKEWORD(2, 0), &wsadata);
89 perror("Unable to start Windows Sockets");
94 if(!load_mysql_config()) return 0;
103 init_handleinfohandler();
111 socket_wait = time(0) + SOCKET_SELECT_TIME;
113 socket_loop(SOCKET_SELECT_TIME);
114 } while(time(0) < socket_wait);
122 int stricmp (const char *s1, const char *s2)
124 if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
125 if (s2 == NULL) return *s1;
127 while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
129 if (*s1 == '\0') break;
135 int stricmplen (const char *s1, const char *s2, int len)
137 if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
138 if (s2 == NULL) return *s1;
141 while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
144 if (*s1 == '\0') break;