Merged revisions 51150 via svnmerge from
authorMatt O'Gorman <mogorman@digium.com>
Tue, 16 Jan 2007 17:47:26 +0000 (17:47 +0000)
committerMatt O'Gorman <mogorman@digium.com>
Tue, 16 Jan 2007 17:47:26 +0000 (17:47 +0000)
https://svn.digium.com/svn/asterisk/branches/1.4

........
r51150 | mogorman | 2007-01-16 11:46:12 -0600 (Tue, 16 Jan 2007) | 2 lines

minor things i missed before i get jumped on

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51151 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index c968548..5c07688 100644 (file)
@@ -681,9 +681,9 @@ static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *
                ast_log(LOG_DEBUG, "Name: %s Value: %s\n", tmp->name, tmp->value);
                if (!strcasecmp(tmp->name, "password") || !strcasecmp(tmp->name, "secret")) {
                        ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
-               } else if  (!strcasecmp(tmp->name, "secret")) {
+               } else if (!strcasecmp(tmp->name, "secret")) {
                        /* dont let secret override vmpassword */
-                       if ((strlen(retval->password) == 0))
+                       if (ast_strlen_zero(retval->password))
                                ast_copy_string(retval->password, tmp->value, sizeof(retval->password));        
                } else if (!strcasecmp(tmp->name, "uniqueid")) {
                        ast_copy_string(retval->uniqueid, tmp->value, sizeof(retval->uniqueid));
@@ -803,7 +803,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
                                        ast_log(LOG_WARNING, "variable has bad format.\n");
                                        break;
                                }
-                               len  = (strlen(value) + strlen(newpassword));
+                               len = (strlen(value) + strlen(newpassword));
                                
                                if (!(new = ast_calloc(1,len))) {
                                        ast_log(LOG_WARNING, "Memory Allocation Failed.\n");
@@ -830,21 +830,26 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
        /* check users.conf and update the password stored for the mailbox*/
        /* if no vmpassword entry exists create one. */
        if ((cfg = ast_config_load_with_comments("users.conf"))) {
-               ast_log(LOG_WARNING, "we are looking for %s\n", vmu->mailbox);
+               if (option_debug > 3)
+                       ast_log(LOG_DEBUG, "we are looking for %s\n", vmu->mailbox);
                while ((category = ast_category_browse(cfg, category))) {
-                       ast_log(LOG_WARNING, "users.conf: %s\n", category);
+                       if (option_debug > 3)
+                               ast_log(LOG_DEBUG, "users.conf: %s\n", category);
                        if (!strcasecmp(category, vmu->mailbox)) {
                                if (!(tmp = ast_variable_retrieve(cfg, category, "vmpassword"))) {
-                                       ast_log(LOG_WARNING, "looks like we need to make vmpassword!\n");
+                                       if (option_debug > 3)
+                                               ast_log(LOG_DEBUG, "looks like we need to make vmpassword!\n");
                                        var = ast_variable_new("vmpassword", newpassword);
                                } 
                                if (!(new = ast_calloc(1,strlen(newpassword)))) {
-                                       ast_log(LOG_WARNING, "Memory Allocation Failed.\n");
+                                       if (option_debug > 3)
+                                               ast_log(LOG_DEBUG, "Memory Allocation Failed.\n");
                                        break;
                                } 
                                sprintf(new, "%s", newpassword);
                                if (!(cat = ast_category_get(cfg, category))) {
-                                       ast_log(LOG_WARNING, "failed to get category!\n");
+                                       if (option_debug > 3)
+                                               ast_log(LOG_DEBUG, "failed to get category!\n");
                                }
                                if (!var)               
                                        ast_variable_update(cat, "vmpassword", new, NULL);