return 0;
}
}
-
+
+ /*
+ * don't cleanup the last channel to prevent channel id reuse.
+ * the channel will be orphaned but will be cleaned up by cleanup eventually
+ */
+ if(rcp->ID == lastchannelID) {
+ cs_log(sender,"DELCHAN FAILED %s (last id)",rcp->index->name->content);
+ return 0;
+ }
+
cs_log(sender,"DELCHAN %s (Empty)",rcp->index->name->content);
cs_removechannel(rcp, "Last user removed - channel deleted.");
return 1;
}
-regchan *cs_addchan(chanindex *cip, nick *sender, reguser *addedby, reguser *founder, flag_t flags, short type) {
+regchan *cs_addchan(chanindex *cip, nick *sender, reguser *addedby, reguser *founder, flag_t flags, flag_t forcemodes, flag_t denymodes, short type) {
regchan *rcp;
regchanuser *rcup;
void *args[3];
rcp->lastcountersync=0;
rcp->limit=0;
- rcp->forcemodes=CHANMODE_DEFAULT;
- rcp->denymodes=0;
+ rcp->forcemodes=forcemodes;
+ rcp->denymodes=denymodes;
if (CIsAutoLimit(rcp)) {
rcp->forcemodes |= CHANMODE_LIMIT;