-/* ChanNode.c - NeonServ v5.0
+/* ChanNode.c - NeonServ v5.2
* Copyright (C) 2011 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
#include "BanNode.h"
#include "modcmd.h"
#include "ModeNode.h"
+#include "bot_NeonSpam.h"
static struct ChanNode **chanList;
next = chan->next;
for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = next_chanuser) {
next_chanuser = getChannelUsers(chan, chanuser);
- free(chanuser);
+ freeChanUser(chanuser);
}
freeChanNode(chan);
}
return 46;
}
+struct ChanNode* getAllChans(struct ChanNode *last) {
+ if(last == NULL || last->next == NULL) {
+ int cindex;
+ if(last == NULL)
+ cindex = 0;
+ else
+ cindex = get_chanlist_entry(last->name[1]) + 1;
+ while(chanList[cindex] == NULL && cindex < CHANNEL_LIST_SIZE)
+ cindex++;
+ if(cindex >= CHANNEL_LIST_SIZE) return NULL;
+ return chanList[cindex];
+ } else
+ return last->next;
+}
+
struct ChanNode* getChanByName(const char *name) { //case insensitive
int chanListIndex = get_chanlist_entry(name[1]);
if(chanListIndex == -1 || chanList[chanListIndex] == NULL)
strcpy(chan->name, name);
chan->user = NULL;
chan->bans = NULL;
+ chan->spam_settings = NULL;
chan->usercount = 0;
chan->chanbot = NULL;
chan->topic[0] = 0;
freeModeNode(chan->modes);
if(chan->bans)
removeChannelBans(chan);
+ if(chan->spam_settings)
+ freeNeonSpamSettings(chan->spam_settings);
free(chan);
}
//free the user (no more channels)
delUser(chanuser->user, 1);
}
- free(chanuser);
+ freeChanUser(chanuser);
}
chan->user = NULL;
delChannel(chan, 1);