+ /* Evaluate modes strings with fake requests */
+ if(conf_chan->modes_num) {
+ /* Prepare fake request structure */
+ strlcpy(name, conf_chan->name, sizeof(name));
+ Log(LOG_INFO, "Evaluating predefined channel modes for \"%s\".", name);
+ Req.argv[0] = name;
+ Req.prefix = Client_ID(Client_ThisServer());
+ Req.command = "MODE";
+
+ /* Iterate over channel modes strings */
+ for (n = 0; n < conf_chan->modes_num; n++) {
+ Req.argc = 1;
+ strlcpy(modes, conf_chan->modes[n], sizeof(modes));
+ Log(LOG_DEBUG, "Evaluate \"MODE %s %s\".", name, modes);
+ c = strtok(modes, " ");
+ while (c && Req.argc < 15) {
+ Req.argv[Req.argc++] = c;
+ c = strtok(0, " ");
+ }
+ if(Req.argc > 1)
+ IRC_MODE(Client_ThisServer(), &Req);
+
+ /* Original channel modes srings are no longer needed */
+ free(conf_chan->modes[n]);
+ }
+ }