diff --git a/botthread.c b/botthread.c index 1ee3fe5..2ecba77 100644 --- a/botthread.c +++ b/botthread.c @@ -4,7 +4,7 @@ #include "tuved.h" -int playCnt = 0; +//int playCnt = 0; int nextSong(); int chanMaint(); @@ -216,7 +216,7 @@ if (tmpChan->modes[CHAN_LIVE] == 0x1) return(0x0); - dOvr: + //dOvr: //sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i AND count <= %i",tmpChan->modes[CHAN_RATING],tmpChan->modes[CHAN_CLASS],playCnt); sprintf(output,"SELECT artist,title,file,length,vid,classification,rating,count FROM videos WHERE rating <= %i AND classification = %i",tmpChan->modes[CHAN_RATING],tmpChan->modes[CHAN_CLASS]); res = dbQuery(output,1); @@ -225,8 +225,10 @@ tuveSendAllInChan(chan,0x0,output); } else if (mysql_num_rows(res) == 0x0) { - playCnt++; - goto dOvr; + //playCnt++; + //goto dOvr; + sprintf(output,"MSG:TUveD:%s:Sorry There Are No Videos Available At The Current Channel Settings.",chan); + tuveSendAllInChan(chan,0x0,output); } else { mysql_data_seek(res,(random() % mysql_num_rows(res))); diff --git a/channel.c b/channel.c index c2eb725..1b5e7e7 100644 --- a/channel.c +++ b/channel.c @@ -260,6 +260,22 @@ free(tmpUsers); writeLog(3,"User Freed\n"); + + if (tmpChannel->users == 0x0) { + writeLog(3,"Channel %s Has No More Users Freeing.\n",tmpChannel->channel); + + if (tmpChannel->prev != 0x0) + tmpChannel->prev->next = tmpChannel->next; + else + channels = tmpChannel->next; + + if (tmpChannel->next != 0x0) + tmpChannel->next->prev = tmpChannel->prev; + + free(tmpChannel); + + writeLog(3,"Channel Freed.\n"); + } pthread_mutex_unlock(&chanMutex); return(0x0); }