Index: apps/app_voicemail.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v retrieving revision 1.86 diff -u -r1.86 app_voicemail.c --- apps/app_voicemail.c 1 May 2004 23:28:33 -0000 1.86 +++ apps/app_voicemail.c 4 May 2004 16:38:59 -0000 @@ -807,7 +807,7 @@ time(&t); /* Does this user have a timezone specified? */ - if (strlen(vmu->zonetag)) { + if (!ast_strlen_zero(vmu->zonetag)) { /* Find the zone in the list */ struct vm_zone *z; z = zones; @@ -945,7 +945,7 @@ time(&t); /* Does this user have a timezone specified? */ - if (strlen(vmu->zonetag)) { + if (!ast_strlen_zero(vmu->zonetag)) { /* Find the zone in the list */ struct vm_zone *z; z = zones; @@ -1534,7 +1534,7 @@ if (ast_exists_extension(chan, strlen(chan->macrocontext) ? chan->macrocontext : chan->context, "o", 1, chan->callerid)) ecodes = "#0*"; /* Play the beginning intro if desired */ - if (strlen(prefile)) { + if (!ast_strlen_zero(prefile)) { if (ast_fileexists(prefile, NULL, NULL) > 0) { if (ast_streamfile(chan, prefile, chan->language) > -1) res = ast_waitstream(chan, "#0*"); @@ -1566,7 +1566,7 @@ other than the operator -- an automated attendant or mailbox login for example */ if (res == '*') { strncpy(chan->exten, "a", sizeof(chan->exten) - 1); - if (strlen(chan->macrocontext)) + if (!ast_strlen_zero(chan->macrocontext)) strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1); chan->priority = 0; free_user(vmu); @@ -1576,7 +1576,7 @@ if (res == '0') { transfer: strncpy(chan->exten, "o", sizeof(chan->exten) - 1); - if (strlen(chan->macrocontext)) + if (!ast_strlen_zero(chan->macrocontext)) strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1); chan->priority = 0; free_user(vmu); @@ -1594,7 +1594,7 @@ } /* The meat of recording the message... All the announcements and beeps have been played*/ strncpy(fmt, vmfmts, sizeof(fmt) - 1); - if (strlen(fmt)) { + if (!ast_strlen_zero(fmt)) { msgnum = 0; do { make_file(fn, sizeof(fn), dir, msgnum); @@ -1657,18 +1657,18 @@ stringp = fmt; strsep(&stringp, "|"); /* Send e-mail if applicable */ - if (strlen(vmu->email)) { + if (!ast_strlen_zero(vmu->email)) { int attach_user_voicemail = attach_voicemail; char *myserveremail = serveremail; if (vmu->attach > -1) attach_user_voicemail = vmu->attach; - if (strlen(vmu->serveremail)) + if (!ast_strlen_zero(vmu->serveremail)) myserveremail = vmu->serveremail; sendmail(myserveremail, vmu, msgnum, ext, chan->callerid, fn, fmt, duration, attach_user_voicemail); } - if (strlen(vmu->pager)) { + if (!ast_strlen_zero(vmu->pager)) { char *myserveremail = serveremail; - if (strlen(vmu->serveremail)) + if (!ast_strlen_zero(vmu->serveremail)) myserveremail = vmu->serveremail; sendpage(myserveremail, vmu->pager, msgnum, ext, chan->callerid, duration, vmu); } @@ -2072,7 +2072,7 @@ stringp=buf; strsep(&stringp, "="); val = strsep(&stringp, "="); - if (val && strlen(val)) { + if (val && !ast_strlen_zero(val)) { if (!strcmp(buf, "callerid")) strncpy(cid, val, sizeof(cid) - 1); if (!strcmp(buf, "origdate")) @@ -2105,7 +2105,7 @@ } } - if (strlen(cid)) { + if (!ast_strlen_zero(cid)) { ast_callerid_parse(cid, &name, &num); if (!name) name = num; @@ -2403,7 +2403,7 @@ if ((res = ast_readstring(chan, username, sizeof(username) - 1, 2000, 10000, "#") < 0)) break; /* start all over if no username */ - if (!strlen(username)) + if (ast_strlen_zero(username)) continue; stringp = username; s = strsep(&stringp, "*"); @@ -2473,19 +2473,19 @@ duration = atoi(s); else duration = 0; - if (strlen(vmtmp->email)) { + if (!ast_strlen_zero(vmtmp->email)) { int attach_user_voicemail = attach_voicemail; char *myserveremail = serveremail; if (vmtmp->attach > -1) attach_user_voicemail = vmtmp->attach; - if (strlen(vmtmp->serveremail)) + if (!ast_strlen_zero(vmtmp->serveremail)) myserveremail = vmtmp->serveremail; sendmail(myserveremail, vmtmp, todircount, vmtmp->mailbox, callerid, fn, tmp, duration, attach_user_voicemail); } - if (strlen(vmtmp->pager)) { + if (!ast_strlen_zero(vmtmp->pager)) { char *myserveremail = serveremail; - if (strlen(vmtmp->serveremail)) + if (!ast_strlen_zero(vmtmp->serveremail)) myserveremail = vmtmp->serveremail; sendpage(myserveremail, vmtmp->pager, todircount, vmtmp->mailbox, callerid, duration, vmtmp); } @@ -2552,7 +2552,7 @@ t = tin; /* Does this user have a timezone specified? */ - if (strlen(vmu->zonetag)) { + if (!ast_strlen_zero(vmu->zonetag)) { /* Find the zone in the list */ struct vm_zone *z; z = zones; @@ -2610,7 +2610,7 @@ /* Strip off caller ID number from name */ ast_log(LOG_DEBUG, "VM-CID: composite caller ID received: %s, context: %s\n", cid, context); ast_callerid_parse(cid, &name, &callerid); - if((callerid != NULL)&&(!res)&&(strlen(callerid))){ + if((callerid != NULL)&&(!res)&&(!ast_strlen_zero(callerid))){ /* Check for internal contexts and only */ /* say extension when the call didn't come from an internal context in the list */ for(i = 0 ; i < MAX_NUM_CID_CONTEXTS ; i++){ @@ -2621,7 +2621,7 @@ if(i != MAX_NUM_CID_CONTEXTS){ /* internal context? */ if(!res) { snprintf(prefile, sizeof(prefile), "voicemail/%s/%s/greet", context, callerid); - if (strlen(prefile)) { + if (!ast_strlen_zero(prefile)) { /* See if we can find a recorded name for this person instead of their extension number */ if (ast_fileexists(prefile, NULL, NULL) > 0) { ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid); @@ -2960,7 +2960,7 @@ if (chan->_state != AST_STATE_UP) ast_answer(chan); - if (data && strlen(data)) { + if (data && !ast_strlen_zero(data)) { strncpy(tmp, data, sizeof(tmp) - 1); ext = tmp; @@ -2987,7 +2987,7 @@ strncpy(prefixstr, ext, sizeof(prefixstr) - 1); else strncpy(vms.username, ext, sizeof(vms.username) - 1); - if (strlen(vms.username) && (vmu = find_user(&vmus, context ,vms.username))) + if (!ast_strlen_zero(vms.username) && (vmu = find_user(&vmus, context ,vms.username))) skipuser++; else valid = 0; @@ -3011,7 +3011,7 @@ ast_log(LOG_WARNING, "Couldn't read username\n"); goto out; } - if (!strlen(vms.username)) { + if (ast_strlen_zero(vms.username)) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Username not entered\n"); res = 0; @@ -3138,7 +3138,7 @@ break; case '2': /* Callback */ ast_verbose( VERBOSE_PREFIX_3 "Callback Requested\n"); - if (strlen(vmu->callback) && vms.lastmsg > -1) { + if (!ast_strlen_zero(vmu->callback) && vms.lastmsg > -1) { cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 2); if (cmd == 9) { silentexit = 1; @@ -3157,7 +3157,7 @@ cmd = 't'; break; case '4': /* Dialout */ - if (strlen(vmu->dialout)) { + if (!ast_strlen_zero(vmu->dialout)) { cmd = dialout(chan, vmu, NULL, vmu->dialout); if (cmd == 9) { silentexit = 1; @@ -3178,14 +3178,14 @@ if (!vms.starting) { cmd = play_and_wait(chan, "vm-toreply"); } - if (strlen(vmu->callback) && !vms.starting && !cmd) { + if (!ast_strlen_zero(vmu->callback) && !vms.starting && !cmd) { cmd = play_and_wait(chan, "vm-tocallback"); } if (!cmd && !vms.starting) { cmd = play_and_wait(chan, "vm-tohearenv"); } - if (strlen(vmu->dialout) && !cmd) { + if (!ast_strlen_zero(vmu->dialout) && !cmd) { cmd = play_and_wait(chan, "vm-tomakecall"); } if (!cmd) @@ -3337,13 +3337,13 @@ LOCAL_USER_ADD(u); if (chan->_state != AST_STATE_UP) ast_answer(chan); - if (data && strlen(data)) + if (data && !ast_strlen_zero(data)) strncpy(tmp, data, sizeof(tmp) - 1); else { res = ast_app_getdata(chan, "vm-whichbox", tmp, sizeof(tmp) - 1, 0); if (res < 0) return res; - if (!strlen(tmp)) + if (ast_strlen_zero(tmp)) return 0; } ext = tmp; @@ -3699,7 +3699,7 @@ ast_log(LOG_DEBUG,"VM_CID Internal context string: %s\n",s); stringp = ast_strdupa(s); for (x = 0 ; x < MAX_NUM_CID_CONTEXTS ; x++){ - if ((stringp)&&(strlen(stringp))){ + if ((stringp)&&(!ast_strlen_zero(stringp))){ q = strsep(&stringp,","); while ((*q == ' ')||(*q == '\t')) /* Eat white space between contexts */ q++; @@ -3975,7 +3975,7 @@ strncpy(destination, num, sizeof(destination) -1); } - if (strlen(destination)) { + if (!ast_strlen_zero(destination)) { if (destination[strlen(destination) -1 ] == '*') return 0; ast_verbose( VERBOSE_PREFIX_3 "Placing outgoing call to extension '%s' in context '%s' from context '%s'\n", destination, outgoing_context, chan->context); @@ -4024,7 +4024,7 @@ res = play_message_callerid(chan, vms, cid, context, 0); } else if (option == 2) { /* Call back */ - if (strlen(cid)) { + if (!ast_strlen_zero(cid)) { ast_callerid_parse(cid, &name, &num); while ((res > -1) && (res != 't')) { switch(res) { @@ -4041,7 +4041,7 @@ case '2': /* Want to enter a different number, can only do this if there's a dialout context for this user */ - if (strlen(vmu->dialout)) { + if (!ast_strlen_zero(vmu->dialout)) { res = dialout(chan, vmu, NULL, vmu->dialout); if (res) return 9; @@ -4074,13 +4074,13 @@ if (!res) res = play_and_wait(chan, "vm-tocallnum"); /* Only prompt for a caller-specified number if there is a dialout context specified */ - if (strlen(vmu->dialout)) { + if (!ast_strlen_zero(vmu->dialout)) { if (!res) res = play_and_wait(chan, "vm-calldiffnum"); } } else { res = play_and_wait(chan, "vm-nonumber"); - if (strlen(vmu->dialout)) { + if (!ast_strlen_zero(vmu->dialout)) { if (!res) res = play_and_wait(chan, "vm-toenternumber"); } @@ -4106,7 +4106,7 @@ } else if (option == 1) { /* Reply */ /* Send reply directly to sender */ - if (strlen(cid)) { + if (!ast_strlen_zero(cid)) { ast_callerid_parse(cid, &name, &num); if (!num) { ast_verbose(VERBOSE_PREFIX_3 "No CID number available, no reply sent\n");