diff --git a/.cdtproject b/.cdtproject
new file mode 100644
index 0000000..64882f1
--- /dev/null
+++ b/.cdtproject
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+
+
+
+
+
diff --git a/.cproject b/.cproject
new file mode 100644
index 0000000..894cb40
--- /dev/null
+++ b/.cproject
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 0000000..022af47
--- /dev/null
+++ b/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 30 08:38:05 EST 2007
+eclipse.preferences.version=1
+indexerId=org.eclipse.cdt.core.domsourceindexer
diff --git a/Makefile b/Makefile
index 6458689..f7dd57f 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
REMOVE = rm -f
#Objects
-OBJS = bot.o mysql.o main.o socket.o
+OBJS = thread.o bot.o mysql.o main.o socket.o
LIBRARIES = -lthr -L/usr/local/lib/mysql -lmysqlclient
CFLAGS = -Wall -W -ggdb
diff --git a/main.c b/main.c
index c10ef91..df8613c 100644
--- a/main.c
+++ b/main.c
@@ -14,6 +14,7 @@
FILE *logFile = 0x0;
int logLevel = 1;
int highSock = 0x0;
+int joinChan = 0x0;
time_t startTime;
void usage();
@@ -23,6 +24,7 @@
int ch;
int doFork = 0x1;
int readSocks = 0x0;
+ int t = 0x0;
fd_set readset;
fd_set faultset;
char data[1024];
@@ -71,7 +73,8 @@
srandom(time(NULL));
pthread_t threads[NUM_THREADS];
- rc = pthread_create(&threads[t], NULL, botCMD_Thread, (void *)t);
+
+ pthread_create(&threads[t], NULL, botCMD_Thread, (void *)t);
sConnect(SERVER_HOST,SERVER_PORT);
@@ -165,7 +168,8 @@
}
else if (!strcmp(cmd,"IDENT")) {
sWriteSocket("MSG TUveD:.tv login reddawg temp123\n");
- botJoinChans();
+ joinChan = 1;
+ //botJoinChans();
}
else if (!strcmp(cmd,"MSG")) {
botProcessMsg(cmdData);
diff --git a/thread.c b/thread.c
index e9cfa38..15cc00d 100644
--- a/thread.c
+++ b/thread.c
@@ -1,3 +1,4 @@
+#include
#include "tuvebot.h"
void *botCMD_Thread(void *threadid) {
@@ -7,6 +8,10 @@
writeLog(0,"Starting Bot's CMD Thread: [%d]\n", tid);
while (1) {
sleep(5);
+ if (joinChan == 1) {
+ joinChan = 0;
+ botJoinChans();
+ }
}
pthread_exit(NULL);
- } /* End tuveCMD_Thread() */
\ No newline at end of file
+ } /* End tuveCMD_Thread() */
diff --git a/tuvebot.h b/tuvebot.h
index 3488fc5..cbc770b 100644
--- a/tuvebot.h
+++ b/tuvebot.h
@@ -106,6 +106,7 @@
extern int highSock;
extern FILE *logFile;
extern time_t startTime;
+extern int joinChan;
/* Socket Functions */
int sConnect(const char *host,int port);
@@ -147,8 +148,9 @@
/* Database Functions */
int dbInit();
-MYSQL_RES *dbQuery(const char *query);
+MYSQL_RES *dbQuery(const char *query,short type);
/* Bot Functions */
int botJoinChans();
int botStoreTopic(char *data);
+void *botCMD_Thread(void *threadid);