<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13642">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
George Joseph: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail, say: Fix various leading whitespace problems<br><br>In af90afd90c64c5183c2207d061f9aa15138081b2, Japanese language support<br>was added to app_voicemail and main/say.c, but the leading whitespace<br>is not consistent with Asterisk coding guidelines. This patch fixes<br>that.<br><br>Whitespace only, no functional change.<br><br>ASTERISK~23324<br>Reported by: Kevin McCoy<br><br>Change-Id: I72c725f5930084673749bd7c9cc426a987f08e87<br>---<br>M apps/app_voicemail.c<br>M main/say.c<br>2 files changed, 641 insertions(+), 640 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index cf944fd..dc19439 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -7889,29 +7889,29 @@</span><br><span> /* Japanese Syntax */</span><br><span> static int get_folder_ja(struct ast_channel *chan, int start)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int x;</span><br><span style="color: hsl(0, 100%, 40%);">- int d;</span><br><span style="color: hsl(0, 100%, 40%);">- char fn[256];</span><br><span style="color: hsl(0, 100%, 40%);">- for (x = start; x< 5; x++) { /* For all folders */</span><br><span style="color: hsl(0, 100%, 40%);">- if ((d = ast_say_number(chan, x, AST_DIGIT_ANY, ast_channel_language(chan), (char *) NULL))) {</span><br><span style="color: hsl(0, 100%, 40%);">- return d;</span><br><span style="color: hsl(120, 100%, 40%);">+ int x;</span><br><span style="color: hsl(120, 100%, 40%);">+ int d;</span><br><span style="color: hsl(120, 100%, 40%);">+ char fn[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ for (x = start; x < 5; x++) { /* For all folders */</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((d = ast_say_number(chan, x, AST_DIGIT_ANY, ast_channel_language(chan), (char *) NULL))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return d;</span><br><span> }</span><br><span> snprintf(fn, sizeof(fn), "vm-%s", mbox(NULL, x)); /* Folder name */</span><br><span> d = vm_play_folder_name(chan, fn);</span><br><span> if (d) {</span><br><span style="color: hsl(0, 100%, 40%);">- return d;</span><br><span style="color: hsl(120, 100%, 40%);">+ return d;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- d = ast_waitfordigit(chan, 500);</span><br><span style="color: hsl(0, 100%, 40%);">- if (d) {</span><br><span style="color: hsl(0, 100%, 40%);">- return d;</span><br><span style="color: hsl(120, 100%, 40%);">+ d = ast_waitfordigit(chan, 500);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (d) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return d;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- d = ast_play_and_wait(chan, "vm-tocancel"); /* "or pound to cancel" */</span><br><span style="color: hsl(0, 100%, 40%);">- if (d) {</span><br><span style="color: hsl(0, 100%, 40%);">- return d;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- d = ast_waitfordigit(chan, 4000);</span><br><span style="color: hsl(0, 100%, 40%);">- return d;</span><br><span style="color: hsl(120, 100%, 40%);">+ d = ast_play_and_wait(chan, "vm-tocancel"); /* "or pound to cancel" */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (d) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return d;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ d = ast_waitfordigit(chan, 4000);</span><br><span style="color: hsl(120, 100%, 40%);">+ return d;</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -7933,13 +7933,13 @@</span><br><span> </span><br><span> res = ast_play_and_wait(chan, fn); /* Folder name */</span><br><span> while (((res < '0') || (res > '9')) &&</span><br><span style="color: hsl(0, 100%, 40%);">- (res != '#') && (res >= 0) &&</span><br><span style="color: hsl(0, 100%, 40%);">- loops < 4) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* res = get_folder(chan, 0); */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(ast_channel_language(chan),"ja")) { /* Japanese syntax */</span><br><span style="color: hsl(0, 100%, 40%);">- res = get_folder_ja(chan, 0);</span><br><span style="color: hsl(0, 100%, 40%);">- } else { /* Default syntax */</span><br><span style="color: hsl(0, 100%, 40%);">- res = get_folder(chan, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ (res != '#') && (res >= 0) &&</span><br><span style="color: hsl(120, 100%, 40%);">+ loops < 4) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* res = get_folder(chan, 0); */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcasecmp(ast_channel_language(chan), "ja")) { /* Japanese syntax */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = get_folder_ja(chan, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else { /* Default syntax */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = get_folder(chan, 0);</span><br><span> }</span><br><span> loops++;</span><br><span> }</span><br><span>@@ -9309,15 +9309,15 @@</span><br><span> </span><br><span> static int vm_play_folder_name_ja(struct ast_channel *chan, char *box)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int cmd;</span><br><span style="color: hsl(120, 100%, 40%);">+ int cmd;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(box, "vm-INBOX") || !strcasecmp(box, "vm-Old")) {</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, box);</span><br><span style="color: hsl(0, 100%, 40%);">- return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, box);</span><br><span style="color: hsl(0, 100%, 40%);">- return cmd;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcasecmp(box, "vm-INBOX") || !strcasecmp(box, "vm-Old")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, box);</span><br><span style="color: hsl(120, 100%, 40%);">+ return cmd ? cmd : ast_play_and_wait(chan, "vm-messages");</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, box);</span><br><span style="color: hsl(120, 100%, 40%);">+ return cmd;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> static int vm_play_folder_name_pl(struct ast_channel *chan, char *box)</span><br><span>@@ -9362,8 +9362,8 @@</span><br><span> return vm_play_folder_name_gr(chan, box);</span><br><span> } else if (!strncasecmp(ast_channel_language(chan), "he", 2)) { /* Hebrew syntax */</span><br><span> return ast_play_and_wait(chan, box);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* Japanese syntax */</span><br><span style="color: hsl(0, 100%, 40%);">- return vm_play_folder_name_ja(chan, box);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* Japanese syntax */</span><br><span style="color: hsl(120, 100%, 40%);">+ return vm_play_folder_name_ja(chan, box);</span><br><span> } else if (!strncasecmp(ast_channel_language(chan), "pl", 2)) {</span><br><span> return vm_play_folder_name_pl(chan, box);</span><br><span> } else if (!strncasecmp(ast_channel_language(chan), "ua", 2)) { /* Ukrainian syntax */</span><br><span>@@ -9591,40 +9591,40 @@</span><br><span> /* Japanese syntax */</span><br><span> static int vm_intro_ja(struct ast_channel *chan,struct vm_state *vms)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Introduce messages they have */</span><br><span style="color: hsl(0, 100%, 40%);">- int res;</span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->newmessages) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-INBOX");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-message");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-ga");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = say_and_wait(chan, vms->newmessages, ast_channel_language(chan));</span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->oldmessages && !res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Introduce messages they have */</span><br><span style="color: hsl(120, 100%, 40%);">+ int res;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->newmessages) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-INBOX");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-message");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-ga");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = say_and_wait(chan, vms->newmessages, ast_channel_language(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->oldmessages && !res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "silence/1");</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->oldmessages) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-Old");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-message");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-ga");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = say_and_wait(chan, vms->oldmessages, ast_channel_language(chan));</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!vms->oldmessages && !vms->newmessages) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-messages");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-arimasen");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- else {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-arimasu");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->oldmessages) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-Old");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-message");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-ga");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = say_and_wait(chan, vms->oldmessages, ast_channel_language(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!vms->oldmessages && !vms->newmessages) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-messages");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-arimasen");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-arimasu");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> } /* Japanese */</span><br><span> </span><br><span> /* Default English syntax */</span><br><span>@@ -10538,82 +10538,82 @@</span><br><span> </span><br><span> static int vm_instructions_ja(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int skipadvanced, int in_urgent)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- /* Play instructions and wait for new command */</span><br><span style="color: hsl(0, 100%, 40%);">- while (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->starting) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->lastmsg > -1) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = vm_play_folder_name(chan, vms->vmbox);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "digits/1");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-wo");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-opts");</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Added for additional help */</span><br><span style="color: hsl(0, 100%, 40%);">- if (skipadvanced) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = vm_play_folder_name(chan, vms->vmbox);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "digits/1");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "jp-wo");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-opts-full");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- /* Logic:</span><br><span style="color: hsl(0, 100%, 40%);">- * If the current message is not the first OR</span><br><span style="color: hsl(0, 100%, 40%);">- * if we're listening to the first new message and there are</span><br><span style="color: hsl(0, 100%, 40%);">- * also urgent messages, then prompt for navigation to the</span><br><span style="color: hsl(0, 100%, 40%);">- * previous message</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->curmsg || (!in_urgent && vms->urgentmessages > 0) || (ast_test_flag(vmu, VM_MESSAGEWRAP) && vms->lastmsg > 0)) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-prev");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res && !skipadvanced)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-advopts");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-repeat");</span><br><span style="color: hsl(0, 100%, 40%);">- /* Logic:</span><br><span style="color: hsl(0, 100%, 40%);">- * If we're not listening to the last message OR</span><br><span style="color: hsl(0, 100%, 40%);">- * we're listening to the last urgent message and there are</span><br><span style="color: hsl(0, 100%, 40%);">- * also new non-urgent messages, then prompt for navigation</span><br><span style="color: hsl(0, 100%, 40%);">- * to the next message</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res && ((vms->curmsg != vms->lastmsg) || (in_urgent && vms->newmessages > 0) ||</span><br><span style="color: hsl(0, 100%, 40%);">- (ast_test_flag(vmu, VM_MESSAGEWRAP) && vms->lastmsg > 0) )) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-next");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- int curmsg_deleted;</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Play instructions and wait for new command */</span><br><span style="color: hsl(120, 100%, 40%);">+ while (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->starting) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->lastmsg > -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = vm_play_folder_name(chan, vms->vmbox);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "digits/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-wo");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-opts");</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Added for additional help */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (skipadvanced) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = vm_play_folder_name(chan, vms->vmbox);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "digits/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "jp-wo");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-opts-full");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Logic:</span><br><span style="color: hsl(120, 100%, 40%);">+ * If the current message is not the first OR</span><br><span style="color: hsl(120, 100%, 40%);">+ * if we're listening to the first new message and there are</span><br><span style="color: hsl(120, 100%, 40%);">+ * also urgent messages, then prompt for navigation to the</span><br><span style="color: hsl(120, 100%, 40%);">+ * previous message</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->curmsg || (!in_urgent && vms->urgentmessages > 0) || (ast_test_flag(vmu, VM_MESSAGEWRAP) && vms->lastmsg > 0)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-prev");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res && !skipadvanced)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-advopts");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-repeat");</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Logic:</span><br><span style="color: hsl(120, 100%, 40%);">+ * If we're not listening to the last message OR</span><br><span style="color: hsl(120, 100%, 40%);">+ * we're listening to the last urgent message and there are</span><br><span style="color: hsl(120, 100%, 40%);">+ * also new non-urgent messages, then prompt for navigation</span><br><span style="color: hsl(120, 100%, 40%);">+ * to the next message</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res && ((vms->curmsg != vms->lastmsg) || (in_urgent && vms->newmessages > 0) ||</span><br><span style="color: hsl(120, 100%, 40%);">+ (ast_test_flag(vmu, VM_MESSAGEWRAP) && vms->lastmsg > 0) )) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-next");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ int curmsg_deleted;</span><br><span> #ifdef IMAP_STORAGE</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_lock(&vms->lock);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_mutex_lock(&vms->lock);</span><br><span> #endif</span><br><span style="color: hsl(0, 100%, 40%);">- curmsg_deleted = vms->deleted[vms->curmsg];</span><br><span style="color: hsl(120, 100%, 40%);">+ curmsg_deleted = vms->deleted[vms->curmsg];</span><br><span> #ifdef IMAP_STORAGE</span><br><span style="color: hsl(0, 100%, 40%);">- ast_mutex_unlock(&vms->lock);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_mutex_unlock(&vms->lock);</span><br><span> #endif</span><br><span style="color: hsl(0, 100%, 40%);">- if (!curmsg_deleted) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-delete");</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-undelete");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-toforward");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_play_and_wait(chan, "vm-savemessage");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!curmsg_deleted) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-delete");</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-undelete");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-toforward");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_play_and_wait(chan, "vm-savemessage");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> if (!res) {</span><br><span> res = ast_play_and_wait(chan, "vm-helpexit");</span><br><span>@@ -10629,7 +10629,7 @@</span><br><span> </span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> static int vm_instructions_zh(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int skipadvanced, int in_urgent)</span><br><span>@@ -10658,16 +10658,15 @@</span><br><span> </span><br><span> static int vm_instructions(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int skipadvanced, int in_urgent)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* Japanese syntax */</span><br><span style="color: hsl(0, 100%, 40%);">- return vm_instructions_ja(chan, vmu, vms, skipadvanced, in_urgent);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (vms->starting && !strncasecmp(ast_channel_language(chan), "zh", 2)) { /* CHINESE (Taiwan) syntax */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* Japanese syntax */</span><br><span style="color: hsl(120, 100%, 40%);">+ return vm_instructions_ja(chan, vmu, vms, skipadvanced, in_urgent);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (vms->starting && !strncasecmp(ast_channel_language(chan), "zh", 2)) { /* CHINESE (Taiwan) syntax */</span><br><span> return vm_instructions_zh(chan, vmu, vms, skipadvanced, in_urgent);</span><br><span> } else { /* Default to ENGLISH */</span><br><span> return vm_instructions_en(chan, vmu, vms, skipadvanced, in_urgent);</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static int vm_newuser_setup(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, char *fmtc, signed char record_gain)</span><br><span> {</span><br><span> int cmd = 0;</span><br><span>@@ -11093,21 +11092,21 @@</span><br><span> */</span><br><span> static int vm_browse_messages_ja(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int cmd = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ int cmd = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (vms->lastmsg > -1) {</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = play_message(chan, vmu, vms);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(vms->fn, sizeof(vms->fn), "vm-%s", vms->curbox);</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, vms->fn);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "vm-messages");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "jp-arimasen");</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return cmd;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vms->lastmsg > -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = play_message(chan, vmu, vms);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(vms->fn, sizeof(vms->fn), "vm-%s", vms->curbox);</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, vms->fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "vm-messages");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "jp-arimasen");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return cmd;</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -11235,8 +11234,8 @@</span><br><span> return vm_browse_messages_he(chan, vms, vmu);</span><br><span> } else if (!strncasecmp(ast_channel_language(chan), "it", 2)) { /* ITALIAN */</span><br><span> return vm_browse_messages_it(chan, vms, vmu);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* JAPANESE */</span><br><span style="color: hsl(0, 100%, 40%);">- return vm_browse_messages_ja(chan, vms, vmu);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strncasecmp(ast_channel_language(chan), "ja", 2)) { /* JAPANESE */</span><br><span style="color: hsl(120, 100%, 40%);">+ return vm_browse_messages_ja(chan, vms, vmu);</span><br><span> } else if (!strncasecmp(ast_channel_language(chan), "pt", 2)) { /* PORTUGUESE */</span><br><span> return vm_browse_messages_pt(chan, vms, vmu);</span><br><span> } else if (!strncasecmp(ast_channel_language(chan), "vi", 2)) { /* VIETNAMESE */</span><br><span>@@ -12192,22 +12191,22 @@</span><br><span> break;</span><br><span> case '*': /* Help */</span><br><span> if (!vms.starting) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strncasecmp(ast_channel_language(chan), "ja", 2)) {</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = vm_play_folder_name(chan, vms.vmbox);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "digits/1");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "jp-wo");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = ast_play_and_wait(chan, "vm-opts");</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cmd)</span><br><span style="color: hsl(0, 100%, 40%);">- cmd = vm_instructions(chan, vmu, &vms, 1, in_urgent);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strncasecmp(ast_channel_language(chan), "ja", 2)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = vm_play_folder_name(chan, vms.vmbox);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "jp-wa");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "digits/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "jp-wo");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "silence/1");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = ast_play_and_wait(chan, "vm-opts");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+ cmd = vm_instructions(chan, vmu, &vms, 1, in_urgent);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> cmd = ast_play_and_wait(chan, "vm-onefor");</span><br><span> if (!strncasecmp(ast_channel_language(chan), "he", 2)) {</span><br><span> cmd = ast_play_and_wait(chan, "vm-for");</span><br><span>diff --git a/main/say.c b/main/say.c</span><br><span>index f456459..e1b0620 100644</span><br><span>--- a/main/say.c</span><br><span>+++ b/main/say.c</span><br><span>@@ -2040,31 +2040,31 @@</span><br><span> m100 = m1000 % 100;</span><br><span> i100 = m1000 / 100;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (i100>0)</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->setki[i100]);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (i100>0)</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->setki[i100]);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (m100 > 0 && m100 <= 9) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (m1000 > 0)</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry2[m100]);</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry[m100]);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (m100 % 10 == 0 && m100 != 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->dziesiatki[m100 / 10]);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (m100 > 10 && m100 <= 19) {</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->nastki[m100 % 10]);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (m100 > 20) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (odm->separator_dziesiatek[0] == ' ') {</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->dziesiatki[m100 / 10]);</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry2[m100 % 10]);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- char buf[10];</span><br><span style="color: hsl(0, 100%, 40%);">- char *b = buf;</span><br><span style="color: hsl(0, 100%, 40%);">- b = pl_append(b, odm->dziesiatki[m100 / 10]);</span><br><span style="color: hsl(0, 100%, 40%);">- b = pl_append(b, odm->separator_dziesiatek);</span><br><span style="color: hsl(0, 100%, 40%);">- pl_append(b, odm->cyfry2[m100 % 10]);</span><br><span style="color: hsl(0, 100%, 40%);">- pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, buf);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (m100 > 0 && m100 <= 9) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (m1000 > 0)</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry2[m100]);</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry[m100]);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (m100 % 10 == 0 && m100 != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->dziesiatki[m100 / 10]);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (m100 > 10 && m100 <= 19) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->nastki[m100 % 10]);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (m100 > 20) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (odm->separator_dziesiatek[0] == ' ') {</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->dziesiatki[m100 / 10]);</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, odm->cyfry2[m100 % 10]);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ char buf[10];</span><br><span style="color: hsl(120, 100%, 40%);">+ char *b = buf;</span><br><span style="color: hsl(120, 100%, 40%);">+ b = pl_append(b, odm->dziesiatki[m100 / 10]);</span><br><span style="color: hsl(120, 100%, 40%);">+ b = pl_append(b, odm->separator_dziesiatek);</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_append(b, odm->cyfry2[m100 % 10]);</span><br><span style="color: hsl(120, 100%, 40%);">+ pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, buf);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> if (rzad > 0) {</span><br><span> pl_odtworz_plik(chan, language, audiofd, ctrlfd, ints, pl_rzad_na_tekst(odm, i, rzad));</span><br><span>@@ -7913,66 +7913,67 @@</span><br><span> /* Japanese syntax */</span><br><span> static int ast_say_number_full_ja(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- int res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- int playh = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- char fn[256] = "";</span><br><span style="color: hsl(0, 100%, 40%);">- if (!num)</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ int playh = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ char fn[256] = "";</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- while (!res && (num || playh)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (num < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(fn, "digits/minus", sizeof(fn));</span><br><span style="color: hsl(0, 100%, 40%);">- if ( num > INT_MIN ) {</span><br><span style="color: hsl(0, 100%, 40%);">- num = -num;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- num = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (playh) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(fn, "digits/hundred", sizeof(fn));</span><br><span style="color: hsl(0, 100%, 40%);">- playh = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (num < 20) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/%d", num);</span><br><span style="color: hsl(0, 100%, 40%);">- num = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (num < 100) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);</span><br><span style="color: hsl(0, 100%, 40%);">- num %= 10;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (num < 1000){</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/%d", (num/100));</span><br><span style="color: hsl(0, 100%, 40%);">- playh++;</span><br><span style="color: hsl(0, 100%, 40%);">- num %= 100;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (num < 1000000) { /* 1,000,000 */</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number_full_en(chan, num / 1000, ints, language, audiofd, ctrlfd);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res)</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(0, 100%, 40%);">- num %= 1000;</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/thousand");</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (num < 1000000000) { /* 1,000,000,000 */</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number_full_en(chan, num / 1000000, ints, language, audiofd, ctrlfd);</span><br><span style="color: hsl(0, 100%, 40%);">- if (res)</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(0, 100%, 40%);">- num %= 1000000;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(fn, "digits/million", sizeof(fn));</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(1, "Number '%d' is too big for me\n", num);</span><br><span style="color: hsl(0, 100%, 40%);">- res = -1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_streamfile(chan, fn, language)) {</span><br><span style="color: hsl(0, 100%, 40%);">- if ((audiofd > -1) && (ctrlfd > -1))</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stopstream(chan);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!num)</span><br><span style="color: hsl(120, 100%, 40%);">+ return ast_say_digits_full(chan, 0, ints, language, audiofd, ctrlfd);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ while (!res && (num || playh)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (num < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(fn, "digits/minus", sizeof(fn));</span><br><span style="color: hsl(120, 100%, 40%);">+ if ( num > INT_MIN ) {</span><br><span style="color: hsl(120, 100%, 40%);">+ num = -num;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ num = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (playh) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(fn, "digits/hundred", sizeof(fn));</span><br><span style="color: hsl(120, 100%, 40%);">+ playh = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (num < 20) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/%d", num);</span><br><span style="color: hsl(120, 100%, 40%);">+ num = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (num < 100) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);</span><br><span style="color: hsl(120, 100%, 40%);">+ num %= 10;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (num < 1000){</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/%d", (num/100));</span><br><span style="color: hsl(120, 100%, 40%);">+ playh++;</span><br><span style="color: hsl(120, 100%, 40%);">+ num %= 100;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (num < 1000000) { /* 1,000,000 */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number_full_en(chan, num / 1000, ints, language, audiofd, ctrlfd);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res)</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ num %= 1000;</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/thousand");</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (num < 1000000000) { /* 1,000,000,000 */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number_full_en(chan, num / 1000000, ints, language, audiofd, ctrlfd);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res)</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ num %= 1000000;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(fn, "digits/million", sizeof(fn));</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(1, "Number '%d' is too big for me\n", num);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_streamfile(chan, fn, language)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((audiofd > -1) && (ctrlfd > -1))</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_stopstream(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> </span><br><span>@@ -8023,34 +8024,36 @@</span><br><span> /* Japanese syntax */</span><br><span> int ast_say_date_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_tm tm;</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval tv = { t, 0 };</span><br><span style="color: hsl(0, 100%, 40%);">- char fn[256];</span><br><span style="color: hsl(0, 100%, 40%);">- int res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- ast_localtime(&tv, &tm, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/nen", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/nichi", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_tm tm;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct timeval tv = { t, 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+ char fn[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_localtime(&tv, &tm, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/nen", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, tm.tm_mday, ints, lang, (char * ) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/nichi", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> </span><br><span>@@ -8113,47 +8116,46 @@</span><br><span> /* Japanese */</span><br><span> static int ast_say_time_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct timeval tv = { t, 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_tm tm;</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ int hour, pm=0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval tv = { t, 0 };</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_tm tm;</span><br><span style="color: hsl(0, 100%, 40%);">- int res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- int hour, pm=0;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_localtime(&tv, &tm, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ hour = tm.tm_hour;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_localtime(&tv, &tm, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- hour = tm.tm_hour;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!hour)</span><br><span style="color: hsl(120, 100%, 40%);">+ hour = 12;</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (hour == 12)</span><br><span style="color: hsl(120, 100%, 40%);">+ pm = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (hour > 12) {</span><br><span style="color: hsl(120, 100%, 40%);">+ hour -= 12;</span><br><span style="color: hsl(120, 100%, 40%);">+ pm = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!hour)</span><br><span style="color: hsl(0, 100%, 40%);">- hour = 12;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (hour == 12)</span><br><span style="color: hsl(0, 100%, 40%);">- pm = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (hour > 12) {</span><br><span style="color: hsl(0, 100%, 40%);">- hour -= 12;</span><br><span style="color: hsl(0, 100%, 40%);">- pm = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (pm) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/p-m", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/a-m", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (hour == 9 || hour == 21) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/9_2", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, hour, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/ji", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/fun", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (pm) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/p-m", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/a-m", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (hour == 9 || hour == 21) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/9_2", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, hour, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/ji", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/fun", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> </span><br><span>@@ -8194,67 +8196,67 @@</span><br><span> /* Japanese syntax */</span><br><span> int ast_say_datetime_ja(struct ast_channel *chan, time_t t, const char *ints, const char *lang)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval tv = { t, 0 };</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_tm tm;</span><br><span style="color: hsl(0, 100%, 40%);">- char fn[256];</span><br><span style="color: hsl(0, 100%, 40%);">- int res = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- int hour, pm=0;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct timeval tv = { t, 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_tm tm;</span><br><span style="color: hsl(120, 100%, 40%);">+ char fn[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ int hour, pm = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_localtime(&tv, &tm, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_localtime(&tv, &tm, NULL);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/nen", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/nichi", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/nen", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/nichi", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, fn, lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- hour = tm.tm_hour;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!hour)</span><br><span style="color: hsl(0, 100%, 40%);">- hour = 12;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (hour == 12)</span><br><span style="color: hsl(0, 100%, 40%);">- pm = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- else if (hour > 12) {</span><br><span style="color: hsl(0, 100%, 40%);">- hour -= 12;</span><br><span style="color: hsl(0, 100%, 40%);">- pm = 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (pm) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/p-m", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/a-m", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (hour == 9 || hour == 21) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/9_2", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, hour, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/ji", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_streamfile(chan, "digits/fun", lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res)</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ hour = tm.tm_hour;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!hour)</span><br><span style="color: hsl(120, 100%, 40%);">+ hour = 12;</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (hour == 12)</span><br><span style="color: hsl(120, 100%, 40%);">+ pm = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (hour > 12) {</span><br><span style="color: hsl(120, 100%, 40%);">+ hour -= 12;</span><br><span style="color: hsl(120, 100%, 40%);">+ pm = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (pm) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/p-m", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/a-m", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (hour == 9 || hour == 21) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/9_2", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, hour, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/ji", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_streamfile(chan, "digits/fun", lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res)</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_waitstream(chan, ints);</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> /*! \brief Greek support</span><br><span>@@ -8433,269 +8435,269 @@</span><br><span> /* Japanese syntax */</span><br><span> int ast_say_date_with_format_ja(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval tv = { time, 0 };</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_tm tm;</span><br><span style="color: hsl(0, 100%, 40%);">- int res=0, offset, sndoffset;</span><br><span style="color: hsl(0, 100%, 40%);">- char sndfile[256], nextmsg[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ struct timeval tv = { time, 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_tm tm;</span><br><span style="color: hsl(120, 100%, 40%);">+ int res = 0, offset, sndoffset;</span><br><span style="color: hsl(120, 100%, 40%);">+ char sndfile[256], nextmsg[256];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!format)</span><br><span style="color: hsl(0, 100%, 40%);">- format = "YbdAPIMS";</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!format)</span><br><span style="color: hsl(120, 100%, 40%);">+ format = "YbdAPIMS";</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_localtime(&tv, &tm, timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_localtime(&tv, &tm, timezone);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- for (offset=0 ; format[offset] != '\0' ; offset++) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);</span><br><span style="color: hsl(0, 100%, 40%);">- switch (format[offset]) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* NOTE: if you add more options here, please try to be consistent with strftime(3) */</span><br><span style="color: hsl(0, 100%, 40%);">- case '\'':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Literal name of a sound file */</span><br><span style="color: hsl(0, 100%, 40%);">- for (sndoffset = 0 ; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {</span><br><span style="color: hsl(0, 100%, 40%);">- sndfile[sndoffset] = format[offset];</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- sndfile[sndoffset] = '\0';</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,sndfile,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'A':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'a':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Sunday - Saturday */</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/day-%d", tm.tm_wday);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'B':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'b':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'h':</span><br><span style="color: hsl(0, 100%, 40%);">- /* January - December */</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'd':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'e':</span><br><span style="color: hsl(0, 100%, 40%);">- /* First - Thirtyfirst */</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_mday < 21) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/h-%d_2", tm.tm_mday);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (tm.tm_mday < 30) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Between 21 and 29 - two sounds */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/20",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_mday - 20);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/nichi",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (tm.tm_mday == 30) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* 30 */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/h-30_2",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- /* 31 */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/30",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/1",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/nichi",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'Y':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Year */</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_year > 99) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/2",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/thousand",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_year > 100) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* This works until the end of 2020 */</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year - 100);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_year < 1) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* I'm not going to handle 1900 and prior */</span><br><span style="color: hsl(0, 100%, 40%);">- /* We'll just be silent on the year, instead of bombing out. */</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/19",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_year <= 9) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* 1901 - 1909 */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/oh",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (tm.tm_year <= 20) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* 1910 - 1920 */</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- /* 1921 - 1999 */</span><br><span style="color: hsl(0, 100%, 40%);">- int ten, one;</span><br><span style="color: hsl(0, 100%, 40%);">- ten = tm.tm_year / 10;</span><br><span style="color: hsl(0, 100%, 40%);">- one = tm.tm_year % 10;</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten * 10);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (one != 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/nen",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'P':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'p':</span><br><span style="color: hsl(0, 100%, 40%);">- /* AM/PM */</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_hour > 11)</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/p-m");</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/a-m");</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'I':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'l':</span><br><span style="color: hsl(0, 100%, 40%);">- /* 12-Hour */</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_hour == 0)</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/12");</span><br><span style="color: hsl(0, 100%, 40%);">- else if (tm.tm_hour == 9 || tm.tm_hour == 21)</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/9_2");</span><br><span style="color: hsl(0, 100%, 40%);">- else if (tm.tm_hour > 12)</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);</span><br><span style="color: hsl(0, 100%, 40%);">- else</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if(!res) res = wait_file(chan,ints, "digits/ji",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'H':</span><br><span style="color: hsl(0, 100%, 40%);">- case 'k':</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_hour != 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- int remainder = tm.tm_hour;</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_hour > 20) {</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/20",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- remainder -= 20;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", remainder);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/ji",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'M':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Minute */</span><br><span style="color: hsl(0, 100%, 40%);">- if ((tm.tm_min < 21) || (tm.tm_min % 10 == 0)) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_min);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- int ten, one;</span><br><span style="color: hsl(0, 100%, 40%);">- ten = (tm.tm_min / 10) * 10;</span><br><span style="color: hsl(0, 100%, 40%);">- one = (tm.tm_min % 10);</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Fifty, not fifty-zero */</span><br><span style="color: hsl(0, 100%, 40%);">- if (one != 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/fun",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'Q':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Shorthand for "Today", "Yesterday", or ABdY */</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval now;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_tm tmnow;</span><br><span style="color: hsl(0, 100%, 40%);">- time_t beg_today;</span><br><span style="color: hsl(120, 100%, 40%);">+ for (offset = 0; format[offset] != '\0'; offset++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_DEBUG, "Parsing %c (offset %d) in %s\n", format[offset], offset, format);</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (format[offset]) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* NOTE: if you add more options here, please try to be consistent with strftime(3) */</span><br><span style="color: hsl(120, 100%, 40%);">+ case '\'':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Literal name of a sound file */</span><br><span style="color: hsl(120, 100%, 40%);">+ for (sndoffset = 0; (format[++offset] != '\'') && (sndoffset < sizeof(sndfile) - 1) ; sndoffset++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ sndfile[sndoffset] = format[offset];</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ sndfile[sndoffset] = '\0';</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,sndfile,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'A':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'a':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Sunday - Saturday */</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/day-%d", tm.tm_wday);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'B':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'b':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'h':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* January - December */</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/mon-%d", tm.tm_mon);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'd':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'e':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* First - Thirtyfirst */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_mday < 21) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/h-%d_2", tm.tm_mday);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (tm.tm_mday < 30) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Between 21 and 29 - two sounds */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/20",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_mday - 20);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/nichi",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (tm.tm_mday == 30) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 30 */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/h-30_2",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 31 */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/30",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/1",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/nichi",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'Y':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Year */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_year > 99) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/2",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/thousand",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_year > 100) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* This works until the end of 2020 */</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year - 100);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_year < 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* I'm not going to handle 1900 and prior */</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We'll just be silent on the year, instead of bombing out. */</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/19",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_year <= 9) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 1901 - 1909 */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/oh",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (tm.tm_year <= 20) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 1910 - 1920 */</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_year);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 1921 - 1999 */</span><br><span style="color: hsl(120, 100%, 40%);">+ int ten, one;</span><br><span style="color: hsl(120, 100%, 40%);">+ ten = tm.tm_year / 10;</span><br><span style="color: hsl(120, 100%, 40%);">+ one = tm.tm_year % 10;</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten * 10);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (one != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/nen",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'P':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'p':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* AM/PM */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_hour > 11)</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/p-m");</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/a-m");</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'I':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'l':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* 12-Hour */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_hour == 0)</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/12");</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (tm.tm_hour == 9 || tm.tm_hour == 21)</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/9_2");</span><br><span style="color: hsl(120, 100%, 40%);">+ else if (tm.tm_hour > 12)</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);</span><br><span style="color: hsl(120, 100%, 40%);">+ else</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if(!res) res = wait_file(chan,ints, "digits/ji",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'H':</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'k':</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_hour != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ int remainder = tm.tm_hour;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_hour > 20) {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/20",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ remainder -= 20;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", remainder);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/ji",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'M':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Minute */</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((tm.tm_min < 21) || (tm.tm_min % 10 == 0)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_min);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ int ten, one;</span><br><span style="color: hsl(120, 100%, 40%);">+ ten = (tm.tm_min / 10) * 10;</span><br><span style="color: hsl(120, 100%, 40%);">+ one = (tm.tm_min % 10);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Fifty, not fifty-zero */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (one != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/fun",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'Q':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Shorthand for "Today", "Yesterday", or ABdY */</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct timeval now;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_tm tmnow;</span><br><span style="color: hsl(120, 100%, 40%);">+ time_t beg_today;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- gettimeofday(&now,NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_localtime(&now,&tmnow,timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */</span><br><span style="color: hsl(0, 100%, 40%);">- /* In any case, it saves not having to do ast_mktime() */</span><br><span style="color: hsl(0, 100%, 40%);">- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);</span><br><span style="color: hsl(0, 100%, 40%);">- if (beg_today < time) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Today */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/today",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (beg_today - 86400 < time) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Yesterday */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/yesterday",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'q':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */</span><br><span style="color: hsl(0, 100%, 40%);">- {</span><br><span style="color: hsl(0, 100%, 40%);">- struct timeval now;</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_tm tmnow;</span><br><span style="color: hsl(0, 100%, 40%);">- time_t beg_today;</span><br><span style="color: hsl(120, 100%, 40%);">+ gettimeofday(&now,NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_localtime(&now,&tmnow,timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */</span><br><span style="color: hsl(120, 100%, 40%);">+ /* In any case, it saves not having to do ast_mktime() */</span><br><span style="color: hsl(120, 100%, 40%);">+ beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (beg_today < time) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Today */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/today",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (beg_today - 86400 < time) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Yesterday */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/yesterday",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'q':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Shorthand for "" (today), "Yesterday", A (weekday), or ABdY */</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct timeval now;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_tm tmnow;</span><br><span style="color: hsl(120, 100%, 40%);">+ time_t beg_today;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- gettimeofday(&now,NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_localtime(&now,&tmnow,timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */</span><br><span style="color: hsl(0, 100%, 40%);">- /* In any case, it saves not having to do ast_mktime() */</span><br><span style="color: hsl(0, 100%, 40%);">- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);</span><br><span style="color: hsl(0, 100%, 40%);">- if (beg_today < time) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Today */</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((beg_today - 86400) < time) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Yesterday */</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/yesterday",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (beg_today - 86400 * 6 < time) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Within the last week */</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_date_with_format(chan, time, ints, lang, "A", timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'R':</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_date_with_format(chan, time, ints, lang, "HM", timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'S':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Seconds */</span><br><span style="color: hsl(0, 100%, 40%);">- if (tm.tm_sec == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- int ten, one;</span><br><span style="color: hsl(0, 100%, 40%);">- ten = (tm.tm_sec / 10) * 10;</span><br><span style="color: hsl(0, 100%, 40%);">- one = (tm.tm_sec % 10);</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!res) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Fifty, not fifty-zero */</span><br><span style="color: hsl(0, 100%, 40%);">- if (one != 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- res = wait_file(chan,ints, "digits/byou",lang);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case 'T':</span><br><span style="color: hsl(0, 100%, 40%);">- res = ast_say_date_with_format(chan, time, ints, lang, "HMS", timezone);</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- case ' ':</span><br><span style="color: hsl(0, 100%, 40%);">- case ' ':</span><br><span style="color: hsl(0, 100%, 40%);">- /* Just ignore spaces and tabs */</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- default:</span><br><span style="color: hsl(0, 100%, 40%);">- /* Unknown character */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- /* Jump out on DTMF */</span><br><span style="color: hsl(0, 100%, 40%);">- if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">- break;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return res;</span><br><span style="color: hsl(120, 100%, 40%);">+ gettimeofday(&now,NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_localtime(&now,&tmnow,timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* This might be slightly off, if we transcend a leap second, but never more off than 1 second */</span><br><span style="color: hsl(120, 100%, 40%);">+ /* In any case, it saves not having to do ast_mktime() */</span><br><span style="color: hsl(120, 100%, 40%);">+ beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (beg_today < time) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Today */</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if ((beg_today - 86400) < time) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Yesterday */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/yesterday",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (beg_today - 86400 * 6 < time) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Within the last week */</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_date_with_format(chan, time, ints, lang, "A", timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_date_with_format(chan, time, ints, lang, "ABdY", timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'R':</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_date_with_format(chan, time, ints, lang, "HM", timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'S':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Seconds */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (tm.tm_sec == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if ((tm.tm_sec < 21) || (tm.tm_sec % 10 == 0)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_sec);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ int ten, one;</span><br><span style="color: hsl(120, 100%, 40%);">+ ten = (tm.tm_sec / 10) * 10;</span><br><span style="color: hsl(120, 100%, 40%);">+ one = (tm.tm_sec % 10);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", ten);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Fifty, not fifty-zero */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (one != 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(nextmsg,sizeof(nextmsg), "digits/%d", one);</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints,nextmsg,lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ res = wait_file(chan,ints, "digits/byou",lang);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case 'T':</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_say_date_with_format(chan, time, ints, lang, "HMS", timezone);</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case ' ':</span><br><span style="color: hsl(120, 100%, 40%);">+ case ' ':</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Just ignore spaces and tabs */</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ default:</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Unknown character */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Unknown character in datetime format %s: %c at pos %d\n", format, format[offset], offset);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Jump out on DTMF */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (res) {</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> /*! \brief Vietnamese syntax */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13642">change 13642</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13642"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I72c725f5930084673749bd7c9cc426a987f08e87 </div>
<div style="display:none"> Gerrit-Change-Number: 13642 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>