[svn-commits] mmichelson: branch 1.4 r78907 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 9 18:47:01 CDT 2007


Author: mmichelson
Date: Thu Aug  9 18:47:00 2007
New Revision: 78907

URL: http://svn.digium.com/view/asterisk?view=rev&rev=78907
Log:
Improved a bit of logic regarding comma-separated mailboxes in has_voicemail. Also added some braces to some compound if statements
since unbraced if statements scare me in general.


Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=78907&r1=78906&r2=78907
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Thu Aug  9 18:47:00 2007
@@ -2515,12 +2515,14 @@
 		context = "default";
 		mailboxnc = (char *)mailbox_context;
 	}
-	if (newmsgs)
+	if (newmsgs) {
 		if((*newmsgs = messagecount(context, mailboxnc, "INBOX")) < 0)
 			return -1;
-	if (oldmsgs)
+	}
+	if (oldmsgs) {
 		if((*oldmsgs = messagecount(context, mailboxnc, "Old")) < 0)
 			return -1;
+	}
 	return 0;
 }
 	
@@ -2530,9 +2532,13 @@
 	char tmp[256], *tmp2, *mbox, *context;
 	ast_copy_string(tmp, mailbox, sizeof(tmp));
 	tmp2 = tmp;
-	while (strcmp((mbox = strsep(&tmp2, ",")), mailbox)) {
-		if (has_voicemail(mbox, folder))
-			return 1;
+	if(strchr(tmp2, ',')) {
+		while((mbox = strsep(&tmp2, ","))) {
+			if(!ast_strlen_zero(mbox)) {
+				if (has_voicemail(mbox, folder))
+					return 1;
+			}
+		}
 	}
 	if ((context= strchr(tmp, '@')))
 		*context++ = '\0';




More information about the svn-commits mailing list