mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-10 11:58:08 +00:00
Fix polling for mailbox changes in mailboxes that are not in the default vm context.
(closes issue #12223) Reported by: DEA Patches: vm-polled-imap.txt uploaded by DEA (license 3) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@108927 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -8017,6 +8017,7 @@ static void mwi_unsub_event_cb(const struct ast_event *event, void *userdata)
|
|||||||
static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
|
static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
|
||||||
{
|
{
|
||||||
const char *mailbox;
|
const char *mailbox;
|
||||||
|
const char *context;
|
||||||
uint32_t uniqueid;
|
uint32_t uniqueid;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
struct mwi_sub *mwi_sub;
|
struct mwi_sub *mwi_sub;
|
||||||
@@ -8028,12 +8029,16 @@ static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mailbox = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
|
mailbox = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
|
||||||
|
context = ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT);
|
||||||
uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
|
uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
|
||||||
|
|
||||||
len = sizeof(*mwi_sub);
|
len = sizeof(*mwi_sub);
|
||||||
if (!ast_strlen_zero(mailbox))
|
if (!ast_strlen_zero(mailbox))
|
||||||
len += strlen(mailbox);
|
len += strlen(mailbox);
|
||||||
|
|
||||||
|
if (!ast_strlen_zero(context))
|
||||||
|
len += strlen(context) + 1; /* Allow for seperator */
|
||||||
|
|
||||||
if (!(mwi_sub = ast_calloc(1, len)))
|
if (!(mwi_sub = ast_calloc(1, len)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -8041,6 +8046,11 @@ static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
|
|||||||
if (!ast_strlen_zero(mailbox))
|
if (!ast_strlen_zero(mailbox))
|
||||||
strcpy(mwi_sub->mailbox, mailbox);
|
strcpy(mwi_sub->mailbox, mailbox);
|
||||||
|
|
||||||
|
if (!ast_strlen_zero(context)) {
|
||||||
|
strcat(mwi_sub->mailbox, "@");
|
||||||
|
strcat(mwi_sub->mailbox, context);
|
||||||
|
}
|
||||||
|
|
||||||
AST_RWLIST_WRLOCK(&mwi_subs);
|
AST_RWLIST_WRLOCK(&mwi_subs);
|
||||||
AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
|
AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
|
||||||
AST_RWLIST_UNLOCK(&mwi_subs);
|
AST_RWLIST_UNLOCK(&mwi_subs);
|
||||||
|
|||||||
Reference in New Issue
Block a user