diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-02 21:27:53 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-02 21:27:53 +0000 |
commit | 2da25c2375d13755ffe7d2e3d9095311d2357e0d (patch) | |
tree | 507f4c47c1aefc693554b8df76781b4c44b0f75a /main/app.c | |
parent | ca1d54fd32089eedea8f3a12d1109ec362d87f21 (diff) |
Keep ast_app_inboxcount API compatible with 1.6.0.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@127609 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/app.c')
-rw-r--r-- | main/app.c | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/main/app.c b/main/app.c index 852e3b88e..0ea5cefe6 100644 --- a/main/app.c +++ b/main/app.c @@ -176,17 +176,20 @@ int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxle } static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL; -static int (*ast_inboxcount_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) = NULL; +static int (*ast_inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL; +static int (*ast_inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) = NULL; static int (*ast_sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context) = NULL; static int (*ast_messagecount_func)(const char *context, const char *mailbox, const char *folder) = NULL; void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder), - int (*inboxcount_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs), + int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs), + int (*inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs), int (*messagecount_func)(const char *context, const char *mailbox, const char *folder), int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context)) { ast_has_voicemail_func = has_voicemail_func; ast_inboxcount_func = inboxcount_func; + ast_inboxcount2_func = inboxcount2_func; ast_messagecount_func = messagecount_func; ast_sayname_func = sayname_func; } @@ -195,6 +198,7 @@ void ast_uninstall_vm_functions(void) { ast_has_voicemail_func = NULL; ast_inboxcount_func = NULL; + ast_inboxcount2_func = NULL; ast_messagecount_func = NULL; ast_sayname_func = NULL; } @@ -213,17 +217,42 @@ int ast_app_has_voicemail(const char *mailbox, const char *folder) } -int ast_app_inboxcount(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) +int ast_app_inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs) { static int warned = 0; - if (newmsgs) + if (newmsgs) { *newmsgs = 0; - if (oldmsgs) + } + if (oldmsgs) { + *oldmsgs = 0; + } + if (ast_inboxcount_func) { + return ast_inboxcount_func(mailbox, newmsgs, oldmsgs); + } + + if (!warned) { + warned++; + ast_verb(3, "Message count requested for mailbox %s but voicemail not loaded.\n", mailbox); + } + + return 0; +} + +int ast_app_inboxcount2(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) +{ + static int warned = 0; + if (newmsgs) { + *newmsgs = 0; + } + if (oldmsgs) { *oldmsgs = 0; - if (urgentmsgs) + } + if (urgentmsgs) { *urgentmsgs = 0; - if (ast_inboxcount_func) - return ast_inboxcount_func(mailbox, urgentmsgs, newmsgs, oldmsgs); + } + if (ast_inboxcount_func) { + return ast_inboxcount2_func(mailbox, urgentmsgs, newmsgs, oldmsgs); + } if (!warned) { warned++; |