diff --git a/botthread.c b/botthread.c index 972c11e..4a24356 100644 --- a/botthread.c +++ b/botthread.c @@ -26,8 +26,10 @@ } else if (strcasecmp(cmd,"skip") == 0x0) { tmpChan = findChan(cmdData); - if (tmpChan != 0x0) + if (tmpChan != 0x0) { tmpChan->songEnd = 0x0; + tmpChan->count = MAX_COUNT; + } } else if (strcasecmp(cmd,"login") == 0x0) { if (!strcmp(cmdData,"b00b5")) { @@ -62,22 +64,35 @@ int botNextSong() { tuveChanList_t *tmpChans; + tuveUserList_t *tmpUser; pthread_mutex_lock(&chanMutex); for (tmpChans = channels;tmpChans != 0x0;tmpChans = tmpChans->next) { if (tmpChans->songEnd < time(NULL)) { + tmpUser = tmpChans->nextUser; + findUser: if (tmpChans->nextUser != 0x0) { if (tmpChans->count == MAX_COUNT) { tmpChans->nextUser = tmpChans->nextUser->next; if (tmpChans->nextUser == 0x0) tmpChans->nextUser = tmpChans->users; tmpChans->count = 0x0; + if (tmpChans->nextUser != 0x0) + goto gotUser; } else { - sSendData(tmpChans->nextUser->user,"GETSONG\n"); - writeLog(0,"Need To Find Next Song For: %s, From User: %s\n",tmpChans->channel,tmpChans->nextUser->user->userInfo.username); - tmpChans->count++; + gotUser: + if (tmpChans->nextUser->user->userInfo.queue == 0x1) { + sSendData(tmpChans->nextUser->user,"GETSONG\n"); + writeLog(0,"Need To Find Next Song For: %s, From User: %s\n",tmpChans->channel,tmpChans->nextUser->user->userInfo.username); + tmpChans->count++; + } + else { + tmpChans->count = MAX_COUNT; + if (tmpUser != tmpChans->nextUser) + goto findUser; + } } } else diff --git a/nick.c b/nick.c index e389e21..79f94ac 100644 --- a/nick.c +++ b/nick.c @@ -73,7 +73,7 @@ memset(output,0x0,256); for (chans = user->userInfo.chans;chans != 0x0;chans = chans->next) { if (strlen(output) == 0) - sprintf(output,"MSG:TUveD:STATUS:%s Is On %s",user->userInfo.username,chans->channel); + sprintf(output,"MSG:TUveD:STATUS:%s Is on channels %s",user->userInfo.username,chans->channel); else sprintf(output,"%s,%s",output,chans->channel); } diff --git a/tuve.c b/tuve.c index 06f2a37..827a85b 100644 --- a/tuve.c +++ b/tuve.c @@ -269,6 +269,14 @@ tuveUnBan(chan,nick); } } + else if (strcasecmp(cmd,"QUEUE") == 0x0) { + if (data != 0x0) { + if (strcasecmp(data,"FULL") == 0x0) + userConnection->userInfo.queue = 1; + else + userConnection->userInfo.queue = 0; + } + } else { sSendData(userConnection,"invalid command\n"); writeLog(1,"Invalid CMD: [%s]\n",cmd); diff --git a/tuved.h b/tuved.h index b4ac398..e1f66d0 100644 --- a/tuved.h +++ b/tuved.h @@ -56,10 +56,11 @@ } tuveUserChans_t; typedef struct tuveUser { - short ident; + short ident; short pfailed; short status; short mode; + short queue; long long uid; time_t pong; time_t idle;