diff --git a/botthread.c b/botthread.c index b9dfa7a..fc93c65 100644 --- a/botthread.c +++ b/botthread.c @@ -29,7 +29,7 @@ cmdData = strtok_r(NULL,"\n",&tok_last); if (strcasecmp(cmd,"echo") == 0x0) { - sprintf(output,"MSG:@TUveBOT:%s:%s\n",chan,cmdData); + sprintf(output,"MSG:TUveD:%s:%s\n",chan,cmdData); tuveSendAllInChan(chan,0x0,output); } else if (strcasecmp(cmd,"skip") == 0x0) { @@ -38,7 +38,7 @@ else tmpChan = findChan(chan); if (tmpChan != 0x0) { - tmpChan->songEnd = 0x0; + tmpChan->videoEnd = 0x0; tmpChan->count = MAX_COUNT; } } @@ -49,16 +49,18 @@ if ((tmp != 0x0) & (tmp2 != 0x0)) { sprintf(output,"SELECT username FROM users WHERE username = '%s' AND pass = '%s'",tmp,tmp2); res = dbQuery(output); - - if (mysql_num_rows(res) == 1) { - sprintf(output,"MSG:@TUveBOT:%s:You have successfully logged in.\n",chan); + if (res == 0x0) { + sSendData(userConnection,"MSG:TUveD:STATUS:Sorry I'm Having MySQL Troubles.\n"); + } + else if (mysql_num_rows(res) == 1) { + sprintf(output,"MSG:TUveD:%s:You have successfully logged in.\n",chan); sSendData(userConnection,output); sprintf(output,"EMOTE:%s:STATUS:Is now an Evil Overlord!\n",userConnection->userInfo.username); tuveSendAllInUsersChans(userConnection,output); userConnection->userInfo.mode = 1; } else { - sprintf(output,"MSG:@TUveBOT:%s:You have failed login. Your connection will now be terminated!\n",chan); + sprintf(output,"MSG:TUveD:%s:You have failed login. Your connection will now be terminated!\n",chan); sSendData(userConnection,output); tuveDelUserChans(userConnection,"This Mother Fucker Tried To Login With The Wrong Password!"); userConnection->userInfo.status = -1; @@ -69,30 +71,7 @@ tmpChan = findChan(chan); if (userConnection->userInfo.mode != 1) { - sSendData(userConnection,"MSG:@TUveBOT:STATUS:You do not have permission to set channel mode\n"); - if (tmpChan->modes[CHAN_TIME] == 1) { - sprintf(output,"MSG:TUveD:%s:This channel has a time limit of %i seconds for songs.\n",tmpChan->channel,tmpChan->maxTime); - sSendData(userConnection,output); - sprintf(output,"MODE:%s:T:1:%i\n",tmpChan->channel,tmpChan->maxTime); - sSendData(userConnection,output); - } - else { - sprintf(output,"MODE:%s:T:0\n",tmpChan->channel); - sSendData(userConnection,output); - } - - if (tmpChan->modes[CHAN_QUEUE] == 1) - sprintf(output,"MODE:%s:Q:1\n",tmpChan->channel); - else - sprintf(output,"MODE:%s:Q:0\n",tmpChan->channel); - sSendData(userConnection,output); - - if (tmpChan->modes[CHAN_RANDOM] == 1) - sprintf(output,"MODE:%s:R:1\n",tmpChan->channel); - else - sprintf(output,"MODE:%s:R:0\n",tmpChan->channel); - sSendData(userConnection,output); - + sSendData(userConnection,"MSG:TUveD:STATUS:You do not have permission to set channel mode\n"); return(0x0); } if (cmdData != 0x0) { @@ -104,17 +83,35 @@ else if (modeString[0] == '+') dM = 1; else { - sSendData(userConnection,"MSG:@TUveBOT:STATUS:Invalid Mode String\n"); + sSendData(userConnection,"MSG:TUveD:STATUS:Invalid Mode String\n"); return(0x0); } for (i = 1;i < strlen(modeString);i++) { switch(modeString[i]) { + case 'a': + case 'A': + tmp = strtok_r(NULL," ",&tok_last); + if (tmp != 0x0) { + tmpChan->modes[CHAN_RATING] = atoi(tmp); + sprintf(output,"MODE:%s:A:%i\n",tmpChan->channel,tmpChan->modes[CHAN_RATING]); + tuveSendAllInChan(chan,0x0,output); + } + break; + case 'c': + case 'C': + tmp = strtok_r(NULL," ",&tok_last); + if (tmp != 0x0) { + tmpChan->modes[CHAN_CLASS] = atoi(tmp); + sprintf(output,"MODE:%s:C:%i\n",tmpChan->channel,tmpChan->modes[CHAN_CLASS]); + tuveSendAllInChan(chan,0x0,output); + } + break; case 'r': case 'R': tmpChan->modes[CHAN_RANDOM] = dM; - sprintf(output,"MSG:@TUveBOT:%s:%s Sets Mode %cRandom\n",chan,userConnection->userInfo.username,modeString[0]); + sprintf(output,"MSG:TUveD:%s:%s Sets Mode %cRandom\n",chan,userConnection->userInfo.username,modeString[0]); tuveSendAllInChan(chan,0x0,output); sprintf(output,"MODE:%s:R:%i\n",tmpChan->channel,dM); tuveSendAllInChan(chan,0x0,output); @@ -122,7 +119,7 @@ case 'q': case 'Q': tmpChan->modes[CHAN_QUEUE] = dM; - sprintf(output,"MSG:@TUveBOT:%s:%s Sets Mode %cQueue\n",chan,userConnection->userInfo.username,modeString[0]); + sprintf(output,"MSG:TUveD:%s:%s Sets Mode %cQueue\n",chan,userConnection->userInfo.username,modeString[0]); tuveSendAllInChan(chan,0x0,output); sprintf(output,"MODE:%s:Q:%i\n",tmpChan->channel,dM); tuveSendAllInChan(chan,0x0,output); @@ -134,7 +131,7 @@ if (tmp != 0x0) { tmpChan->modes[CHAN_TIME] = dM; tmpChan->maxTime = atoi(tmp); - sprintf(output,"MSG:@TUveBOT:%s:%s Sets Mode +Time Limit %s\n",chan,userConnection->userInfo.username,tmp); + sprintf(output,"MSG:TUveD:%s:%s Sets Mode +Time Limit %s\n",chan,userConnection->userInfo.username,tmp); tuveSendAllInChan(chan,0x0,output); sprintf(output,"MODE:%s:T:%i:%s\n",tmpChan->channel,dM,tmp); tuveSendAllInChan(chan,0x0,output); @@ -142,14 +139,14 @@ } else { tmpChan->modes[CHAN_TIME] = dM; - sprintf(output,"MSG:@TUveBOT:%s:%s Sets Mode %cTime Limit\n",chan,userConnection->userInfo.username,modeString[0]); + sprintf(output,"MSG:TUveD:%s:%s Sets Mode %cTime Limit\n",chan,userConnection->userInfo.username,modeString[0]); tuveSendAllInChan(chan,0x0,output); sprintf(output,"MODE:%s:T:%i\n",tmpChan->channel,dM); tuveSendAllInChan(chan,0x0,output); } break; default: - sSendData(userConnection,"MSG:@TUveBOT:STATUS:Invalid Channel Mode\n"); + sSendData(userConnection,"MSG:TUveD:STATUS:Invalid Channel Mode\n"); break; } } @@ -159,21 +156,21 @@ } else if (strcasecmp(cmd,"random") == 0x0) { if (userConnection->userInfo.mode != 1) { - sSendData(userConnection,"MSG:@TUveBOT:STATUS:You do not have permission to play a random song.\n"); + sSendData(userConnection,"MSG:TUveD:STATUS:You do not have permission to play a random song.\n"); return(0x0); } - - res = dbQuery("SELECT artist,title,file,length FROM videos"); - if (mysql_num_rows(res) == 0x0) { - sprintf(output,"MSG:@TUveBOT:%s:Sorry I'm Have SQL Troubles Today.\n",chan); + tmpChan = findChan(chan); + sprintf(output,"SELECT artist,title,file,length,vid FROM videos WHERE rating <= %i AND class = %i",tmpChan->modes[CHAN_RATING],tmpChan->modes[CHAN_CLASS]); + res = dbQuery(output); + if ((res == 0x0) || (mysql_num_rows(res) == 0x0)) { + sprintf(output,"MSG:TUveD:%s:Sorry I'm Have SQL Troubles Today.\n",chan); tuveSendAllInChan(chan,0x0,output); } else { mysql_data_seek(res,(random() % mysql_num_rows(res))); row = mysql_fetch_row(res); - sprintf(output,"%s's Random Pick -> %s - %s",userConnection->userInfo.username,row[0],row[1]); - tuveBotSetSong(chan,row[3],row[2],output); + tuveBotSetSong(chan,userConnection->userInfo.username,row[0],row[1],atoi(row[3]),row[2],atoi(row[4])); } } @@ -204,7 +201,7 @@ pthread_mutex_lock(&chanMutex); for (tmpChans = channels;tmpChans != 0x0;tmpChans = tmpChans->next) { - if (tmpChans->songEnd < time(NULL)) { + if (tmpChans->videoEnd < time(NULL)) { tmpUser = tmpChans->nextUser; findUser: if (tmpChans->modes[CHAN_QUEUE] == 0x0) @@ -221,7 +218,7 @@ else { gotUser: if (tmpChans->nextUser->user->userInfo.queue == 0x1) { - sSendData(tmpChans->nextUser->user,"GETSONG\n"); + sSendData(tmpChans->nextUser->user,"GETVIDEO\n"); writeLog(0,"Need To Find Next Song For: %s, From User: %s\n",tmpChans->channel,tmpChans->nextUser->user->userInfo.username); tmpChans->count++; } @@ -231,16 +228,16 @@ goto findUser; getRandom: if (tmpChans->modes[CHAN_RANDOM] == 0x1) { - res = dbQuery("SELECT artist,title,file,length FROM videos"); - if (mysql_num_rows(res) == 0x0) { - sprintf(output,"MSG:@TUveBOT:%s:Sorry I'm Have SQL Troubles Today.\n",tmpChans->channel); + sprintf(output,"SELECT artist,title,file,length,vid FROM videos WHERE rating <= %i AND class = %i",tmpChans->modes[CHAN_RATING],tmpChans->modes[CHAN_CLASS]); + res = dbQuery(output); + if ((res == 0x0) || (mysql_num_rows(res) == 0x0)) { + sprintf(output,"MSG:TUveD:%s:Sorry I'm Have SQL Troubles Today.\n",tmpChans->channel); tuveSendAllInChan(tmpChans->channel,0x0,output); } else { mysql_data_seek(res,(random() % mysql_num_rows(res))); row = mysql_fetch_row(res); - sprintf(output,"TUveBot's Pick -> %s - %s",row[0],row[1]); - tuveBotSetSong(tmpChans->channel,row[3],row[2],output); + tuveBotSetSong(tmpChans->channel,"TUveD",row[0],row[1],atoi(row[3]),row[2],atoi(row[4])); } } @@ -257,60 +254,61 @@ return(0x0); } -int tuveBotNoSong(char *chan) { - tuveChanList_t *tmpChan; +int tuveBotSetVideo(char *chan,char *nick,int vid) { + MYSQL_RES *res = 0x0; + MYSQL_ROW row; + char output[256]; - tmpChan = findChan(chan); - if (tmpChan == 0x0) { - writeLog(0,"ERROR: tuveBotNoSong tmpChan Failed\n"); - return(0x1); + sprintf(output,"SELECT artist,title,file,length FROM videos WHERE vid = %i",vid); + res = dbQuery(output); + + if ((res == 0x0) || (mysql_num_rows(res) == 0x0)) { + sprintf(output,"MSG:TUveD:%s:Sorry I'm Have SQL Troubles Today.\n",chan); + tuveSendAllInChan(chan,0x0,output); } - - tmpChan->nextUser = tmpChan->nextUser->next; - - if (tmpChan->nextUser == 0x0) - tmpChan->nextUser = tmpChan->users; - - if (tmpChan->nextUser != 0x0) - sSendData(tmpChan->nextUser->user,"GETSONG\n"); - + else { + row = mysql_fetch_row(res); + tuveBotSetSong(chan,nick,row[0],row[1],atoi(row[3]),row[2],vid); + } return(0x0); } int -tuveBotSetSong(char *chan,char *playTime,char *file,char *title) { +tuveBotSetSong(char *channel,char *nick,char *artist,char *title,int length,char *file,int vid) { tuveChanList_t *tmpChan; char output[1024]; int min, sec; songCount++; - playCount += atoi(playTime); + playCount += length; - tmpChan = findChan(chan); + tmpChan = findChan(channel); if (tmpChan->modes[CHAN_TIME] == 0x1) { - if (atoi(playTime) > tmpChan->maxTime) { + if (length > tmpChan->maxTime) { return(0x0); } } - sprintf(output,"CURPOS:0:%s:%s:%s\n",file,title,playTime); - writeLog(0,"[%s][%s]\n",output,chan); - tuveSendAllInChan(chan,0x0,output); - min = strtol(playTime, (char **)NULL, 10) / 60; - sec = strtol(playTime, (char **)NULL, 10) % 60; + min = length / 60; + sec = length % 60; - sprintf(output,"MSG:@TUveBOT:%s:Playing %s (%d:%.2d)\n",chan,title,min,sec); - tuveSendAllInChan(chan,0x0,output); + tmpChan->songTime = length; + tmpChan->videoEnd = length + time(NULL) + VIDE_PAD_TIME; + tmpChan->vid = vid; + sprintf(tmpChan->videoFile,file); + sprintf(tmpChan->videoChanTitle,"%s's Pick -> [%s - %s]",nick,vid,artist,title); + sprintf(tmpChan->videoTitle,"%s - %s",artist,title); - tmpChan = findChan(chan); - tmpChan->songTime = atoi(playTime); - tmpChan->songEnd = atoi(playTime) + time(NULL) + 2; - sprintf(tmpChan->curSong,file); - sprintf(tmpChan->songTitle,title); + sprintf(output,"CURPOS:0:%s:%s:%i:%i\n",file,tmpChan->videoTitle,length,vid); + writeLog(0,"[%s][%s]\n",output,channel); + tuveSendAllInChan(channel,0x0,output); + + sprintf(output,"MSG:TUveD:%s:Playing %s (%d:%.2d)\n",channel,tmpChan->videoChanTitle,min,sec); + tuveSendAllInChan(channel,0x0,output); tmpChan->nextUser = tmpChan->nextUser->next; if (tmpChan->nextUser == 0x0) diff --git a/channel.c b/channel.c index f515ab1..4996b58 100644 --- a/channel.c +++ b/channel.c @@ -24,7 +24,7 @@ sSendData(userConnection,data); for (tmpChan = channels;tmpChan != 0x0;tmpChan = tmpChan->next) { - sprintf(data,"LIST:%s:%i:%s\n",tmpChan->channel,tmpChan->userCount,tmpChan->topic); + sprintf(data,"LIST:%s:%i:%s:%s\n",tmpChan->channel,tmpChan->userCount,tmpChan->topic,tmpChan->videoTitle); sSendData(userConnection,data); } return(0x0); @@ -85,13 +85,13 @@ tmpChan = findChan(channel); assert(tmpChan); - sprintf(output,"CURPOS:%i:%s:%s:%i\n",tmpChan->songTime - (tmpChan->songEnd - (time(NULL) + 2)),tmpChan->curSong,tmpChan->songTitle,tmpChan->songTime); + sprintf(output,"CURPOS:%i:%s:%s:%i:%i\n",tmpChan->songTime - (tmpChan->videoEnd - (time(NULL) + VIDE_PAD_TIME)),tmpChan->videoFile,tmpChan->videoTitle,tmpChan->songTime,tmpChan->vid); sSendData(userConnection,output); min = tmpChan->songTime / 60; sec = tmpChan->songTime % 60; - sprintf(output,"MSG:@TUveBOT:%s:Playing %s (%i:%.2i)\n",channel,tmpChan->songTitle,min,sec); + sprintf(output,"MSG:TUveD:%s:Playing %s (%i:%.2i)\n",channel,tmpChan->videoChanTitle,min,sec); sSendData(userConnection,output); /* Notify people in the channel that someone has joined */ @@ -273,7 +273,7 @@ tmpChannel->userCount++; memset(output,0x0,256); - sprintf(output,"JOIN:%s:@TUveBOT",tmpChannel->channel); + //sprintf(output,"JOIN:%s:@TUveBOT",tmpChannel->channel); /* Send the new user the channel list */ for (tmpUsers = tmpChannel->users;tmpUsers != 0x0;tmpUsers = tmpUsers->next) { @@ -326,6 +326,12 @@ else sprintf(output,"MODE:%s:R:0\n",tmpChannel->channel); sSendData(userConnection,output); + + sprintf(output,"MODE:%s:A:%i\n",tmpChannel->channel,tmpChannel->modes[CHAN_RATING]); + sSendData(userConnection,output); + + sprintf(output,"MODE:%s:C:%i\n",tmpChannel->channel,tmpChannel->modes[CHAN_CLASS]); + sSendData(userConnection,output); writeLog(2,"Added user: %s to Channel: %s\n",userConnection->userInfo.username,channel); @@ -369,13 +375,15 @@ channels->prev = 0x0; channels->users = 0x0; channels->modes[CHAN_QUEUE] = 0x1; + channels->modes[CHAN_RATING] = 0x2; + channels->modes[CHAN_CLASS] = 0x1; sprintf(channels->channel,channel); sprintf(channels->topic,"No Topic Set"); sprintf(channels->topicSetBy,"TUveD"); channels->topicSet = time(NULL); - sprintf(channels->songTitle,"No Video"); - sprintf(channels->curSong,"NA"); - channels->songEnd = 0x0; + sprintf(channels->videoChanTitle,"No Video"); + sprintf(channels->videoFile,"NA"); + channels->videoEnd = 0x0; writeLog(2,"ADDED CHAN1\n"); tmpChannel = channels; } @@ -385,13 +393,15 @@ sprintf(tmpChannel->topic,"No Topic Set"); sprintf(tmpChannel->topicSetBy,"TUveD"); tmpChannel->topicSet = time(NULL); - sprintf(tmpChannel->songTitle,"NoVideo"); - sprintf(tmpChannel->curSong,"NA"); - tmpChannel->songEnd = 0x0; + sprintf(tmpChannel->videoChanTitle,"NoVideo"); + sprintf(tmpChannel->videoFile,"NA"); + tmpChannel->videoEnd = 0x0; tmpChannel->next = channels; tmpChannel->prev = 0x0; tmpChannel->users = 0x0; tmpChannel->modes[CHAN_QUEUE] = 0x1; + tmpChannel->modes[CHAN_RATING] = 0x2; + tmpChannel->modes[CHAN_CLASS] = 0x1; channels->prev = tmpChannel; channels = tmpChannel; writeLog(2,"ADDED CHAN2\n"); diff --git a/main.c b/main.c index bdf595a..ab145a2 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ /* - Podz Server + Tuved Server $Id$ */ @@ -114,7 +114,7 @@ } void usage() { - printf("%s\n","usage: podzd -n -s [-l logfile] [-d debuglevel]"); + printf("%s\n","usage: tuved -n -s [-l logfile] [-d debuglevel]"); exit(1); } diff --git a/mysql.c b/mysql.c index e542469..b8a4035 100644 --- a/mysql.c +++ b/mysql.c @@ -4,6 +4,8 @@ MYSQL *conn = 0x0; +pthread_mutex_t mysqlMutex = PTHREAD_MUTEX_INITIALIZER; + int dbInit() { @@ -18,6 +20,12 @@ return(0x1); } + if (mysql_options(conn,MYSQL_OPT_RECONNECT,"true") != 0x0) { + writeLog(0,"mysql_options() failed: To Set Reconnect\n"); + } + + pthread_mutex_init(&mysqlMutex, NULL); + writeLog(0,"Sucessful connection to the MySQL Database.\n"); return(0x0); @@ -26,17 +34,23 @@ MYSQL_RES *dbQuery(const char *query) { MYSQL_RES *res_set = 0x0; + pthread_mutex_lock(&mysqlMutex); + writeLog(0,"Query: %s\n",query); if (mysql_query(conn,query) != 0x0) { writeLog(0,"mysql_query() failed: Error %u (%s)\n.", mysql_errno(conn), mysql_error(conn)); + pthread_mutex_unlock(&mysqlMutex); return(0x0); } res_set = mysql_store_result(conn); - if (res_set != 0x0) { - return(res_set); + if (res_set == 0x0) { + writeLog(0,"mysql_store_result() failed: Error %u (%s)\n.", mysql_errno(conn), mysql_error(conn)); + pthread_mutex_unlock(&mysqlMutex); + return(0x0); } - return (0x0); + pthread_mutex_unlock(&mysqlMutex); + return(res_set); } diff --git a/socket.c b/socket.c index 88a1baf..574bf27 100644 --- a/socket.c +++ b/socket.c @@ -99,7 +99,6 @@ if (connections == 0x0) { connections = (myConnections_t *)calloc(1,sizeof(myConnections_t)); - //memset(connections,0x0,sizeof(myConnections_t)); connections->prev = 0x0; connections->next = 0x0; connections->fd = socketFD; @@ -263,7 +262,6 @@ myConnections_t *tmpConnection = 0x0; for (tmpConnection = connections;tmpConnection != 0x0;tmpConnection = tmpConnection->next) { - writeLog(3,"socketFD: [%i]\n",tmpConnection->fd); if (FD_ISSET(tmpConnection->fd,readset) != 0x0) { writeLog(2,"FD_ISSET\n"); if (tmpConnection->fd == listenerFD) { diff --git a/tuve.c b/tuve.c index c5bf3b3..25e2b4f 100644 --- a/tuve.c +++ b/tuve.c @@ -44,7 +44,6 @@ char *cmd = 0x0; char *msg = 0x0; char *data = 0x0; - char *title = 0x0; char *tok_last = 0x0; char output[1280]; char buffer[1024]; @@ -85,12 +84,14 @@ else userConnection->userInfo.uid = atoll(msg); userConnection->userInfo.ident = 0x1; + + sSendData(userConnection,"IDENT:0:Success\n"); } else - sSendData(userConnection,"IDENT:Nick In Use.\n"); + sSendData(userConnection,"IDENT:1:Nick In Use.\n"); } else { - sSendData(userConnection,"IDENT:Invalid Ident.\n"); + sSendData(userConnection,"IDENT:1:Invalid Ident.\n"); } return(0x0); } @@ -186,23 +187,24 @@ if (data != 0x0) { if (tuveVerifyNick(data) == 0x0) { sprintf(output,"NICK:%s:%s\n",userConnection->userInfo.username,data); + sSendData(userConnection,output); tuveSendAllInUsersChans(userConnection,output); - sprintf(output,"MSG:TUveD:NICK:%s is now know as %s\n",userConnection->userInfo.username,data); + sprintf(output,"MSG:TUveD:STATUS:%s is now know as %s\n",userConnection->userInfo.username,data); tuveSendAllInUsersChans(userConnection,output); sprintf(userConnection->userInfo.username,data); } else - sSendData(userConnection,"Nick In Use\n"); + sSendData(userConnection,"MSG:TUveD:STATUS:Nick In Use\n"); } else { - sSendData(userConnection,"Invalid Nick\n"); + sSendData(userConnection,"MSG:TUveD:STATUS:Invalid Nick\n"); } } else if (strcasecmp(cmd,"KICK") == 0x0) { tok_last = 0x0; if (userConnection->userInfo.mode != 1) { - sSendData(userConnection,"MSG:@TUveBOT:KICK:You do not have permission to kick!\n"); + sSendData(userConnection,"MSG:TUveD:KICK:You do not have permission to kick!\n"); } else { if (data == 0x0) @@ -227,16 +229,18 @@ if (data != 0x0) tuveSendAllInChan(data,userConnection,output); } - else if (strcasecmp(cmd,"NEXTSONG") == 0x0) { - tok_last = 0x0; - chan = strtok_r(data,":",&tok_last); - msg = strtok_r(NULL,":",&tok_last); - nick = strtok_r(NULL,":",&tok_last); - title = strtok_r(NULL,"\n",&tok_last); - tuveBotSetSong(chan,msg,nick,title); - } - else if (strcasecmp(cmd,"NOSONG") == 0x0) { - tuveBotNoSong(data); + else if (strcasecmp(cmd,"VIDEO") == 0x0) { + if (data != 0x0) { + tok_last = 0x0; + chan = strtok_r(data,":",&tok_last); + msg = strtok_r(NULL,"\n",&tok_last); + if (msg == 0x0) + sSendData(userConnection,"MSG:TuveD:STATUS:Missing VID\n"); + else + tuveBotSetVideo(chan,userConnection->userInfo.username,atoi(msg)); + } + else + sSendData(userConnection,"MSG:TUveD:STATUS:Invalid VIDEO syntax.\n"); } else if (strcasecmp(cmd,"PART") == 0x0) { if (data != 0x0) { diff --git a/tuved.h b/tuved.h index 7dcab1c..7376d84 100644 --- a/tuved.h +++ b/tuved.h @@ -29,9 +29,14 @@ #define MYSQL_USERNAME "tuve" #define MYSQL_PASSWORD "5558585" #define MYSQL_DB_NAME "tuve" +#define VIDE_PAD_TIME 2 // Time Added To Video End To Ensure All Are In Sync + +#define CHAN_MODES 5 #define CHAN_RANDOM 0 #define CHAN_QUEUE 1 #define CHAN_TIME 2 +#define CHAN_RATING 3 +#define CHAN_CLASS 4 typedef struct tuveUserList { struct tuveUserList *prev; @@ -45,16 +50,18 @@ struct tuveUserList *users; struct tuveUserList *nextUser; long long bans[MAX_BANS]; - char modes[10]; + char modes[CHAN_MODES]; time_t topicSet; char topicSetBy[MAX_USER_LEN]; char topic[MAX_TOPIC_LEN]; char channel[MAX_CHAN_LEN]; - char curSong[256]; - char songTitle[256]; - int songEnd; + char videoFile[256]; // File Name Of Video + char videoChanTitle[256]; // Video Title Displayed In The Channel w/ Links + char videoTitle[256]; // Video Title w/o Links + int videoEnd; // Time At Which The Server Considers The Video Has Ended int songTime; int userCount; + int vid; short count; short maxTime; } tuveChanList_t; @@ -146,8 +153,8 @@ /* Bot Functions */ void *tuveBotThread(void *threadid); int tuveBotCMD(myConnections_t *userConnection,char *chan,char *data); -int tuveBotSetSong(char *chan,char *playTime,char *file,char *title); -int tuveBotNoSong(char *chan); +int tuveBotSetSong(char *channel,char *nick,char *artist,char *title,int length,char *file,int vid); +int tuveBotSetVideo(char *chan,char *nick,int vid); /* Nick Functions */ int tuveVerifyNick(char *nick);