[asterisk-commits] tilghman: trunk r99818 - /trunk/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 23:29:29 CST 2008


Author: tilghman
Date: Tue Jan 22 23:29:28 2008
New Revision: 99818

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99818
Log:
Coding guidelines fixups

Modified:
    trunk/apps/app_voicemail.c

Change Statistics:
 0 files changed

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=99818&r1=99817&r2=99818
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Tue Jan 22 23:29:28 2008
@@ -157,7 +157,7 @@
 static int imap_retrieve_file (char *dir, int msgnum, const char *mailbox, char *context);
 static int imap_delete_old_greeting (char *dir, struct vm_state *vms);
 static void check_quota(struct vm_state *vms, char *mailbox);
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
 struct vmstate {
 	struct vm_state *vms;
 	AST_LIST_ENTRY(vmstate) list;
@@ -443,7 +443,7 @@
 #define RETRIEVE(a,b,c,d) (imap_retrieve_file(a,b,c,d ))
 #define DISPOSE(a,b) (imap_remove_file(a,b))
 #define STORE(a,b,c,d,e,f,g,h,i) (imap_store_file(a,b,c,d,e,f,g,h,i))
-#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
+#define EXISTS(a,b,c,d) (ast_fileexists(c, NULL, d) > 0)
 #define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
 #define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
 #define IMAP_DELETE(a,b,c,d) (vm_imap_delete(b,d))
@@ -452,7 +452,7 @@
 #define RETRIEVE(a,b,c,d)
 #define DISPOSE(a,b)
 #define STORE(a,b,c,d,e,f,g,h,i)
-#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
+#define EXISTS(a,b,c,d) (ast_fileexists(c, NULL, d) > 0)
 #define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
 #define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
 #define DELETE(a,b,c) (vm_delete(c))
@@ -654,7 +654,7 @@
 static char emaildateformat[32] = "%A, %B %d, %Y at %r";
 
 /* Forward declarations - generic */
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
 static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, int option, signed char record_gain);
 static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context);
 static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime,
@@ -711,31 +711,31 @@
 #endif
 	} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_DELETE);	
-	} else if (!strcasecmp(var, "saycid")){
+	} else if (!strcasecmp(var, "saycid")) {
 		ast_set2_flag(vmu, ast_true(value), VM_SAYCID);	
-	} else if (!strcasecmp(var,"sendvoicemail")){
+	} else if (!strcasecmp(var, "sendvoicemail")) {
 		ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);	
-	} else if (!strcasecmp(var, "review")){
+	} else if (!strcasecmp(var, "review")) {
 		ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
-	} else if (!strcasecmp(var, "tempgreetwarn")){
+	} else if (!strcasecmp(var, "tempgreetwarn")) {
 		ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);	
-	} else if (!strcasecmp(var, "operator")){
+	} else if (!strcasecmp(var, "operator")) {
 		ast_set2_flag(vmu, ast_true(value), VM_OPERATOR);	
-	} else if (!strcasecmp(var, "envelope")){
+	} else if (!strcasecmp(var, "envelope")) {
 		ast_set2_flag(vmu, ast_true(value), VM_ENVELOPE);	
-	} else if (!strcasecmp(var, "moveheard")){
+	} else if (!strcasecmp(var, "moveheard")) {
 		ast_set2_flag(vmu, ast_true(value), VM_MOVEHEARD);
-	} else if (!strcasecmp(var, "sayduration")){
+	} else if (!strcasecmp(var, "sayduration")) {
 		ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION);	
-	} else if (!strcasecmp(var, "saydurationm")){
+	} else if (!strcasecmp(var, "saydurationm")) {
 		if (sscanf(value, "%d", &x) == 1) {
 			vmu->saydurationm = x;
 		} else {
 			ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
 		}
-	} else if (!strcasecmp(var, "forcename")){
+	} else if (!strcasecmp(var, "forcename")) {
 		ast_set2_flag(vmu, ast_true(value), VM_FORCENAME);	
-	} else if (!strcasecmp(var, "forcegreetings")){
+	} else if (!strcasecmp(var, "forcegreetings")) {
 		ast_set2_flag(vmu, ast_true(value), VM_FORCEGREET);	
 	} else if (!strcasecmp(var, "callback")) {
 		ast_copy_string(vmu->callback, value, sizeof(vmu->callback));
@@ -892,7 +892,7 @@
 static struct ast_vm_user *find_user(struct ast_vm_user *ivm, const char *context, const char *mailbox)
 {
 	/* This function could be made to generate one from a database, too */
-	struct ast_vm_user *vmu=NULL, *cur;
+	struct ast_vm_user *vmu = NULL, *cur;
 	AST_LIST_LOCK(&users);
 
 	if (!context && !ast_test_flag((&globalflags), VM_SEARCH))
@@ -938,11 +938,11 @@
 
 static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
 {
-	struct ast_config   *cfg=NULL;
-	struct ast_variable *var=NULL;
-	struct ast_category *cat=NULL;
-	char *category=NULL, *value=NULL, *new=NULL;
-	const char *tmp=NULL;
+	struct ast_config *cfg = NULL;
+	struct ast_variable *var = NULL;
+	struct ast_category *cat = NULL;
+	char *category = NULL, *value = NULL, *new = NULL;
+	const char *tmp = NULL;
 	struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
 	if (!change_password_realtime(vmu, newpassword))
 		return;
@@ -955,13 +955,13 @@
 					ast_log(LOG_WARNING, "We could not find the mailbox.\n");
 					break;
 				}
-				value = strstr(tmp,",");
+				value = strstr(tmp, ",");
 				if (!value) {
 					ast_log(LOG_WARNING, "variable has bad format.\n");
 					break;
 				}
-				new = alloca((strlen(value)+strlen(newpassword)+1));
-				sprintf(new,"%s%s", newpassword, value);
+				new = alloca(strlen(value) + strlen(newpassword) + 1);
+				sprintf(new, "%s%s", newpassword, value);
 				if (!(cat = ast_category_get(cfg, category))) {
 					ast_log(LOG_WARNING, "Failed to get category structure.\n");
 					break;
@@ -987,7 +987,7 @@
 					ast_debug(3, "looks like we need to make vmsecret!\n");
 					var = ast_variable_new("vmsecret", newpassword, "");
 				} 
-				new = alloca(strlen(newpassword)+1);
+				new = alloca(strlen(newpassword) + 1);
 				sprintf(new, "%s", newpassword);
 				if (!(cat = ast_category_get(cfg, category))) {
 					ast_debug(4, "failed to get category!\n");
@@ -1009,7 +1009,7 @@
 static void vm_change_password_shell(struct ast_vm_user *vmu, char *newpassword)
 {
 	char buf[255];
-	snprintf(buf,255,"%s %s %s %s",ext_pass_cmd,vmu->context,vmu->mailbox,newpassword);
+	snprintf(buf, sizeof(buf), "%s %s %s %s", ext_pass_cmd, vmu->context, vmu->mailbox, newpassword);
 	if (!ast_safe_system(buf)) {
 		ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
 		/* Reset the password in memory, too */
@@ -1043,13 +1043,13 @@
 
 	messageNum = vms->msgArray[msgnum];
 	if (messageNum == 0) {
-		ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n",msgnum,messageNum);
+		ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n", msgnum, messageNum);
 		return;
 	}
-	ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n",msgnum,messageNum);
+	ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
 	/* delete message */
-	snprintf (arg, sizeof(arg), "%lu",messageNum);
-	mail_setflag (vms->mailstream,arg,"\\DELETED");
+	snprintf(arg, sizeof(arg), "%lu", messageNum);
+	mail_setflag(vms->mailstream, arg, "\\DELETED");
 }
 
 #endif
@@ -1128,13 +1128,13 @@
 {
 	int x = 0;
 	int res;
-	int fd=-1;
+	int fd = -1;
 	size_t fdlen = 0;
 	void *fdm = MAP_FAILED;
-	SQLSMALLINT colcount=0;
+	SQLSMALLINT colcount = 0;
 	SQLHSTMT stmt;
 	char sql[PATH_MAX];
-	char fmt[80]="";
+	char fmt[80] = "";
 	char *c;
 	char coltitle[256];
 	SQLSMALLINT collen;
@@ -1143,7 +1143,7 @@
 	SQLSMALLINT nullable;
 	SQLULEN colsize;
 	SQLLEN colsize2;
-	FILE *f=NULL;
+	FILE *f = NULL;
 	char rowdata[80];
 	char fn[PATH_MAX];
 	char full_fn[PATH_MAX];
@@ -1160,7 +1160,7 @@
 			*c = '\0';
 		if (!strcasecmp(fmt, "wav49"))
 			strcpy(fmt, "WAV");
-		snprintf(msgnums, sizeof(msgnums),"%d", msgnum);
+		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
 		if (msgnum > -1)
 			make_file(fn, sizeof(fn), dir, msgnum);
 		else
@@ -1173,7 +1173,7 @@
 		}
 		
 		snprintf(full_fn, sizeof(full_fn), "%s.%s", fn, fmt);
-		snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1208,7 +1208,7 @@
 		}
 		if (f) 
 			fprintf(f, "[message]\n");
-		for (x=0;x<colcount;x++) {
+		for (x = 0; x < colcount; x++) {
 			rowdata[0] = '\0';
 			collen = sizeof(coltitle);
 			res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen, 
@@ -1224,7 +1224,7 @@
 				res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize2);
 				fdlen = colsize2;
 				if (fd > -1) {
-					char tmp[1]="";
+					char tmp[1] = "";
 					lseek(fd, fdlen - 1, SEEK_SET);
 					if (write(fd, tmp, 1) != 1) {
 						close(fd);
@@ -1309,7 +1309,7 @@
 	struct odbc_obj *obj;
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?",odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1355,7 +1355,7 @@
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
-		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt) {
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1403,7 +1403,7 @@
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
-		snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1430,7 +1430,7 @@
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
 		snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
-		snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?",odbc_table,odbc_table);
+		snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql);
@@ -1455,11 +1455,11 @@
 	char msgnums[20];
 	char fn[PATH_MAX];
 	char full_fn[PATH_MAX];
-	char fmt[80]="";
+	char fmt[80] = "";
 	char *c;
-	const char *context="", *macrocontext="", *callerid="", *origtime="", *duration="";
+	const char *context = "", *macrocontext = "", *callerid = "", *origtime = "", *duration = "";
 	const char *category = "";
-	struct ast_config *cfg=NULL;
+	struct ast_config *cfg = NULL;
 	struct odbc_obj *obj;
 	struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
 
@@ -1472,7 +1472,7 @@
 			*c = '\0';
 		if (!strcasecmp(fmt, "wav49"))
 			strcpy(fmt, "WAV");
-		snprintf(msgnums, sizeof(msgnums),"%d", msgnum);
+		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
 		if (msgnum > -1)
 			make_file(fn, sizeof(fn), dir, msgnum);
 		else
@@ -1503,7 +1503,7 @@
 		fdlen = lseek(fd, 0, SEEK_END);
 		lseek(fd, 0, SEEK_SET);
 		printf("Length is %zd\n", fdlen);
-		fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0);
+		fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
 		if (fdm == MAP_FAILED) {
 			ast_log(LOG_WARNING, "Memory map failed!\n");
 			ast_odbc_release_obj(obj);
@@ -1516,9 +1516,9 @@
 			goto yuck;
 		}
 		if (!ast_strlen_zero(category)) 
-			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)",odbc_table); 
+			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)", odbc_table);
 		else
-			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)",odbc_table);
+			snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)", odbc_table);
 		res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
 		if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 			ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
@@ -1575,7 +1575,7 @@
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
 		snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
-		snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?",odbc_table);
+		snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?", odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1616,7 +1616,7 @@
 {
 	char stxt[PATH_MAX];
 	char dtxt[PATH_MAX];
-	ast_filerename(sfn,dfn,NULL);
+	ast_filerename(sfn, dfn, NULL);
 	snprintf(stxt, sizeof(stxt), "%s.txt", sfn);
 	snprintf(dtxt, sizeof(dtxt), "%s.txt", dfn);
 	if (ast_check_realtime("voicemail_data")) {
@@ -1678,7 +1678,7 @@
 static void copy_file(char *frompath, char *topath)
 {
 	char frompath2[PATH_MAX], topath2[PATH_MAX];
-	struct ast_variable *tmp,*var = NULL;
+	struct ast_variable *tmp, *var = NULL;
 	const char *origmailbox = NULL, *context = NULL, *macrocontext = NULL, *exten = NULL, *priority = NULL, *callerchan = NULL, *callerid = NULL, *origdate = NULL, *origtime = NULL, *category = NULL, *duration = NULL;
 	ast_filecopy(frompath, topath, NULL);
 	snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
@@ -1755,7 +1755,7 @@
 	char *txt;
 	int txtsize = 0;
 
-	txtsize = (strlen(file) + 5)*sizeof(char);
+	txtsize = (strlen(file) + 5) * sizeof(char);
 	txt = alloca(txtsize);
 	/* Sprintf here would safe because we alloca'd exactly the right length,
 	 * but trying to eliminate all sprintf's anyhow
@@ -1776,7 +1776,7 @@
 	if (bio->ateof)
 		return 0;
 
-	if ((l = fread(bio->iobuf,1,BASEMAXINLINE,fi)) <= 0) {
+	if ((l = fread(bio->iobuf, 1, BASEMAXINLINE, fi)) <= 0) {
 		if (ferror(fi))
 			return -1;
 
@@ -1784,15 +1784,15 @@
 		return 0;
 	}
 
-	bio->iolen= l;
-	bio->iocp= 0;
+	bio->iolen = l;
+	bio->iocp = 0;
 
 	return 1;
 }
 
 static int inchar(struct baseio *bio, FILE *fi)
 {
-	if (bio->iocp>=bio->iolen) {
+	if (bio->iocp >= bio->iolen) {
 		if (!inbuf(bio, fi))
 			return EOF;
 	}
@@ -1803,13 +1803,13 @@
 static int ochar(struct baseio *bio, int c, FILE *so)
 {
 	if (bio->linelength >= BASELINELEN) {
-		if (fputs(eol,so) == EOF)
+		if (fputs(eol, so) == EOF)
 			return -1;
 
 		bio->linelength= 0;
 	}
 
-	if (putc(((unsigned char)c),so) == EOF)
+	if (putc(((unsigned char)c), so) == EOF)
 		return -1;
 
 	bio->linelength++;
@@ -1823,7 +1823,7 @@
 		'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
 		'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0',
 		'1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
-	int i,hiteof= 0;
+	int i, hiteof = 0;
 	FILE *fi;
 	struct baseio bio;
 
@@ -1835,42 +1835,42 @@
 		return -1;
 	}
 
-	while (!hiteof){
+	while (!hiteof) {
 		unsigned char igroup[3], ogroup[4];
-		int c,n;
-
-		igroup[0]= igroup[1]= igroup[2]= 0;
-
-		for (n= 0;n<3;n++) {
+		int c, n;
+
+		igroup[0] = igroup[1] = igroup[2] = 0;
+
+		for (n = 0; n < 3; n++) {
 			if ((c = inchar(&bio, fi)) == EOF) {
-				hiteof= 1;
+				hiteof = 1;
 				break;
 			}
 
-			igroup[n]= (unsigned char)c;
-		}
-
-		if (n> 0) {
-			ogroup[0]= dtable[igroup[0]>>2];
-			ogroup[1]= dtable[((igroup[0]&3)<<4) | (igroup[1]>>4)];
-			ogroup[2]= dtable[((igroup[1]&0xF)<<2) | (igroup[2]>>6)];
-			ogroup[3]= dtable[igroup[2]&0x3F];
-
-			if (n<3) {
-				ogroup[3]= '=';
-
-				if (n<2)
-					ogroup[2]= '=';
-			}
-
-			for (i= 0;i<4;i++)
+			igroup[n] = (unsigned char)c;
+		}
+
+		if (n > 0) {
+			ogroup[0] = dtable[igroup[0] >> 2];
+			ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)];
+			ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)];
+			ogroup[3] = dtable[igroup[2] & 0x3F];
+
+			if (n < 3) {
+				ogroup[3] = '=';
+
+				if (n < 2)
+					ogroup[2] = '=';
+			}
+
+			for (i = 0; i < 4; i++)
 				ochar(&bio, ogroup[i], so);
 		}
 	}
 
 	fclose(fi);
 	
-	if (fputs(eol,so)==EOF)
+	if (fputs(eol, so) == EOF)
 		return 0;
 
 	return 1;
@@ -1969,7 +1969,7 @@
 #define ENDL "\n"
 #endif
 
-	gethostname(host, sizeof(host)-1);
+	gethostname(host, sizeof(host) - 1);
 
 	if (strchr(srcemail, '@'))
 		ast_copy_string(who, srcemail, sizeof(who));
@@ -1991,7 +1991,7 @@
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
 			char *passdata;
-			int vmlen = strlen(fromstring)*3 + 200;
+			int vmlen = strlen(fromstring) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2064,7 +2064,7 @@
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
 			char *passdata;
-			int vmlen = strlen(emailbody)*3 + 200;
+			int vmlen = strlen(emailbody) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2073,7 +2073,7 @@
 			ast_channel_free(ast);
 		} else
 			ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
-	} else if (msgnum > -1){
+	} else if (msgnum > -1) {
 		fprintf(p, "Dear %s:" ENDL ENDL "\tJust wanted to let you know you were just left a %s long message (number %d)" ENDL
 
 		"in mailbox %s from %s, on %s so you might" ENDL
@@ -2127,7 +2127,7 @@
 
 static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category)
 {
-	FILE *p=NULL;
+	FILE *p = NULL;
 	char tmp[80] = "/tmp/astmail-XXXXXX";
 	char tmp2[256];
 
@@ -2168,7 +2168,7 @@
 		ast_log(LOG_WARNING, "Unable to launch '%s' (can't create temporary file)\n", mailcmd);
 		return -1;
 	}
-	gethostname(host, sizeof(host)-1);
+	gethostname(host, sizeof(host) - 1);
 	if (strchr(srcemail, '@'))
 		ast_copy_string(who, srcemail, sizeof(who));
 	else 
@@ -2181,7 +2181,7 @@
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
 			char *passdata;
-			int vmlen = strlen(fromstring)*3 + 200;
+			int vmlen = strlen(fromstring) * 3 + 200;
 			passdata = alloca(vmlen);
 			memset(passdata, 0, vmlen);
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2310,7 +2310,7 @@
 		"Cust5",
 		"Deleted",
 	};
-	return (id >= 0 && id < (sizeof(msgs)/sizeof(msgs[0]))) ? msgs[id] : "Unknown";
+	return (id >= 0 && id < (sizeof(msgs) / sizeof(msgs[0]))) ? msgs[id] : "Unknown";
 }
 #ifdef IMAP_STORAGE
 static int folder_int(const char *folder)
@@ -2507,7 +2507,7 @@
 	char fn[PATH_MAX];
 	char mailbox[256];
 	char *stringp;
-	FILE *p=NULL;
+	FILE *p = NULL;
 	char tmp[80] = "/tmp/astmail-XXXXXX";
 	long len;
 	void *buf;
@@ -2558,8 +2558,8 @@
 	/* read mail file to memory */		
 	len = ftell(p);
 	rewind(p);
-	if (!(buf = ast_malloc(len+1))) {
-		ast_log(LOG_ERROR, "Can't allocate %ld bytes to read message\n", len+1);
+	if (!(buf = ast_malloc(len + 1))) {
+		ast_log(LOG_ERROR, "Can't allocate %ld bytes to read message\n", len + 1);
 		fclose(p);
 		if (tempcopy)
 			*(vmu->email) = '\0';
@@ -2598,30 +2598,30 @@
 		return 0;
 
 	/* We have to get the user before we can open the stream! */
-	/* ast_log (LOG_DEBUG,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
+	/* ast_log(LOG_DEBUG, "Before find_user, context is %s and mailbox is %s\n", context, mailbox); */
 	vmu = find_user(&vmus, context, mailbox);
 	if (!vmu) {
-		ast_log (LOG_ERROR,"Couldn't find mailbox %s in context %s\n",mailbox,context);
+		ast_log(LOG_ERROR, "Couldn't find mailbox %s in context %s\n", mailbox, context);
 		return -1;
 	} else {
 		/* No IMAP account available */
 		if (vmu->imapuser[0] == '\0') {
-			ast_log (LOG_WARNING,"IMAP user not set for mailbox %s\n",vmu->mailbox);
+			ast_log(LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
 			return -1;
 		}
 	}
 	
 	/* No IMAP account available */
 	if (vmu->imapuser[0] == '\0') {
-		ast_log (LOG_WARNING,"IMAP user not set for mailbox %s\n",vmu->mailbox);
+		ast_log(LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox);
 		free_user(vmu);
 		return -1;
  	}
 
 	/* check if someone is accessing this box right now... */
-	vms_p = get_vm_state_by_imapuser(vmu->imapuser,1);
+	vms_p = get_vm_state_by_imapuser(vmu->imapuser, 1);
 	if (!vms_p) {
-		vms_p = get_vm_state_by_mailbox(mailbox,1);
+		vms_p = get_vm_state_by_mailbox(mailbox, 1);
 	}
 	if (vms_p) {
 		ast_debug(3, "Returning before search - user is logged in\n");
@@ -2634,20 +2634,20 @@
 	}
 
 	/* add one if not there... */
-	vms_p = get_vm_state_by_imapuser(vmu->imapuser,0);
+	vms_p = get_vm_state_by_imapuser(vmu->imapuser, 0);
 	if (!vms_p) {
-		vms_p = get_vm_state_by_mailbox(mailbox,0);
+		vms_p = get_vm_state_by_mailbox(mailbox, 0);
 	}
 
 	if (!vms_p) {
-		ast_debug(3,"Adding new vmstate for %s\n",vmu->imapuser);
+		ast_debug(3, "Adding new vmstate for %s\n", vmu->imapuser);
 		if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) {
 			return -1;
 		}
-		ast_copy_string(vms_p->imapuser,vmu->imapuser, sizeof(vms_p->imapuser));
+		ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser));
 		ast_copy_string(vms_p->username, mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
 		vms_p->mailstream = NIL; /* save for access from interactive entry point */
-		ast_debug(3, "Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
+		ast_debug(3, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser);
 		vms_p->updated = 1;
 		/* set mailbox to INBOX! */
 		ast_copy_string(vms_p->curbox, mbox(fold), sizeof(vms_p->curbox));
@@ -2656,7 +2656,7 @@
 	}
 	ret = init_mailstream(vms_p, fold);
 	if (!vms_p->mailstream) {
-		ast_log (LOG_ERROR,"Houston we have a problem - IMAP mailstream is NULL\n");
+		ast_log(LOG_ERROR, "Houston we have a problem - IMAP mailstream is NULL\n");
 		return -1;
 	}
 	if (ret == 0) {
@@ -2704,7 +2704,7 @@
 	if (oldmsgs)
 		*oldmsgs = 0;
 
-	ast_debug(3,"Mailbox is set to %s\n",mailbox_context);
+	ast_debug(3, "Mailbox is set to %s\n", mailbox_context);
 	/* If no mailbox, return immediately */
 	if (ast_strlen_zero(mailbox_context))
 		return 0;
@@ -3199,10 +3199,10 @@
 		/* must open stream for this user to get info! */
 		res = inboxcount(ext_context, &newmsgs, &oldmsgs);
 		if (res < 0) {
-			ast_log(LOG_NOTICE,"Can not leave voicemail, unable to count messages\n");
+			ast_log(LOG_NOTICE, "Can not leave voicemail, unable to count messages\n");
 			return -1;
 		}
-		if (!(vms = get_vm_state_by_mailbox(ext,0))) {
+		if (!(vms = get_vm_state_by_mailbox(ext, 0))) {
 		/*It is possible under certain circumstances that inboxcount did not create a vm_state when it was needed. This is a catchall which will
 		 * rarely be used*/
 			if (!(vms = ast_calloc(1, sizeof(*vms)))) {
@@ -3213,17 +3213,17 @@
 			ast_copy_string(vms->username, ext, sizeof(vms->username));
 			vms->mailstream = NIL;
 			ast_debug(3, "Copied %s to %s\n", vmu->imapuser, vms->imapuser);
-			vms->updated=1;
+			vms->updated = 1;
 			ast_copy_string(vms->curbox, mbox(0), sizeof(vms->curbox));
 			init_vm_state(vms);
 			vmstate_insert(vms);
-			vms = get_vm_state_by_mailbox(ext,0);
+			vms = get_vm_state_by_mailbox(ext, 0);
 		}
 		vms->newmessages++;
 		
 		/* here is a big difference! We add one to it later */
 		msgnum = newmsgs + oldmsgs;
-		ast_debug(3, "Messagecount set to %d\n",msgnum);
+		ast_debug(3, "Messagecount set to %d\n", msgnum);
 		snprintf(fn, sizeof(fn), "%s/imap/msg%s%04d", VM_SPOOL_DIR, vmu->mailbox, msgnum);
 		/* set variable for compatibility */
 		pbx_builtin_setvar_helper(chan, "VM_MESSAGEFILE", "IMAP_STORAGE");
@@ -3320,7 +3320,7 @@
 			if (duration < vmminsecs) {
 				fclose(txt);
 				if (option_verbose > 2) 
-					ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminsecs);
+					ast_verbose(VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminsecs);
 				ast_filedelete(tmptxtfile, NULL);
 				unlink(tmptxtfile);
 				if (ast_check_realtime("voicemail_data")) {
@@ -3425,7 +3425,7 @@
 {
 	/* we know max messages, so stop process when number is hit */
 
-	int x,dest;
+	int x, dest;
 	char sfn[PATH_MAX];
 	char dfn[PATH_MAX];
 
@@ -3469,8 +3469,8 @@
 	if (box == 1) return 10;
 	/* get the real IMAP message number for this message */
 	snprintf(sequence, sizeof(sequence), "%ld", vms->msgArray[msg]);
-	ast_debug(3, "Copying sequence %s to mailbox %s\n",sequence,mbox(box));
-	res = mail_copy(vms->mailstream,sequence,(char *) mbox(box));
+	ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(box));
+	res = mail_copy(vms->mailstream, sequence, (char *)mbox(box));
 	if (res == 1) return 0;
 	return 1;
 #else
@@ -3527,7 +3527,7 @@
 static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	int x;
 	char num[5];
 
@@ -3602,7 +3602,7 @@
 #endif
 
 	bytes = 0;
-	for (x=0;x<5;x++) {
+	for (x = 0; x < 5; x++) {
 		snprintf(num, sizeof(num), "%d", x);
 		bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 12 + x, mbox(x), mbox(x), num, 1);
 	}
@@ -3673,13 +3673,13 @@
 static void adsi_login(struct ast_channel *chan)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 	if (!ast_adsi_available(chan))
 		return;
 
-	for (x=0;x<8;x++)
+	for (x = 0; x < 8; x++)
 		keys[x] = 0;
 	/* Set one key for next */
 	keys[3] = ADSI_KEY_APPS + 3;
@@ -3699,13 +3699,13 @@
 static void adsi_password(struct ast_channel *chan)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 	if (!ast_adsi_available(chan))
 		return;
 
-	for (x=0;x<8;x++)
+	for (x = 0; x < 8; x++)
 		keys[x] = 0;
 	/* Set one key for next */
 	keys[3] = ADSI_KEY_APPS + 3;
@@ -3721,14 +3721,14 @@
 static void adsi_folders(struct ast_channel *chan, int start, char *label)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
-	int x,y;
+	int x, y;
 
 	if (!ast_adsi_available(chan))
 		return;
 
-	for (x=0;x<5;x++) {
+	for (x = 0; x < 5; x++) {
 		y = ADSI_KEY_APPS + 12 + start + x;
 		if (y > ADSI_KEY_APPS + 12 + 4)
 			y = 0;
@@ -3749,15 +3749,15 @@
 
 static void adsi_message(struct ast_channel *chan, struct vm_state *vms)
 {
-	int bytes=0;
+	int bytes = 0;
 	unsigned char buf[256]; 
 	char buf1[256], buf2[256];
 	char fn2[PATH_MAX];
 
-	char cid[256]="";
+	char cid[256] = "";
 	char *val;
 	char *name, *num;
-	char datetime[21]="";
+	char datetime[21] = "";
 	FILE *f;
 
 	unsigned char keys[8];
@@ -3774,7 +3774,7 @@
 		while (!feof(f)) {	
 			fgets((char *)buf, sizeof(buf), f);
 			if (!feof(f)) {
-				char *stringp=NULL;
+				char *stringp = NULL;
 				stringp = (char *)buf;
 				strsep(&stringp, "=");
 				val = strsep(&stringp, "=");
@@ -3789,7 +3789,7 @@
 		fclose(f);
 	}
 	/* New meaning for keys */
-	for (x=0;x<5;x++)
+	for (x = 0; x < 5; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + 6 + x);
 	keys[6] = 0x0;
 	keys[7] = 0x0;
@@ -3842,7 +3842,7 @@
 
 static void adsi_delete(struct ast_channel *chan, struct vm_state *vms)
 {
-	int bytes=0;
+	int bytes = 0;
 	unsigned char buf[256];
 	unsigned char keys[8];
 
@@ -3852,7 +3852,7 @@
 		return;
 
 	/* New meaning for keys */
-	for (x=0;x<5;x++)
+	for (x = 0; x < 5; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + 6 + x);
 
 	keys[6] = 0x0;
@@ -3889,7 +3889,7 @@
 {
 	unsigned char buf[256] = "";
 	char buf1[256] = "", buf2[256] = "";
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 
@@ -3917,7 +3917,7 @@
 	bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 2, ADSI_JUST_LEFT, 0, buf2, "");
 	bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
 
-	for (x=0;x<6;x++)
+	for (x = 0; x < 6; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + x);
 	keys[6] = 0;
 	keys[7] = 0;
@@ -3936,7 +3936,7 @@
 {
 	unsigned char buf[256] = "";
 	char buf1[256] = "", buf2[256] = "";
-	int bytes=0;
+	int bytes = 0;
 	unsigned char keys[8];
 	int x;
 
@@ -3946,7 +3946,7 @@
 		return;
 
 	/* Original command keys */
-	for (x=0;x<6;x++)
+	for (x = 0; x < 6; x++)
 		keys[x] = ADSI_KEY_SKT | (ADSI_KEY_APPS + x);
 
 	keys[6] = 0;
@@ -3978,7 +3978,7 @@
 static void adsi_clear(struct ast_channel *chan)
 {
 	char buf[256];
-	int bytes=0;
+	int bytes = 0;
 	if (!ast_adsi_available(chan))
 		return;
 	bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
@@ -3991,7 +3991,7 @@
 static void adsi_goodbye(struct ast_channel *chan)
 {
 	unsigned char buf[256];
-	int bytes=0;
+	int bytes = 0;
 
 	if (!ast_adsi_available(chan))
 		return;
@@ -4016,7 +4016,7 @@
 	d = ast_play_and_wait(chan, "vm-press");	/* "Press" */
 	if (d)
 		return d;
-	for (x = start; x< 5; x++) {	/* For all folders */
+	for (x = start; x < 5; x++) {	/* For all folders */
 		if ((d = ast_say_number(chan, x, AST_DIGIT_ANY, chan->language, NULL)))
 			return d;
 		d = ast_play_and_wait(chan, "vm-for");	/* "for" */
@@ -4098,7 +4098,7 @@
 
 				*duration += prepend_duration;
 				msg_cat = ast_category_get(msg_cfg, "message");
-				snprintf(duration_str, 11, "%ld", *duration);
+				snprintf(duration_str, sizeof(duration_str), "%ld", *duration);
 				if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
 					config_text_file_save(textfile, msg_cfg, "app_voicemail");
 					STORE(curdir, vmu->mailbox, context, curmsg, chan, vmu, vmfmts, *duration, vms);
@@ -4116,13 +4116,13 @@
 			cmd = '*';
 			break;
 		default: 
-			cmd = ast_play_and_wait(chan,"vm-forwardoptions");
+			cmd = ast_play_and_wait(chan, "vm-forwardoptions");
 				/* "Press 1 to prepend a message or 2 to forward the message without prepending" */
 			if (!cmd)
-				cmd = ast_play_and_wait(chan,"vm-starmain");
+				cmd = ast_play_and_wait(chan, "vm-starmain");
 				/* "press star to return to the main menu" */
 			if (!cmd)
-				cmd = ast_waitfordigit(chan,6000);
+				cmd = ast_waitfordigit(chan, 6000);
 			if (!cmd)
 				retries++;
 			if (retries > 3)
@@ -4228,10 +4228,10 @@
 	char *header_content;
 	char *temp;
 	char todir[256];
-	int todircount=0;
+	int todircount = 0;
 	struct vm_state *dstvms;
 #endif
-	char username[70]="";
+	char username[70] = "";
 	char fn[PATH_MAX]; /* for playback of name greeting */
 	char ecodes[16] = "#";
 	int res = 0, cmd = 0;
@@ -4253,8 +4253,8 @@
 		if (ast_test_flag((&globalflags), VM_DIRECFORWARD)) {
 			int done = 0;
 			int retries = 0;
-			cmd=0;
-			while ((cmd >= 0) && !done ){
+			cmd = 0;
+			while ((cmd >= 0) && !done) {
 				if (cmd)
 					retries = 0;
 				switch (cmd) {
@@ -4264,7 +4264,7 @@
 					break;
 				case '2': 
 					use_directory = 1;
-					done=1;
+					done = 1;
 					break;
 				case '*': 
 					cmd = 't';
@@ -4272,9 +4272,9 @@
 					break;
 				default: 
 					/* Press 1 to enter an extension press 2 to use the directory */
-					cmd = ast_play_and_wait(chan,"vm-forward");
+					cmd = ast_play_and_wait(chan, "vm-forward");
 					if (!cmd)
-						cmd = ast_waitfordigit(chan,3000);
+						cmd = ast_waitfordigit(chan, 3000);
 					if (!cmd)
 						retries++;
 					if (retries > 3)
@@ -4339,7 +4339,7 @@
 		valid_extensions = 1;
 		while (s) {
 			/* Don't forward to ourselves but allow leaving a message for ourselves (flag == 1).  find_user is going to malloc since we have a NULL as first argument */
-			if ((flag == 1 || strcmp(s,sender->mailbox)) && (receiver = find_user(NULL, context, s))) {
+			if ((flag == 1 || strcmp(s, sender->mailbox)) && (receiver = find_user(NULL, context, s))) {
 				AST_LIST_INSERT_HEAD(&extensions, receiver, list);
 				found++;
 			} else {
@@ -4397,9 +4397,9 @@
 			AST_LIST_TRAVERSE_SAFE_BEGIN(&extensions, vmtmp, list) {
 #ifdef IMAP_STORAGE
  				/* Need to get message content */
-	 			ast_debug(3,"Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n",vms->curmsg, vms->msgArray[vms->curmsg]);
+	 			ast_debug(3, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", vms->curmsg, vms->msgArray[vms->curmsg]);
  				if (!vms->msgArray[vms->curmsg]) {
- 					ast_log (LOG_WARNING,"Trying to access unknown message\n");
+ 					ast_log(LOG_WARNING, "Trying to access unknown message\n");
  					return -1;
  				}
  
@@ -4407,7 +4407,7 @@
 				header_content = mail_fetchheader (vms->mailstream, vms->msgArray[vms->curmsg]);
  				/* empty string means no valid header */
  				if (ast_strlen_zero(header_content)) {
- 					ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[vms->curmsg]);
+ 					ast_log(LOG_ERROR, "Could not fetch header for message number %ld\n", vms->msgArray[vms->curmsg]);
  					return -1;
  				}
  				/* Get header info needed by sendmail */
@@ -4421,35 +4421,35 @@
  					stringp = fmt;
  					strsep(&stringp, "|");
  				} else {
- 					ast_log (LOG_ERROR,"audio format not set. Default to WAV\n");
+ 					ast_log(LOG_ERROR, "audio format not set. Default to WAV\n");
  					fmt = "WAV";
  				}
  				if (!strcasecmp(fmt, "wav49"))
  					fmt = "WAV";
-	 			ast_debug(3,"**** format set to %s, vmfmts set to %s\n",fmt,vmfmts);
+	 			ast_debug(3, "**** format set to %s, vmfmts set to %s\n", fmt, vmfmts);
  				/* ast_copy_string(fmt, vmfmts, sizeof(fmt));*/
  				/* if (!ast_strlen_zero(fmt)) { */
 				snprintf(todir, sizeof(todir), "%s%s/%s/tmp", VM_SPOOL_DIR, vmtmp->context, vmtmp->mailbox);
 				make_gsm_file(vms->fn, sizeof(vms->fn), vms->imapuser, todir, vms->curmsg);
-	 			ast_debug(3,"Before mail_fetchstructure, message number is %ld, filename is:%s\n",vms->msgArray[vms->curmsg], vms->fn);
+	 			ast_debug(3, "Before mail_fetchstructure, message number is %ld, filename is:%s\n", vms->msgArray[vms->curmsg], vms->fn);
 				/*mail_fetchstructure (mailstream, vmArray[0], &body); */
 				mail_fetchstructure (vms->mailstream, vms->msgArray[vms->curmsg], &body);
-				save_body(body,vms,"3","gsm");
+				save_body(body, vms, "3", "gsm");
  				/* should not assume "fmt" here! */
-				save_body(body,vms,"2",fmt);
+				save_body(body, vms, "2", fmt);
  
 				/* get destination mailbox */
-				dstvms = get_vm_state_by_mailbox(vmtmp->mailbox,0);
+				dstvms = get_vm_state_by_mailbox(vmtmp->mailbox, 0);
 				if (dstvms) {
 					init_mailstream(dstvms, 0);
 					if (!dstvms->mailstream) {
-						ast_log (LOG_ERROR,"IMAP mailstream for %s is NULL\n",vmtmp->mailbox);
+						ast_log(LOG_ERROR, "IMAP mailstream for %s is NULL\n", vmtmp->mailbox);
 					} else {
 						STORE(todir, vmtmp->mailbox, vmtmp->context, dstvms->curmsg, chan, vmtmp, fmt, duration, dstvms);
 						run_externnotify(vmtmp->context, vmtmp->mailbox); 
 					}
 				} else {
-					ast_log (LOG_ERROR,"Could not find state information for mailbox %s\n",vmtmp->mailbox);
+					ast_log(LOG_ERROR, "Could not find state information for mailbox %s\n", vmtmp->mailbox);
 				}
 
 				if (!ast_strlen_zero(vmtmp->serveremail))
@@ -4550,32 +4550,32 @@
 
 	/* Day difference */
 	if (time_now.tm_year == time_then.tm_year)
-		snprintf(temp,sizeof(temp),"%d",time_now.tm_yday);
+		snprintf(temp, sizeof(temp), "%d", time_now.tm_yday);
 	else
-		snprintf(temp,sizeof(temp),"%d",(time_now.tm_year - time_then.tm_year) * 365 + (time_now.tm_yday - time_then.tm_yday));
+		snprintf(temp, sizeof(temp), "%d", (time_now.tm_year - time_then.tm_year) * 365 + (time_now.tm_yday - time_then.tm_yday));
 	pbx_builtin_setvar_helper(chan, "DIFF_DAY", temp);
 
 	/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
 #endif
 	if (the_zone)
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
-	else if (!strcasecmp(chan->language,"pl"))       /* POLISH syntax */
+	else if (!strcasecmp(chan->language, "pl"))       /* POLISH syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL);
-	else if (!strcasecmp(chan->language,"se"))       /* SWEDISH syntax */
+	else if (!strcasecmp(chan->language, "se"))       /* SWEDISH syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
-	else if (!strcasecmp(chan->language,"no"))       /* NORWEGIAN syntax */
+	else if (!strcasecmp(chan->language, "no"))       /* NORWEGIAN syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
-	else if (!strcasecmp(chan->language,"de"))       /* GERMAN syntax */
+	else if (!strcasecmp(chan->language, "de"))       /* GERMAN syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
-	else if (!strcasecmp(chan->language,"nl"))      /* DUTCH syntax */
+	else if (!strcasecmp(chan->language, "nl"))      /* DUTCH syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL);
-	else if (!strcasecmp(chan->language,"it"))      /* ITALIAN syntax */
+	else if (!strcasecmp(chan->language, "it"))      /* ITALIAN syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL);
-	else if (!strcasecmp(chan->language,"gr"))
+	else if (!strcasecmp(chan->language, "gr"))
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q  H 'digits/kai' M ", NULL);
-	else if (!strcasecmp(chan->language,"pt_BR"))
+	else if (!strcasecmp(chan->language, "pt_BR"))
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL);

[... 1290 lines stripped ...]



More information about the asterisk-commits mailing list