issue #5585
authorKevin P. Fleming <kpfleming@digium.com>
Tue, 8 Nov 2005 02:11:42 +0000 (02:11 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Tue, 8 Nov 2005 02:11:42 +0000 (02:11 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7012 65c4cc65-6c06-0410-ace0-fbb531ad65f3

ChangeLog
manager.c

index e9d7215..30cc205 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-11-07  Kevin P. Fleming  <kpfleming@digium.com>
 
+       * manager.c (astman_get_variables): restore old multiple-variable behavior for "Variable" header (issue #5585)
+
        * many files: don't check for NULL before calling ast_strlen_zero, it can do it itself (issue #5648)
 
        * pbx.c (handle_show_hints): use proper state-to-string function for hint state (issue #5583)
index f0f7a87..1f38db2 100755 (executable)
--- a/manager.c
+++ b/manager.c
@@ -309,26 +309,34 @@ char *astman_get_header(struct message *m, char *var)
 
 struct ast_variable *astman_get_variables(struct message *m)
 {
-       int varlen, x;
+       int varlen, x, y;
        struct ast_variable *head = NULL, *cur;
        char *var, *val;
+       unsigned int var_count;
+        char *vars[32];
        
        varlen = strlen("Variable: ");  
 
        for (x = 0; x < m->hdrcount; x++) {
-               if (!strncasecmp("Variable: ", m->headers[x], varlen)) {
-                       var = val = ast_strdupa(m->headers[x] + varlen);
-                       if (!var)
-                               return head;                            
-                       strsep(&val, "=");
-                       if (!val || ast_strlen_zero(var))
-                               continue;
-                       cur = ast_variable_new(var, val);
-                       if (head) {
-                               cur->next = head;
-                               head = cur;
-                       } else
-                               head = cur;
+               if (strncasecmp("Variable: ", m->headers[x], varlen))
+                       continue;
+
+               if (!(var = ast_strdupa(m->headers[x] + varlen)))
+                       return head;
+
+               if ((var_count = ast_app_separate_args(var, '|', vars, sizeof(vars) / sizeof(var[0])))) {
+                       for (y = 0; y < var_count; y++) {
+                               var = val = vars[y];
+                               strsep(&val, "=");
+                               if (!val || ast_strlen_zero(var))
+                                       continue;
+                               cur = ast_variable_new(var, val);
+                               if (head) {
+                                       cur->next = head;
+                                       head = cur;
+                               } else
+                                       head = cur;
+                       }
                }
        }