mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 23:38:23 +00:00
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
This commit is contained in:
@@ -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)
|
static char *acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
struct localuser *u;
|
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);
|
LOCAL_USER_ACF_ADD(u);
|
||||||
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|
||||||
args = ast_strdupa(data);
|
argsstr = ast_strdupa(data);
|
||||||
if (!args) {
|
if (!argsstr) {
|
||||||
ast_log(LOG_ERROR, "Out of memory");
|
ast_log(LOG_ERROR, "Out of memory");
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
box = strsep(&args, "|");
|
AST_STANDARD_APP_ARGS(args, argsstr);
|
||||||
if (strchr(box, '@')) {
|
|
||||||
context = box;
|
if (strchr(args.vmbox, '@')) {
|
||||||
box = strsep(&context, "@");
|
context = args.vmbox;
|
||||||
|
args.vmbox = strsep(&context, "@");
|
||||||
} else {
|
} else {
|
||||||
context = "default";
|
context = "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args) {
|
if (ast_strlen_zero(args.folder)) {
|
||||||
folder = args;
|
args.folder = "INBOX";
|
||||||
} else {
|
|
||||||
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);
|
LOCAL_USER_REMOVE(u);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user