mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
This code was in team/murf/bug8684-trunk; it should fix bug 8684 in trunk. I didn't add it to 1.4 yet, because it's not entirely clear to me if this is a bug fix or an enhancement. A lot of files were affected by small changes like ast_variable_new getting an added arg, for the file name the var was defined in; ast_category_new gets added args of filename and lineno; ast_category and ast_variable structures now record file and lineno for each entry; a list of all #include and #execs in a config file (or any of its inclusions are now kept in the ast_config struct; at save time, each entry is put back into its proper file of origin, in order. #include and #exec directives are folded in properly. Headers indicating that the file was generated, are generated also for each included file. Some changes to main/manager.c to take care of file renaming, via the UpdateConfig command. Multiple inclusions of the same file are handled by exploding these into multiple include files, uniquely named. There's probably more, but I can't remember it right now.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -791,7 +791,7 @@ struct ast_variable *astman_get_variables(const struct message *m)
|
||||
strsep(&val, "=");
|
||||
if (!val || ast_strlen_zero(var))
|
||||
continue;
|
||||
cur = ast_variable_new(var, val);
|
||||
cur = ast_variable_new(var, val, "");
|
||||
cur->next = head;
|
||||
head = cur;
|
||||
}
|
||||
@@ -1224,7 +1224,7 @@ static int action_getconfigjson(struct mansession *s, const struct message *m)
|
||||
}
|
||||
|
||||
/* helper function for action_updateconfig */
|
||||
static void handle_updates(struct mansession *s, const struct message *m, struct ast_config *cfg)
|
||||
static void handle_updates(struct mansession *s, const struct message *m, struct ast_config *cfg, const char *dfn)
|
||||
{
|
||||
int x;
|
||||
char hdr[40];
|
||||
@@ -1253,7 +1253,7 @@ static void handle_updates(struct mansession *s, const struct message *m, struct
|
||||
match = astman_get_header(m, hdr);
|
||||
if (!strcasecmp(action, "newcat")) {
|
||||
if (!ast_strlen_zero(cat)) {
|
||||
category = ast_category_new(cat);
|
||||
category = ast_category_new(cat, dfn, 99999);
|
||||
if (category) {
|
||||
ast_category_append(cfg, category);
|
||||
}
|
||||
@@ -1276,7 +1276,7 @@ static void handle_updates(struct mansession *s, const struct message *m, struct
|
||||
} else if (!strcasecmp(action, "append")) {
|
||||
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
|
||||
(category = ast_category_get(cfg, cat)) &&
|
||||
(v = ast_variable_new(var, value))){
|
||||
(v = ast_variable_new(var, value, dfn))){
|
||||
if (object || (match && !strcasecmp(match, "object")))
|
||||
v->object = 1;
|
||||
ast_variable_append(category, v);
|
||||
@@ -1315,7 +1315,8 @@ static int action_updateconfig(struct mansession *s, const struct message *m)
|
||||
astman_send_error(s, m, "Config file not found");
|
||||
return 0;
|
||||
}
|
||||
handle_updates(s, m, cfg);
|
||||
handle_updates(s, m, cfg, dfn);
|
||||
ast_include_rename(cfg, sfn, dfn); /* change the include references from dfn to sfn, so things match up */
|
||||
res = config_text_file_save(dfn, cfg, "Manager");
|
||||
ast_config_destroy(cfg);
|
||||
if (res) {
|
||||
|
Reference in New Issue
Block a user