All pastes #119 Raw Edit

Twisted

public text v1 · immutable
#119 ·published 2004-04-27 23:34 UTC
rendered paste body
tatic void apply_options(struct ast_vm_user *vmu, char *options)
{
        /* Destructively Parse options and apply */
        char *stringp = ast_strdupa(options);
        char *s;
        char *var, *value;
        while((s = strsep(&stringp, "|"))) {
                value = s;
                if ((var = strsep(&value, "=")) && value) {
                        if (!strcasecmp(var, "attach")) {
                                if (ast_true(value))
                                        vmu->attach = 1;
                                else
                                        vmu->attach = 0;
                        } else if (!strcasecmp(var, "serveremail")) {
                                strncpy(vmu->serveremail, value, sizeof(vmu->serveremail) - 1);
                        } else if (!strcasecmp(var, "tz")) {
                                strncpy(vmu->zonetag, value, sizeof(vmu->zonetag) - 1);
                        } else if (!strcasecmp(var, "saycid")){
                                if(ast_true(value) || saycidinfo)
                                        vmu->saycid = 1;
                                else
                                        vmu->saycid = 0;
                        } else if (!strcasecmp(var, "review")){
                                if(ast_true(value) || reviewvm)
                                        vmu->review = 1;
                                else
                                        vmu->review = 0;
                        } else if (!strcasecmp(var, "operator")){
                                if(ast_true(value) || calloper)
                                        vmu->operator = 1;
                                else
                                        vmu->operator = 0;
                        } else if (!strcasecmp(var, "callback")) {
                                strncpy(vmu->callback, value, sizeof(vmu->callback) -1);
                        } else if (!strcasecmp(var, "dialout")) {
                                strncpy(vmu->dialout, value, sizeof(vmu->dialout) -1);

                        }
                }
        }

}