void hchannel_conf_change(hchannel *hchan, int old_flags) { int i; hflagchange change; for (i=0;i<HCHANNEL_CONF_COUNT;i++) { if ((hchan->flags ^ old_flags) & (1 << i)) { change = (hchan->flags & (1 << i))?H_ON:H_OFF; switch (1 << i) { case H_QUEUE: hchannel_mode_check(hchan); if (change == H_ON) helpmod_message_channel(hchan, "Channel queue has been activated, all users enqueued"); else helpmod_message_channel(hchan, "Channel queue has been deactivated"); break; case H_MAINTAIN_I: case H_MAINTAIN_M: hchannel_mode_check(hchan); break; } } } }
int helpmod_config_read_channel(FILE *in) { hchannel *hchan; char buf[256],*ptr=(char*)buf; int flags, entries, idlekick, i; /* name */ fgets(buf, 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); hchan = hchannel_add(ptr); /* flags */ fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); if (sscanf(ptr, "%x", (unsigned int*)&flags) != 1) return -1; hchan->flags = flags; /* welcome message */ fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); strcpy(hchan->welcome, ptr); /* lamercontrol profile */ fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); hchan->lc_profile = hlc_get(ptr); if (hconf_version >= HELPMOD_VERSION_2_11) { fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); if (sscanf(ptr, "%d", &idlekick) != 1) return -1; hchan->max_idle = idlekick; fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); hchan->ticket_message = getsstring(ptr,strlen(ptr)); } /* censor entries for channel, a bit complex */ fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); if (sscanf(ptr, "%d", &entries) != 1) return -1; for (i = 0;i<entries;i++) { char buf2[512], *ptr2; int type; fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); if (hconf_version >= HELPMOD_VERSION_2_10) { if (!sscanf(ptr, "%d", &type)) return -1; fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); } else type = HCENSOR_KICK; fgets((ptr2 = buf2), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr2); if (ptr2[0] == '\0') ptr2 = NULL; hcensor_add(&hchan->censor, ptr, ptr2, type); } /* channel specific hterms */ fgets((ptr = buf), 256, in); if (feof(in)) return -1; helpmod_line_fix(&ptr); if (sscanf(ptr, "%d", &entries) != 1) return -1; for (i=0;i<entries;i++) helpmod_config_read_term(in, &hchan->channel_hterms); helpmod_config_read_chanstats(in, hchan->stats); /* needs to be done here */ hchannel_mode_check(hchan); return 0; }