added .gitignore
[NeonServV5.git] / main.c
diff --git a/main.c b/main.c
index 2fab2b070916bd59e2990f5665cdc75ef555a997..0870d968c321b81ec688dfecd13adb37d4a49903 100644 (file)
--- a/main.c
+++ b/main.c
@@ -2,31 +2,35 @@
 #include "main.h"
 #include "ClientSocket.h"
 #include "UserNode.h"
+#include "ChanNode.h"
+#include "IRCEvents.h"
+#include "IRCParser.h"
+#include "modcmd.h"
+#include "WHOHandler.h"
+#include "bots.h"
+#include "mysqlConn.h"
 
-//all c files - so we don't need a big Makefile right now :D
-#include "ClientSocket.c"
-#include "IRCParser.c"
-#include "UserNode.c"
-#include "ChanNode.c"
-#include "ChanUser.c"
-#include "IRCEvents.c"
-#include "WHOHandler.c"
-
-void just_test_it() {
-    struct UserNode *user = addUser("TestBot");
-    strcpy(user->ident, "test");
-    strcpy(user->realname, "testUser!");
-    user->flags |= USERFLAG_ISBOT;
-    struct ClientSocket *client = create_socket("127.0.0.1", 6667, "pktest:pktest123", user); //pktest Hostmask(s): *@127.0.0.1
-    connect_socket(client);
+void cleanup() {
+    free_sockets();
+    free_parser();
+    free_UserNode();
+    free_ChanNode();
+    free_bind();
+    free_modcmd();
+    free_whoqueue();
+    free_bots();
+    free_mysql();
 }
 
 int main(void)
 {
-    parser_init();
+    init_mysql();
+    init_parser();
     init_UserNode();
     init_ChanNode();
-    just_test_it();
+    init_bind();
+       init_modcmd();
+    init_bots();
     
     time_t socket_wait;
     while(1) {
@@ -37,3 +41,33 @@ int main(void)
         clearTempUsers();
     }
 }
+
+int stricmp (const char *s1, const char *s2)
+{
+   if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
+   if (s2 == NULL) return *s1;
+   char c1, c2;
+   while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
+   {
+     if (*s1 == '\0') break;
+     ++s1; ++s2;
+   }
+   return c1 - c2;
+}
+
+int stricmplen (const char *s1, const char *s2, int len)
+{
+   if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
+   if (s2 == NULL) return *s1;
+   char c1, c2;
+   int i = 0;
+   while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
+   {
+     i++;
+     if (*s1 == '\0') break;
+     ++s1; ++s2;
+     if(i == len) break;
+   }
+   return c1 - c2;
+}
+