diff options
author | Russell Bryant <russell@russellbryant.com> | 2005-11-30 19:20:28 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2005-11-30 19:20:28 +0000 |
commit | 1ced6b477513d46e2b69cbab0621d5038a78385a (patch) | |
tree | bb1e77320c0ff7ab6b090ad2d28509e0335f044d /apps/app_hasnewvoicemail.c | |
parent | 68fa778314b274e321f2da90cfd071b1387bae1a (diff) |
convert VMCOUNT function to use new app args parsing macros (issue #5688)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_hasnewvoicemail.c')
-rw-r--r-- | apps/app_hasnewvoicemail.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/apps/app_hasnewvoicemail.c b/apps/app_hasnewvoicemail.c index 740975dd0..7ce8a9132 100644 --- a/apps/app_hasnewvoicemail.c +++ b/apps/app_hasnewvoicemail.c @@ -179,34 +179,37 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data) static char *acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { struct localuser *u; - char *args, *context, *box, *folder; + char *argsstr, *context; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(vmbox); + AST_APP_ARG(folder); + ); LOCAL_USER_ACF_ADD(u); buf[0] = '\0'; - args = ast_strdupa(data); - if (!args) { + argsstr = ast_strdupa(data); + if (!argsstr) { ast_log(LOG_ERROR, "Out of memory"); LOCAL_USER_REMOVE(u); return buf; } - box = strsep(&args, "|"); - if (strchr(box, '@')) { - context = box; - box = strsep(&context, "@"); + AST_STANDARD_APP_ARGS(args, argsstr); + + if (strchr(args.vmbox, '@')) { + context = args.vmbox; + args.vmbox = strsep(&context, "@"); } else { context = "default"; } - if (args) { - folder = args; - } else { - folder = "INBOX"; + if (ast_strlen_zero(args.folder)) { + args.folder = "INBOX"; } - snprintf(buf, len, "%d", hasvoicemail_internal(context, box, folder)); + snprintf(buf, len, "%d", hasvoicemail_internal(context, args.vmbox, args.folder)); LOCAL_USER_REMOVE(u); |