[svn-commits] tilghman: branch 1.4 r214068 - /branches/1.4/main/say.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 25 14:26:54 CDT 2009


Author: tilghman
Date: Tue Aug 25 14:26:50 2009
New Revision: 214068

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214068
Log:
Fix pronunciation of German dates.
(closes issue #15273)
 Reported by: Benjamin Kluck
 Patches: 
       say_c.patch uploaded by Benjamin Kluck (license 803)

Modified:
    branches/1.4/main/say.c

Modified: branches/1.4/main/say.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/say.c?view=diff&rev=214068&r1=214067&r2=214068
==============================================================================
--- branches/1.4/main/say.c (original)
+++ branches/1.4/main/say.c Tue Aug 25 14:26:50 2009
@@ -3570,14 +3570,14 @@
 				/* FALLTRHU */
 			case 'k':
 				/* 24-Hour */
-				res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);	
+				res = ast_say_number(chan, tm.tm_hour, ints, lang, (char *) NULL);
 				break;
 			case 'M':
 				/* Minute */
-				if (tm.tm_min > 0 || format[offset+ 1 ] == 'S' ) { /* zero 'digits/0' only if seconds follow (kind of a hack) */
-					res = ast_say_number(chan, tm.tm_min, ints, lang, "f");	
-				}
-				if ( !res && format[offset + 1] == 'S' ) { /* minutes only if seconds follow (kind of a hack) */
+				if (tm.tm_min > 0 || next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */
+					res = ast_say_number(chan, tm.tm_min, ints, lang, "f");
+				}
+				if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */
 					if (tm.tm_min == 1) {
 						res = wait_file(chan,ints,"digits/minute",lang);
 					} else {
@@ -3680,6 +3680,12 @@
 		}
 	}
 	return res;
+}
+
+char next_item(const char *format)
+{
+	const char *next = ast_skip_blanks(format);
+	return *next;
 }
 
 /* German syntax */
@@ -3777,10 +3783,13 @@
 				break;
 			case 'M':
 				/* Minute */
-				if (tm.tm_min > 0 || format[offset+ 1 ] == 'S' ) { /* zero 'digits/0' only if seconds follow (kind of a hack) */
-					res = ast_say_number(chan, tm.tm_min, ints, lang, "f");	
-				}
-				if ( !res && format[offset + 1] == 'S' ) { /* minutes only if seconds follow (kind of a hack) */
+				if (next_item(&format[offset + 1]) == 'S') { /* zero 'digits/0' only if seconds follow */
+					res = ast_say_number(chan, tm.tm_min, ints, lang, "f"); /* female only if we say digits/minutes */
+				} else if (tm.tm_min > 0) {
+					res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
+				}
+
+				if (!res && next_item(&format[offset + 1]) == 'S') { /* minutes only if seconds follow */
 					if (tm.tm_min == 1) {
 						res = wait_file(chan,ints,"digits/minute",lang);
 					} else {
@@ -3862,7 +3871,7 @@
 				if (!res) {
 					res = ast_say_number(chan, tm.tm_sec, ints, lang, "f");	
 					if (!res) {
-						res = wait_file(chan,ints, "digits/seconds",lang);
+						res = wait_file(chan, ints, tm.tm_sec == 1 ? "digits/second" : "digits/seconds", lang);
 					}
 				}
 				break;




More information about the svn-commits mailing list