Roxen.git / server / etc / modules / Variable.pmod / module.pmod

version» Context lines:

Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1: - // $Id: module.pmod,v 1.116 2009/07/02 14:12:55 jonasw Exp $ + // $Id: module.pmod,v 1.117 2009/10/13 11:55:27 mast Exp $      #include <module.h>   #include <roxen.h>      // Locale macros   //<locale-token project="roxen_config"> LOCALE </locale-token>      #define LOCALE(X,Y) \    ([string](mixed)Locale.translate("roxen_config",roxenp()->locale->get(),X,Y))   
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1432:   }      //! Select a module in the current configuration.   class ModuleChoice   {    inherit StringChoice;    constant type = "ModuleChoice";    protected Configuration conf;    protected string module_id;    protected string default_id; +  protected int automatic_dependency;       int low_set(RoxenModule to)    {    RoxenModule old = changed_values[_id];    if (!old) {    if (module_id) {    old = transform_from_form(module_id);    } else {    old = default_value();    if (old) {
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1463:    if( get_changed_callback() )    get_changed_callback()( this_object() );    return 1;    }       // NOTE: Will be called with a string at module init!    int set(string|RoxenModule to)    {    if (stringp(to)) {    module_id = to; -  to = transform_from_form(to); +  RoxenModule mod = transform_from_form (to); +  if (!mod && automatic_dependency && conf->enabled_modules[to]) { +  conf->add_modules (({to}), 1); +  mod = transform_from_form (to);    } -  +  if (!mod && conf->enabled_modules[to]) +  // The module exists but isn't started yet. Don't call set() +  // in this case since that will cause a bogus warning. +  return 0; +  to = mod; +  }    return ::set(to);    }       RoxenModule query()    {    RoxenModule res = changed_values[_id];    if (!res) {    if (module_id) {    // The module might have been reloaded.    // Try locating it again.
Roxen.git/server/etc/modules/Variable.pmod/module.pmod:1545:    if (!new_value) {    return ({ "Not configured", 0 });    }    return ({ 0, new_value });    }       //! @param default_id    //! The @[RoxenModule.module_local_id] of the default value.    //! @param conf    //! The current configuration. +  //! @param no_automatic_dependency +  //! Do not automatically depend on the chosen module. Normally, if +  //! it already exists in the configuration then it will be loaded +  //! before @expr{start@} in this module is called. Setting this +  //! flag disables that.    protected void create(string default_id, int flags,    string std_name, string std_doc, -  Configuration conf) +  Configuration conf, +  void|int no_automatic_dependency)    {    this_program::default_id = default_id;    this_program::conf = conf; -  +  automatic_dependency = !no_automatic_dependency;    ::create(0, ({}), flags, std_name, std_doc);    }   }      //! Select a module that provides the specified interface.   class ProviderChoice   {    inherit ModuleChoice;    constant type = "ProviderChoice";    protected string provides;