[svn-commits] jpeeler: branch jpeeler/dahdi-restart r136816 - in /team/jpeeler/dahdi-restar...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 8 12:27:23 CDT 2008


Author: jpeeler
Date: Fri Aug  8 12:27:23 2008
New Revision: 136816

URL: http://svn.digium.com/view/asterisk?view=rev&rev=136816
Log:
resolve conflict

Modified:
    team/jpeeler/dahdi-restart/   (props changed)
    team/jpeeler/dahdi-restart/apps/app_voicemail.c
    team/jpeeler/dahdi-restart/channels/chan_dahdi.c

Propchange: team/jpeeler/dahdi-restart/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug  8 12:27:23 2008
@@ -1,1 +1,1 @@
-/trunk:1-136761
+/trunk:1-136815

Modified: team/jpeeler/dahdi-restart/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/dahdi-restart/apps/app_voicemail.c?view=diff&rev=136816&r1=136815&r2=136816
==============================================================================
--- team/jpeeler/dahdi-restart/apps/app_voicemail.c (original)
+++ team/jpeeler/dahdi-restart/apps/app_voicemail.c Fri Aug  8 12:27:23 2008
@@ -3277,98 +3277,6 @@
 	return;	
 }
 
-#else
-#ifndef IMAP_STORAGE
-/*!
- * \brief Find all .txt files - even if they are not in sequence from 0000.
- * \param vmu
- * \param dir
- *
- * This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
- *
- * \return the count of messages, zero or more.
- */
-static int count_messages(struct ast_vm_user *vmu, char *dir)
-{
-
-	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;
-}
-
-/*!
- * \brief Renames a message in a mailbox folder.
- * \param sfn The path to the mailbox information and data file to be renamed.
- * \param dfn The path for where the message data and information files will be renamed to.
- *
- * This method is used by the RENAME macro when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
- */
-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, SENTINEL);
-	}
-	rename(stxt, dtxt);
-}
-
-/*! 
- * \brief Determines the highest message number in use for a given user and mailbox folder.
- * \param vmu 
- * \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
- *
- * This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
- * Typical use to set the msgnum would be to take the value returned from this method and add one to it.
- *
- * \note Should always be called with a lock already set on dir.
- * \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
- */
-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.
@@ -3396,8 +3304,97 @@
 	unlink(full_fn);
 	return 0;
 }
-#endif
-
+#else
+#ifndef IMAP_STORAGE
+/*!
+ * \brief Find all .txt files - even if they are not in sequence from 0000.
+ * \param vmu
+ * \param dir
+ *
+ * This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
+ *
+ * \return the count of messages, zero or more.
+ */
+static int count_messages(struct ast_vm_user *vmu, char *dir)
+{
+
+	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;
+}
+
+/*!
+ * \brief Renames a message in a mailbox folder.
+ * \param sfn The path to the mailbox information and data file to be renamed.
+ * \param dfn The path for where the message data and information files will be renamed to.
+ *
+ * This method is used by the RENAME macro when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
+ */
+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, SENTINEL);
+	}
+	rename(stxt, dtxt);
+}
+
+/*! 
+ * \brief Determines the highest message number in use for a given user and mailbox folder.
+ * \param vmu 
+ * \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
+ *
+ * This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
+ * Typical use to set the msgnum would be to take the value returned from this method and add one to it.
+ *
+ * \note Should always be called with a lock already set on dir.
+ * \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
+ */
+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;
+}
 
 /*!
  * \brief Utility function to copy a file.
@@ -3512,6 +3509,7 @@
 
 #endif /* #ifndef IMAP_STORAGE */
 #endif /* #else of #ifdef ODBC_STORAGE */
+
 #if (!defined(ODBC_STORAGE) && !defined(IMAP_STORAGE))
 /*! 
  * \brief Removes the voicemail sound and information file.

Modified: team/jpeeler/dahdi-restart/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/dahdi-restart/channels/chan_dahdi.c?view=diff&rev=136816&r1=136815&r2=136816
==============================================================================
--- team/jpeeler/dahdi-restart/channels/chan_dahdi.c (original)
+++ team/jpeeler/dahdi-restart/channels/chan_dahdi.c Fri Aug  8 12:27:23 2008
@@ -14922,13 +14922,13 @@
 #ifdef HAVE_PRI
 	ast_string_field_init(&inuse, 16);
 	ast_string_field_set(&inuse, name, "GR-303InUse");
-	ast_cli_register_multiple(dahdi_pri_cli, sizeof(dahdi_pri_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(dahdi_pri_cli, ARRAY_LEN(dahdi_pri_cli));
 #endif	
 #ifdef HAVE_SS7
 	ast_cli_register_multiple(dahdi_ss7_cli, ARRAY_LEN(dahdi_ss7_cli));
 #endif
 
-	ast_cli_register_multiple(dahdi_cli, sizeof(dahdi_cli) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(dahdi_cli, ARRAY_LEN(dahdi_cli));
 	
 	memset(round_robin, 0, sizeof(round_robin));
 	ast_manager_register( "DAHDITransfer", 0, action_transfer, "Transfer DAHDI Channel" );




More information about the svn-commits mailing list