src/spbot/config.c
author Tero Marttila <terom@fixme.fi>
Wed, 27 May 2009 23:57:48 +0300
branchnew-lib-errors
changeset 217 7728d6ec3abf
parent 158 src/config.c@b5a5df4f4421
permissions -rw-r--r--
nexus.c compiles
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
#include "config.h"
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
#include <string.h>
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
     4
#include <assert.h>
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
     6
const struct error_list config_errors = ERROR_LIST("config",
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
     7
    ERROR_TYPE_STRING(  ERR_CONFIG_NAME,        "unknown config option"         ),
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
     8
    ERROR_TYPE(         ERR_CONFIG_TYPE,        "invalid config type"           ),
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
     9
    ERROR_TYPE_STRING(  ERR_CONFIG_REQUIRED,    "missing required value"        ),
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    10
    ERROR_TYPE_STRING(  ERR_CONFIG_VALUE,       "invalid value"                 ),
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    11
    ERROR_TYPE(         ERR_CONFIG_PARAMS,      "invalid number of paramters"   )
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    12
);
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    13
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    14
const struct config_option* config_lookup (const struct config_option *options, const char *name, error_t *err)
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    15
{
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    16
    const struct config_option *option;
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    17
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    18
    // find the matching config opt
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    19
    for (option = options; option->name; option++) {
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
        if (strcmp(option->name, name) == 0)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    21
            return option;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    22
    }
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    23
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    24
    // not found
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    25
    SET_ERROR_STR(err, &config_errors, ERR_CONFIG_NAME, name);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    26
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    27
    return NULL;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    28
}
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    29
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    30
int config_params_count (const struct config_option *option)
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    31
{
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    32
    const struct config_param *param;
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    33
    int count = 0;
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    34
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    35
    // handle each param
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    36
    for (param = option->params; param->name && param->type; param++)
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    37
        count++;
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    38
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    39
    return count;
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    40
}
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    41
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    42
/**
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    43
 * Parse a raw value for a CONFIG_IRC_CHAN into an irc_chan
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    44
 */
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    45
static struct irc_chan* config_parse_irc_chan (struct nexus *nexus, char *raw_value, error_t *err)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    46
{
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    47
    const char *network, *channel;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    48
    struct irc_chan *chan;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    49
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    50
    // XXX: wrong error code
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    51
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    52
    // parse required args
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    53
    if ((network = strsep(&raw_value, "/")) == NULL)
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    54
        JUMP_SET_ERROR_STR(err, &config_errors, ERR_CONFIG_VALUE, "invalid <network> for CONFIG_IRC_CHAN value");
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    55
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    56
    if ((channel = strsep(&raw_value, "/")) == NULL)
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    57
        JUMP_SET_ERROR_STR(err, &config_errors, ERR_CONFIG_VALUE, "invalid <channel> for CONFIG_IRC_CHAN value");
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    58
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    59
    // extraneous stuff?
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    60
    if (raw_value)
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    61
        JUMP_SET_ERROR_STR(err, &config_errors, ERR_CONFIG_VALUE, "trailing data for CONFIG_IRC_CHAN value");
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    62
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    63
    // get the channel?
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    64
    if ((chan = irc_client_get_chan(nexus->client, network, channel)) == NULL)
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    65
        JUMP_SET_ERROR_STR(err, &config_errors, ERR_CONFIG_VALUE, "unknown network/channel name for CONFIG_IRC_CHAN value");
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    66
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    67
    // ok
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    68
    return chan;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    69
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    70
error:
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    71
    return NULL;    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    72
}
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    73
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    74
err_t config_parse_param (const struct config_param *param, struct nexus *nexus, struct config_value *value, char *raw_value, error_t *err)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    75
{
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    76
    // parse the value 
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
    77
    switch (param->type) {
158
b5a5df4f4421 don't assert on CONFIG_INVALID in config_parse_param
Tero Marttila <terom@fixme.fi>
parents: 154
diff changeset
    78
        case CONFIG_INVALID:
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    79
            return SET_ERROR_STR(err, &config_errors, ERR_CONFIG_TYPE, "invalid value for invalid type (too many values?)");
158
b5a5df4f4421 don't assert on CONFIG_INVALID in config_parse_param
Tero Marttila <terom@fixme.fi>
parents: 154
diff changeset
    80
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    81
        case CONFIG_STRING:
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    82
            // simple!
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    83
            value->string = raw_value;
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    84
            break;
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    85
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    86
        case CONFIG_IRC_CHAN:
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    87
            // parse the value
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    88
            if (!(value->irc_chan = config_parse_irc_chan(nexus, raw_value, err)))
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    89
                return error_code(err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    90
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    91
            break;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    92
        
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    93
        case CONFIG_USER:
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    94
            // fail
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    95
            return SET_ERROR_STR(err, &config_errors, ERR_CONFIG_TYPE, "user type can't be parsed");
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
    96
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
    97
        default:
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
    98
            NOT_REACHED(param->type);
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    99
    }
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   100
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   101
    // copy the type
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   102
    value->type = param->type;
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   103
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   104
    // ok
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   105
    return SUCCESS; 
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   106
}
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   107
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   108
err_t config_parse (const struct config_option *option, struct nexus *nexus, struct config_value *value, char *raw_value, error_t *err)
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   109
{
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   110
    // use the first param
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   111
    const struct config_param *param = &option->params[0];
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   112
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   113
    // must have exactly one param
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   114
    if (!param->type || (param + 1)->type)
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   115
        return SET_ERROR(err, &config_errors, ERR_CONFIG_PARAMS);
122
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   116
    
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   117
    // parse it
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   118
    return config_parse_param(param, nexus, value, raw_value, err);
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   119
}
52ffbdb6bba1 start implementing multiple args for lua_module_conf
Tero Marttila <terom@fixme.fi>
parents: 121
diff changeset
   120
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   121
err_t config_apply_opt (const struct config_option *option, void *ctx, const struct config_value values[], error_t *err)
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   122
{
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   123
    const struct config_param *param;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   124
    const struct config_value *value;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   125
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   126
    // handle each param
124
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   127
    for (param = option->params, value = values; param->name && param->type; param++) {
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   128
        // no value given, or value given as NULL?
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   129
        if (!value->type || value->type == CONFIG_NULL) {
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   130
            if (param->optional) {
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   131
                // optional, so just ignore the value 
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   132
                
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   133
            } else {
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   134
                // required
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   135
                JUMP_SET_ERROR_STR(err, &config_errors, ERR_CONFIG_REQUIRED, param->name);
124
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   136
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   137
            }
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   138
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   139
        } else if (param->type != value->type) {
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   140
            // invalid type, XXX: also report correct type name?
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   141
            JUMP_SET_ERROR(err, &config_errors, ERR_CONFIG_TYPE);
124
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   142
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   143
        } else if (param->is_handler) {
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   144
            // only applicable for non-optional args
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   145
            err_t tmp;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   146
            
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   147
            // invoke the handler
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   148
            switch (param->type) {
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   149
                case CONFIG_STRING:     tmp = param->func.string(ctx, value->string, err); break;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   150
                case CONFIG_IRC_CHAN:   tmp = param->func.irc_chan(ctx, value->irc_chan, err); break;
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   151
                default:                NOT_REACHED(param->type);
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   152
            }
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   153
            
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   154
            // abort on errors
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   155
            if (tmp)
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   156
                goto error;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   157
        }
124
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   158
        
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   159
        // the values list is NULL-terminated, and optional params can be left off
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   160
        if (value->type)
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   161
            value++;
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   162
    }
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   163
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   164
    // the option's handler?
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   165
    if (option->func && option->func(ctx, option, values, err))
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   166
        goto error;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   167
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   168
    // ok
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   169
    return SUCCESS;
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   170
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   171
error:
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   172
    return error_code(err);
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   173
}
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   174
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   175
err_t config_apply (const struct config_option *options, void *ctx, const char *name, const struct config_value values[], error_t *err)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   176
{
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   177
    const struct config_option *option;
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   178
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   179
    // no matching option found?
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   180
    if (!(option = config_lookup(options, name, err)))
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   181
        return error_code(err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   182
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   183
    // apply it    
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   184
    return config_apply_opt(option, ctx, values, err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   185
}
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   186
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   187
err_t config_apply_string (const struct config_option *options, void *ctx, const char *name, char *value, error_t *err)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   188
{
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   189
    struct config_value conf_value[] = {
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   190
        CONFIG_VALUE_STRING(value),
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   191
        CONFIG_VALUE_END,
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   192
    };
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   193
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   194
    return config_apply(options, ctx, name, conf_value, err);
83
c8e2dac08207 add config module and modify irc_log/nexus to use it
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
   195
}
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   196
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   197
err_t config_apply_irc_chan (const struct config_option *options, void *ctx, const char *name, struct irc_chan *value, error_t *err)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   198
{
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   199
    struct config_value conf_value[] = {
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   200
        CONFIG_VALUE_IRC_CHAN(value),
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   201
        CONFIG_VALUE_END,
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   202
    };
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   203
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   204
    return config_apply(options, ctx, name, conf_value, err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   205
}
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   206
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   207
err_t config_apply_raw (const struct config_option options[], struct nexus *nexus, void *ctx, const char *name, char *raw_value, error_t *err)
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   208
{
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   209
    const struct config_option *option;
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   210
    struct config_value value[2] = {
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   211
        CONFIG_VALUE_END,
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   212
        CONFIG_VALUE_END,
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   213
    };
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   214
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   215
    // no matching option found?
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   216
    if (!(option = config_lookup(options, name, err)))
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   217
        return error_code(err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   218
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   219
    // parse it
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   220
    if (config_parse(option, nexus, &value[0], raw_value, err))
217
7728d6ec3abf nexus.c compiles
Tero Marttila <terom@fixme.fi>
parents: 158
diff changeset
   221
        return error_code(err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   222
    
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   223
    // apply it
120
576bab0a1c5a modify config to support options with multiple params/values
Tero Marttila <terom@fixme.fi>
parents: 100
diff changeset
   224
    return config_apply_opt(option, ctx, value, err);
100
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   225
}
cfb7776bd6f0 improve the config module futher, now the module_desc interface uses structured config_value's
Tero Marttila <terom@fixme.fi>
parents: 83
diff changeset
   226
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   227
const struct config_value* config_get_value (const struct config_option *option, const struct config_value values[], const char *name)
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   228
{
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   229
    const struct config_param *param;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   230
    const struct config_value *value;
124
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   231
    
f18d69425c4f fix up lua_module_conf/config_* enough so that logwatch_conf_filter works
Tero Marttila <terom@fixme.fi>
parents: 122
diff changeset
   232
    // go through the (param, value) pairs
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   233
    for (param = option->params, value = values; param->name && param->type && value->type; param++, value++) {
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   234
        if (strcmp(param->name, name) == 0) {
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   235
            // not NULL?
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   236
            if (value->type != CONFIG_NULL)
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   237
                return value;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   238
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   239
            else
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   240
                return NULL;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   241
        }
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   242
    }
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   243
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   244
    // not found
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   245
    return NULL;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   246
}
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   247
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   248
const char* config_get_string (const struct config_option *option, const struct config_value values[], const char *name)
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   249
{
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   250
    const struct config_value *value;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   251
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   252
    return (value = config_get_value(option, values, name)) ? value->string : NULL;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   253
}
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   254
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   255
struct irc_chan* config_get_irc_chan (const struct config_option *option, const struct config_value values[], const char *name)
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   256
{
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   257
    const struct config_value *value;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   258
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   259
    return (value = config_get_value(option, values, name)) ? value->irc_chan : NULL;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   260
}
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   261
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 124
diff changeset
   262
void* config_get_user (const struct config_option *option, const struct config_value values[], const char *name, const struct config_user_type *user_type)
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   263
{
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   264
    const struct config_value *value;
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   265
154
f4472119de3b initial code towards transport implementation, doesn't compile
Tero Marttila <terom@fixme.fi>
parents: 124
diff changeset
   266
    return ((value = config_get_value(option, values, name)) && value->user.type == user_type) ? value->user.ptr : NULL;
121
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   267
}
4682ebbc5644 implement logwatch_conf_filter such that it compiles and loads, but not yet tested
Tero Marttila <terom@fixme.fi>
parents: 120
diff changeset
   268