aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-03 20:10:19 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-03 20:10:19 +0000
commit4e5d65e36ddb04bf6f7ca70199ba415b3b49ef80 (patch)
treee87b0b93eb84d0367735b9770b1d370770075690 /apps/app_voicemail.c
parentf8239e63a712c4d9e8b25c333118062e72a76188 (diff)
Deprecate "cz" in favor of "cs".
Also, change the use of language codes so that language registers as a prefix, rather than an exact match. (closes issue #16272) Reported by: patrol-cz Patches: 20091203__issue16272.diff.txt uploaded by tilghman (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@232820 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c138
1 files changed, 75 insertions, 63 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index d674e9633..591199f2e 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5445,28 +5445,29 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v
/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
#endif
- if (the_zone)
+ if (the_zone) {
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
- else if (!strcasecmp(chan->language,"pl")) /* POLISH syntax */
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL);
- else if (!strcasecmp(chan->language,"se")) /* SWEDISH syntax */
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
- else if (!strcasecmp(chan->language,"no")) /* NORWEGIAN syntax */
+ } else if (!strncasecmp(chan->language, "de", 2)) { /* GERMAN syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
- else if (!strcasecmp(chan->language,"de")) /* GERMAN syntax */
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
- else if (!strcasecmp(chan->language,"nl")) /* DUTCH syntax */
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL);
- else if (!strcasecmp(chan->language,"it")) /* ITALIAN syntax */
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL);
- else if (!strcasecmp(chan->language,"gr"))
+ } else if (!strncasecmp(chan->language, "gr", 2)) { /* GREEK syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q H 'digits/kai' M ", NULL);
- else if (!strcasecmp(chan->language,"pt_BR"))
- res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL);
- else if (!strcasecmp(chan->language,"he"))
+ } else if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW syntax */
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'at2' kM", NULL);
- else
+ } else if (!strncasecmp(chan->language, "it", 2)) { /* ITALIAN syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' 'digits/hours' k 'digits/e' M 'digits/minutes'", NULL);
+ } else if (!strncasecmp(chan->language, "nl", 2)) { /* DUTCH syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/nl-om' HM", NULL);
+ } else if (!strncasecmp(chan->language, "no", 2)) { /* NORWEGIAN syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q 'digits/at' HM", NULL);
+ } else if (!strncasecmp(chan->language, "pl", 2)) { /* POLISH syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL);
+ } else if (!strncasecmp(chan->language, "pt_BR", 5)) { /* PORTUGUESE syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL);
+ } else if (!strncasecmp(chan->language, "se", 2)) { /* SWEDISH syntax */
+ res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' dB 'digits/at' k 'and' M", NULL);
+ } else {
res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
+ }
#if 0
pbx_builtin_setvar_helper(chan, "DIFF_DAY", NULL);
#endif
@@ -5562,7 +5563,7 @@ static int play_message_duration(struct ast_channel *chan, struct vm_state *vms,
res = wait_file2(chan, vms, "vm-duration");
/* POLISH syntax */
- if (!strcasecmp(chan->language, "pl")) {
+ if (!strncasecmp(chan->language, "pl", 2)) {
div_t num = div(durationm, 10);
if (durationm == 1) {
@@ -5604,7 +5605,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
make_file(vms->fn, sizeof(vms->fn), vms->curdir, vms->curmsg);
adsi_message(chan, vms);
- if (!strcasecmp(chan->language, "he")) { /* HEBREW FORMAT */
+ if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW FORMAT */
/*
* The syntax in hebrew for counting the number of message is up side down
* in comparison to english.
@@ -5624,15 +5625,15 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, "f");
}
}
- }
+ }
- } else if (!strcasecmp(chan->language, "pl")) { /* POLISH FORMAT */
+ } else if (!strncasecmp(chan->language, "pl", 2)) { /* POLISH FORMAT */
if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
int ten, one;
char nextmsg[256];
ten = (vms->curmsg + 1) / 10;
one = (vms->curmsg + 1) % 10;
-
+
if (vms->curmsg < 20) {
snprintf(nextmsg, sizeof(nextmsg), "digits/n-%d", vms->curmsg + 1);
res = wait_file2(chan, vms, nextmsg);
@@ -5650,7 +5651,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
if (!res)
res = wait_file2(chan, vms, "vm-message");
- } else if (!strcasecmp(chan->language, "se")) { /* SWEDISH FORMAT */
+ } else if (!strncasecmp(chan->language, "se", 2)) { /* SWEDISH FORMAT */
if (!vms->curmsg)
res = wait_file2(chan, vms, "vm-first"); /* "First" */
else if (vms->curmsg == vms->lastmsg)
@@ -5896,16 +5897,18 @@ static int vm_play_folder_name(struct ast_channel *chan, char *mbox)
{
int cmd;
- if (!strcasecmp(chan->language, "it") || !strcasecmp(chan->language, "es") || !strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* Italian, Spanish, French or Portuguese syntax */
+ if ( !strncasecmp(chan->language, "it", 2) ||
+ !strncasecmp(chan->language, "es", 2) ||
+ !strncasecmp(chan->language, "pt", 2)) { /* Italian, Spanish, or Portuguese syntax */
cmd = ast_play_and_wait(chan, "vm-messages"); /* "messages */
return cmd ? cmd : ast_play_and_wait(chan, mbox);
- } else if (!strcasecmp(chan->language, "gr")){
+ } else if (!strncasecmp(chan->language, "gr", 2)) {
return vm_play_folder_name_gr(chan, mbox);
- } else if (!strcasecmp(chan->language, "pl")){
+ } else if (!strncasecmp(chan->language, "pl", 2)) {
return vm_play_folder_name_pl(chan, mbox);
- } else if (!strcasecmp(chan->language, "ua")){ /* Ukrainian syntax */
+ } else if (!strncasecmp(chan->language, "ua", 2)) { /* Ukrainian syntax */
return vm_play_folder_name_ua(chan, mbox);
- } else if (!strcasecmp(chan->language, "he")){ /* Hebrew syntax */
+ } else if (!strncasecmp(chan->language, "he", 2)) { /* Hebrew syntax */
cmd = ast_play_and_wait(chan, mbox);
return cmd;
} else { /* Default English */
@@ -6673,7 +6676,7 @@ static int vm_intro_pt(struct ast_channel *chan,struct vm_state *vms)
* vm-no : no ( no messages )
*/
-static int vm_intro_cz(struct ast_channel *chan,struct vm_state *vms)
+static int vm_intro_cs(struct ast_channel *chan,struct vm_state *vms)
{
int res;
res = ast_play_and_wait(chan, "vm-youhave");
@@ -6747,37 +6750,44 @@ static int vm_intro(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm
}
/* Play voicemail intro - syntax is different for different languages */
- if (!strcasecmp(chan->language, "de")) { /* GERMAN syntax */
+ if (0) {
+ } else if (!strncasecmp(chan->language, "cs", 2)) { /* CZECH syntax */
+ return vm_intro_cs(chan, vms);
+ } else if (!strncasecmp(chan->language, "cz", 2)) { /* deprecated CZECH syntax */
+ static int deprecation_warning = 0;
+ if (deprecation_warning++ % 10 == 0) {
+ ast_log(LOG_WARNING, "cz is not a standard language code. Please switch to using cs instead.\n");
+ }
+ return vm_intro_cs(chan, vms);
+ } else if (!strncasecmp(chan->language, "de", 2)) { /* GERMAN syntax */
return vm_intro_de(chan, vms);
- } else if (!strcasecmp(chan->language, "es")) { /* SPANISH syntax */
+ } else if (!strncasecmp(chan->language, "es", 2)) { /* SPANISH syntax */
return vm_intro_es(chan, vms);
- } else if (!strcasecmp(chan->language, "it")) { /* ITALIAN syntax */
- return vm_intro_it(chan, vms);
- } else if (!strcasecmp(chan->language, "fr")) { /* FRENCH syntax */
+ } else if (!strncasecmp(chan->language, "fr", 2)) { /* FRENCH syntax */
return vm_intro_fr(chan, vms);
- } else if (!strcasecmp(chan->language, "nl")) { /* DUTCH syntax */
- return vm_intro_nl(chan, vms);
- } else if (!strcasecmp(chan->language, "pt")) { /* PORTUGUESE syntax */
- return vm_intro_pt(chan, vms);
- } else if (!strcasecmp(chan->language, "pt_BR")) { /* BRAZILIAN PORTUGUESE syntax */
- return vm_intro_pt_BR(chan, vms);
- } else if (!strcasecmp(chan->language, "cz")) { /* CZECH syntax */
- return vm_intro_cz(chan, vms);
- } else if (!strcasecmp(chan->language, "gr")) { /* GREEK syntax */
+ } else if (!strncasecmp(chan->language, "gr", 2)) { /* GREEK syntax */
return vm_intro_gr(chan, vms);
- } else if (!strcasecmp(chan->language, "pl")) { /* POLISH syntax */
- return vm_intro_pl(chan, vms);
- } else if (!strcasecmp(chan->language, "se")) { /* SWEDISH syntax */
- return vm_intro_se(chan, vms);
- } else if (!strcasecmp(chan->language, "no")) { /* NORWEGIAN syntax */
+ } else if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW syntax */
+ return vm_intro_he(chan, vms);
+ } else if (!strncasecmp(chan->language, "it", 2)) { /* ITALIAN syntax */
+ return vm_intro_it(chan, vms);
+ } else if (!strncasecmp(chan->language, "nl", 2)) { /* DUTCH syntax */
+ return vm_intro_nl(chan, vms);
+ } else if (!strncasecmp(chan->language, "no", 2)) { /* NORWEGIAN syntax */
return vm_intro_no(chan, vms);
- } else if (!strcasecmp(chan->language, "ru")) { /* RUSSIAN syntax */
+ } else if (!strncasecmp(chan->language, "pl", 2)) { /* POLISH syntax */
+ return vm_intro_pl(chan, vms);
+ } else if (!strncasecmp(chan->language, "pt_BR", 5)) { /* BRAZILIAN PORTUGUESE syntax */
+ return vm_intro_pt_BR(chan, vms);
+ } else if (!strncasecmp(chan->language, "pt", 2)) { /* PORTUGUESE syntax */
+ return vm_intro_pt(chan, vms);
+ } else if (!strncasecmp(chan->language, "ru", 2)) { /* RUSSIAN syntax */
return vm_intro_multilang(chan, vms, "n");
- } else if (!strcasecmp(chan->language, "ua")) { /* UKRAINIAN syntax */
+ } else if (!strncasecmp(chan->language, "se", 2)) { /* SWEDISH syntax */
+ return vm_intro_se(chan, vms);
+ } else if (!strncasecmp(chan->language, "ua", 2)) { /* UKRAINIAN syntax */
return vm_intro_multilang(chan, vms, "n");
- } else if (!strcasecmp(chan->language, "he")) { /* HEBREW syntax */
- return vm_intro_he(chan, vms);
- } else { /* Default to ENGLISH */
+ } else { /* Default to ENGLISH */
return vm_intro_en(chan, vms);
}
}
@@ -6790,8 +6800,9 @@ static int vm_instructions(struct ast_channel *chan, struct vm_state *vms, int s
if (vms->starting) {
if (vms->lastmsg > -1) {
res = ast_play_and_wait(chan, "vm-onefor");
- if (!strcasecmp(chan->language, "he"))
+ if (!strncasecmp(chan->language, "he", 2)) {
res = ast_play_and_wait(chan, "vm-for");
+ }
if (!res)
res = vm_play_folder_name(chan, vms->vmbox);
}
@@ -7219,17 +7230,17 @@ static int vm_browse_messages_pt(struct ast_channel *chan, struct vm_state *vms,
static int vm_browse_messages(struct ast_channel *chan, struct vm_state *vms, struct ast_vm_user *vmu)
{
- if (!strcasecmp(chan->language, "es")) { /* SPANISH */
+ if (!strncasecmp(chan->language, "es", 2)) { /* SPANISH */
return vm_browse_messages_es(chan, vms, vmu);
- } else if (!strcasecmp(chan->language, "it")) { /* ITALIAN */
+ } else if (!strncasecmp(chan->language, "gr", 2)) { /* GREEK */
+ return vm_browse_messages_gr(chan, vms, vmu);
+ } else if (!strncasecmp(chan->language, "he", 2)) { /* HEBREW */
+ return vm_browse_messages_he(chan, vms, vmu);
+ } else if (!strncasecmp(chan->language, "it", 2)) { /* ITALIAN */
return vm_browse_messages_it(chan, vms, vmu);
- } else if (!strcasecmp(chan->language, "pt") || !strcasecmp(chan->language, "pt_BR")) { /* PORTUGUESE */
+ } else if (!strncasecmp(chan->language, "pt", 2)) { /* PORTUGUESE */
return vm_browse_messages_pt(chan, vms, vmu);
- } else if (!strcasecmp(chan->language, "gr")){
- return vm_browse_messages_gr(chan, vms, vmu); /* GREEK */
- } else if (!strcasecmp(chan->language, "he")) {
- return vm_browse_messages_he(chan, vms, vmu); /* HEBREW */
- } else { /* Default to English syntax */
+ } else { /* Default to English syntax */
return vm_browse_messages_en(chan, vms, vmu);
}
}
@@ -7829,8 +7840,9 @@ static int vm_execmain(struct ast_channel *chan, void *data)
case '*':
if (!vms.starting) {
cmd = ast_play_and_wait(chan, "vm-onefor");
- if (!strcasecmp(chan->language, "he"))
+ if (!strncasecmp(chan->language, "he", 2)) {
cmd = ast_play_and_wait(chan, "vm-for");
+ }
if (!cmd)
cmd = vm_play_folder_name(chan, vms.vmbox);
if (!cmd)