+static MODCMD_FUNC(chan_opt_unreviewed)
+{
+ struct chanData *cData = channel->channel_info;
+ int value = (cData->flags & CHANNEL_UNREVIEWED) ? 1 : 0;
+
+ if(argc > 1)
+ {
+ int new_value;
+
+ /* The two directions can have different ACLs. */
+ if(enabled_string(argv[1]))
+ new_value = 1;
+ else if(disabled_string(argv[1]))
+ new_value = 0;
+ else
+ {
+ reply("MSG_INVALID_BINARY", argv[1]);
+ return 0;
+ }
+
+ if (new_value != value)
+ {
+ struct svccmd *subcmd;
+ char subcmd_name[32];
+
+ snprintf(subcmd_name, sizeof(subcmd_name), "%s %s", argv[0], (new_value ? "on" : "off"));
+ subcmd = dict_find(cmd->parent->commands, subcmd_name, NULL);
+ if(!subcmd)
+ {
+ reply("MSG_COMMAND_DISABLED", subcmd_name);
+ return 0;
+ }
+ else if(!svccmd_can_invoke(user, cmd->parent->bot, subcmd, channel, SVCCMD_NOISY))
+ return 0;
+
+ if (new_value)
+ cData->flags |= CHANNEL_UNREVIEWED;
+ else
+ {
+ free(cData->registrar);
+ cData->registrar = strdup(user->handle_info->handle);
+ cData->flags &= ~CHANNEL_UNREVIEWED;
+ }
+ value = new_value;
+ }
+ }
+
+ if(value)
+ reply("CSMSG_SET_UNREVIEWED", user_find_message(user, "MSG_ON"));
+ else
+ reply("CSMSG_SET_UNREVIEWED", user_find_message(user, "MSG_OFF"));
+ return 1;
+}
+