[asterisk-commits] trunk - r7235 /trunk/apps/app_hasnewvoicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 30 13:20:30 CST 2005


Author: russell
Date: Wed Nov 30 13:20:28 2005
New Revision: 7235

URL: http://svn.digium.com/view/asterisk?rev=7235&view=rev
Log:
convert VMCOUNT function to use new app args parsing macros (issue #5688)

Modified:
    trunk/apps/app_hasnewvoicemail.c

Modified: trunk/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_hasnewvoicemail.c?rev=7235&r1=7234&r2=7235&view=diff
==============================================================================
--- trunk/apps/app_hasnewvoicemail.c (original)
+++ trunk/apps/app_hasnewvoicemail.c Wed Nov 30 13:20:28 2005
@@ -179,34 +179,37 @@
 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";
-	}
-
-	snprintf(buf, len, "%d", hasvoicemail_internal(context, box, folder));
+	if (ast_strlen_zero(args.folder)) {
+		args.folder = "INBOX";
+	}
+
+	snprintf(buf, len, "%d", hasvoicemail_internal(context, args.vmbox, args.folder));
 
 	LOCAL_USER_REMOVE(u);
 	



More information about the asterisk-commits mailing list