[asterisk-commits] mmichelson: branch 1.6.0 r136785 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 8 10:33:48 CDT 2008


Author: mmichelson
Date: Fri Aug  8 10:33:47 2008
New Revision: 136785

URL: http://svn.digium.com/view/asterisk?view=rev&rev=136785
Log:
Merged revisions 136784 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r136784 | mmichelson | 2008-08-08 10:31:31 -0500 (Fri, 08 Aug 2008) | 3 lines

Fix compilation for ODBC voicemail


........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=136785&r1=136784&r2=136785
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Fri Aug  8 10:33:47 2008
@@ -2893,88 +2893,17 @@
 	return;	
 }
 
-#else
-#ifndef IMAP_STORAGE
-static int count_messages(struct ast_vm_user *vmu, char *dir)
-{
-	/* Find all .txt files - even if they are not in sequence from 0000 */
-
-	int vmcount = 0;
-	DIR *vmdir = NULL;
-	struct dirent *vment = NULL;
-
-	if (vm_lock_path(dir))
-		return ERROR_LOCK_PATH;
-
-	if ((vmdir = opendir(dir))) {
-		while ((vment = readdir(vmdir))) {
-			if (strlen(vment->d_name) > 7 && !strncmp(vment->d_name + 7, ".txt", 4)) 
-				vmcount++;
-		}
-		closedir(vmdir);
-	}
-	ast_unlock_path(dir);
-	
-	return vmcount;
-}
-
-static void rename_file(char *sfn, char *dfn)
-{
-	char stxt[PATH_MAX];
-	char dtxt[PATH_MAX];
-	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")) {
-		ast_update_realtime("voicemail_data", "filename", sfn, "filename", dfn, NULL);
-	}
-	rename(stxt, dtxt);
-}
-#endif
-
-#ifndef IMAP_STORAGE
-/*! \brief
-* A negative return value indicates an error.
-* \note Should always be called with a lock already set on dir.
-*/
-static int last_message_index(struct ast_vm_user *vmu, char *dir)
-{
-	int x;
-	unsigned char map[MAXMSGLIMIT] = "";
-	DIR *msgdir;
-	struct dirent *msgdirent;
-	int msgdirint;
-
-	/* Reading the entire directory into a file map scales better than
-	* doing a stat repeatedly on a predicted sequence.  I suspect this
-	* is partially due to stat(2) internally doing a readdir(2) itself to
-	* find each file. */
-	msgdir = opendir(dir);
-	while ((msgdirent = readdir(msgdir))) {
-		if (sscanf(msgdirent->d_name, "msg%d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
-			map[msgdirint] = 1;
-	}
-	closedir(msgdir);
-
-	for (x = 0; x < vmu->maxmsg; x++) {
-		if (map[x] == 0)
-			break;
-	}
-
-	return x - 1;
-}
-#if (defined(IMAP_STORAGE) || defined(ODBC_STORAGE))
 /*!
-* \brief Removes a voicemail message file.
-* \param dir the path to the message file.
-* \param msgnum the unique number for the message within the mailbox.
-*
-* Removes the message content file and the information file.
-* This method is used by the DISPOSE macro when mailboxes are stored in an ODBC back end.
-* Typical use is to clean up after a RETRIEVE operation. 
-* Note that this does not remove the message from the mailbox folders, to do that we would use delete_file().
-* \return zero on success, -1 on error.
-*/
+ * \brief Removes a voicemail message file.
+ * \param dir the path to the message file.
+ * \param msgnum the unique number for the message within the mailbox.
+ *
+ * Removes the message content file and the information file.
+ * This method is used by the DISPOSE macro when mailboxes are stored in an ODBC back end.
+ * Typical use is to clean up after a RETRIEVE operation. 
+ * Note that this does not remove the message from the mailbox folders, to do that we would use delete_file().
+ * \return zero on success, -1 on error.
+ */
 static int remove_file(char *dir, int msgnum)
 {
 	char fn[PATH_MAX];
@@ -2991,7 +2920,76 @@
 	unlink(full_fn);
 	return 0;
 }
+#else
+#ifndef IMAP_STORAGE
+static int count_messages(struct ast_vm_user *vmu, char *dir)
+{
+	/* Find all .txt files - even if they are not in sequence from 0000 */
+
+	int vmcount = 0;
+	DIR *vmdir = NULL;
+	struct dirent *vment = NULL;
+
+	if (vm_lock_path(dir))
+		return ERROR_LOCK_PATH;
+
+	if ((vmdir = opendir(dir))) {
+		while ((vment = readdir(vmdir))) {
+			if (strlen(vment->d_name) > 7 && !strncmp(vment->d_name + 7, ".txt", 4)) 
+				vmcount++;
+		}
+		closedir(vmdir);
+	}
+	ast_unlock_path(dir);
+	
+	return vmcount;
+}
+
+static void rename_file(char *sfn, char *dfn)
+{
+	char stxt[PATH_MAX];
+	char dtxt[PATH_MAX];
+	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")) {
+		ast_update_realtime("voicemail_data", "filename", sfn, "filename", dfn, NULL);
+	}
+	rename(stxt, dtxt);
+}
 #endif
+
+#ifndef IMAP_STORAGE
+/*! \brief
+* A negative return value indicates an error.
+* \note Should always be called with a lock already set on dir.
+*/
+static int last_message_index(struct ast_vm_user *vmu, char *dir)
+{
+	int x;
+	unsigned char map[MAXMSGLIMIT] = "";
+	DIR *msgdir;
+	struct dirent *msgdirent;
+	int msgdirint;
+
+	/* Reading the entire directory into a file map scales better than
+	* doing a stat repeatedly on a predicted sequence.  I suspect this
+	* is partially due to stat(2) internally doing a readdir(2) itself to
+	* find each file. */
+	msgdir = opendir(dir);
+	while ((msgdirent = readdir(msgdir))) {
+		if (sscanf(msgdirent->d_name, "msg%d", &msgdirint) == 1 && msgdirint < MAXMSGLIMIT)
+			map[msgdirint] = 1;
+	}
+	closedir(msgdir);
+
+	for (x = 0; x < vmu->maxmsg; x++) {
+		if (map[x] == 0)
+			break;
+	}
+
+	return x - 1;
+}
 
 #endif /* #ifndef IMAP_STORAGE */
 #endif /* #else of #ifdef ODBC_STORAGE */
@@ -3087,6 +3085,7 @@
 	copy(frompath2, topath2);
 	ast_variables_destroy(var);
 }
+
 
 #if (!defined(ODBC_STORAGE) && !defined(IMAP_STORAGE))
 /*! 




More information about the asterisk-commits mailing list