diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-01 21:28:19 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-01 21:28:19 +0000 |
commit | dd8a0566baf7c852967fb272055fbaa43b8e3b07 (patch) | |
tree | 271c16392c83b0ac2ff0226f1fd1cb4554e1bae7 /include | |
parent | c8b64290b516220434ca6aa4996372f8155294f3 (diff) |
Support setting locale per-mailbox (changes date/time languages for email, pager messages).
(closes issue #14333)
Reported by: klaus3000
Patches:
20090515__issue14333.diff.txt uploaded by tilghman (license 14)
app_voicemail.c-svn-trunk-rev211675-patch.txt uploaded by klaus3000 (license 65)
Tested by: klaus3000
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266828 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/autoconfig.h.in | 54 | ||||
-rw-r--r-- | include/asterisk/localtime.h | 17 |
2 files changed, 48 insertions, 23 deletions
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 5a640ca1b..601d0be3b 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -466,6 +466,9 @@ /* Define if your system has the NETSNMP libraries. */ #undef HAVE_NETSNMP +/* Define to 1 if you have the `newlocale' function. */ +#undef HAVE_NEWLOCALE + /* Define to 1 if you have the newt library. */ #undef HAVE_NEWT @@ -770,7 +773,7 @@ /* Define to 1 if you have the `strtoq' function. */ #undef HAVE_STRTOQ -/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +/* Define to 1 if `st_blksize' is member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if you have the mISDN Supplemental Services library. */ @@ -1038,12 +1041,12 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to 1 if the C compiler supports function prototypes. */ +#undef PROTOTYPES + /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE @@ -1063,6 +1066,11 @@ /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 +/* Define to 1 if the `setvbuf' function takes the buffering type as its + second argument and the buffer pointer as the third, as on System V before + release 3. */ +#undef SETVBUF_REVERSED + /* The size of `char *', as computed by sizeof. */ #undef SIZEOF_CHAR_P @@ -1092,30 +1100,20 @@ /* Define to 1 if your <sys/time.h> declares `struct tm'. */ #undef TM_IN_SYS_TIME -/* Enable extensions on AIX 3, Interix. */ +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE @@ -1133,6 +1131,20 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE +/* Enable extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif + +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/include/asterisk/localtime.h b/include/asterisk/localtime.h index 8858c43a3..ed5fe36b9 100644 --- a/include/asterisk/localtime.h +++ b/include/asterisk/localtime.h @@ -1,10 +1,10 @@ /* * Asterisk -- An open source telephony toolkit. * - * Copyright (C) 1999 - 2005, Digium, Inc. + * Copyright (C) 1999 - 2010, Digium, Inc. * * Mark Spencer <markster@digium.com> - * Tilghman Lesher <tlesher@vcch.com> + * Tilghman Lesher <tlesher AT digium DOT com> * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact @@ -24,6 +24,12 @@ #ifndef _ASTERISK_LOCALTIME_H #define _ASTERISK_LOCALTIME_H +#ifdef HAVE_NEWLOCALE +#include <locale.h> +#else +typedef void * locale_t; +#endif + struct ast_tm { int tm_sec; /*!< Seconds. [0-60] (1 leap second) */ int tm_min; /*!< Minutes. [0-59] */ @@ -57,6 +63,9 @@ void ast_get_dst_info(const time_t * const timep, int *dst_enabled, time_t *dst_ */ struct timeval ast_mktime(struct ast_tm * const tmp, const char *zone); +/*!\brief Set the thread-local representation of the current locale. */ +const char *ast_setlocale(const char *locale); + /*!\brief Special version of strftime(3) that handles fractions of a second. * Takes the same arguments as strftime(3), with the addition of %q, which * specifies microseconds. @@ -64,9 +73,11 @@ struct timeval ast_mktime(struct ast_tm * const tmp, const char *zone); * \param len Size of the chunk of memory buf. * \param format A string specifying the format of time to be placed into buf. * \param tm Pointer to the broken out time to be used for the format. + * \param locale Text string specifying the locale to be used for language strings. * \retval An integer value specifying the number of bytes placed into buf or -1 on error. */ int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm); +int ast_strftime_locale(char *buf, size_t len, const char *format, const struct ast_tm *tm, const char *locale); /*!\brief Special version of strptime(3) which places the answer in the common * structure ast_tm. Also, unlike strptime(3), ast_strptime() initializes its @@ -74,9 +85,11 @@ int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm * \param s A string specifying some portion of a date and time. * \param format The format in which the string, s, is expected. * \param tm The broken-out time structure into which the parsed data is expected. + * \param locale Text string specifying the locale to be used for language strings. * \retval A pointer to the first character within s not used to parse the date and time. */ char *ast_strptime(const char *s, const char *format, struct ast_tm *tm); +char *ast_strptime_locale(const char *s, const char *format, struct ast_tm *tm, const char *locale); /*!\brief Wakeup localtime monitor thread * For use in testing. Normally, the failsafe monitor thread waits 60 seconds |