aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_language.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-12 04:28:58 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-12 04:28:58 +0000
commit5d9ed5739aab2b302efc178d21e6c75672369db3 (patch)
tree5c4270c1ac3d265b96361d98722a75b947f2f8c6 /funcs/func_language.c
parent9f87dd693e9e74816b913a157fdcdefa3d7a2e56 (diff)
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9674 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_language.c')
-rw-r--r--funcs/func_language.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/funcs/func_language.c b/funcs/func_language.c
index f6bc1a4c9..05835d6d3 100644
--- a/funcs/func_language.c
+++ b/funcs/func_language.c
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -36,31 +36,42 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/stringfields.h"
-static char *language_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int depwarning = 0;
+
+static int language_read(struct ast_channel *chan, char *cmd, char *data,
+ char *buf, size_t len)
{
+ if (!depwarning) {
+ depwarning = 1;
+ ast_log(LOG_WARNING,
+ "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
+ }
+
ast_copy_string(buf, chan->language, len);
- return buf;
+ return 0;
}
-static void language_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+static int language_write(struct ast_channel *chan, char *cmd, char *data,
+ const char *value)
{
+ if (!depwarning) {
+ depwarning = 1;
+ ast_log(LOG_WARNING,
+ "LANGUAGE() is deprecated; use CHANNEL(language) instead.\n");
+ }
+
if (value)
- ast_string_field_set(chan, language, value);
+ ast_string_field_set(chan, language, value);
+
+ return 0;
}
static struct ast_custom_function language_function = {
.name = "LANGUAGE",
.synopsis = "Gets or sets the channel's language.",
.syntax = "LANGUAGE()",
- .desc = "Gets or sets the channel language. This information is used for the\n"
- "syntax in generation of numbers, and to choose a natural language file\n"
- "when available. For example, if language is set to 'fr' and the file\n"
- "'demo-congrats' is requested to be played, if the file\n"
- "'fr/demo-congrats' exists, then it will play that file, and if not\n"
- "will play the normal 'demo-congrats'. For some language codes,\n"
- "changing the language also changes the syntax of some Asterisk\n"
- "functions, like SayNumber.\n",
+ .desc = "Deprecated. Use CHANNEL(language) instead.\n",
.read = language_read,
.write = language_write,
};
@@ -69,12 +80,12 @@ static char *tdesc = "Channel language dialplan function";
int unload_module(void)
{
- return ast_custom_function_unregister(&language_function);
+ return ast_custom_function_unregister(&language_function);
}
int load_module(void)
{
- return ast_custom_function_register(&language_function);
+ return ast_custom_function_register(&language_function);
}
char *description(void)
@@ -91,11 +102,3 @@ char *key()
{
return ASTERISK_GPL_KEY;
}
-
-/*
-Local Variables:
-mode: C
-c-file-style: "linux"
-indent-tabs-mode: nil
-End:
-*/