[asterisk-commits] app voicemail: IMAP logout on MWI unsubscribe (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 15 09:05:58 CDT 2017
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5837 )
Change subject: app_voicemail: IMAP logout on MWI unsubscribe
......................................................................
app_voicemail: IMAP logout on MWI unsubscribe
Closing IMAP connection on MWI unsubscribe.
ASTERISK-24052 #close
Change-Id: I4ff964026002b2817b48c20fb4239f0a880228fd
---
M apps/app_voicemail.c
1 file changed, 37 insertions(+), 0 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 06f4830..ba93783 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -13106,6 +13106,40 @@
ast_free(mwi_sub);
}
+#ifdef IMAP_STORAGE
+static void imap_logout(const char *mailbox_id)
+{
+ char *context;
+ char *mailbox;
+ struct ast_vm_user vmus;
+ RAII_VAR(struct ast_vm_user *, vmu, NULL, free_user);
+ struct vm_state *vms = NULL;
+
+ if (ast_strlen_zero(mailbox_id)
+ || separate_mailbox(ast_strdupa(mailbox_id), &mailbox, &context)) {
+ return;
+ }
+
+ memset(&vmus, 0, sizeof(vmus));
+
+ if (!(vmu = find_user(&vmus, context, mailbox)) || vmu->imapuser[0] == '\0') {
+ return;
+ }
+
+ vms = get_vm_state_by_imapuser(vmu->imapuser, 0);
+ if (!vms) {
+ vms = get_vm_state_by_mailbox(mailbox, context, 0);
+ }
+ if (!vms) {
+ return;
+ }
+
+ vms->mailstream = mail_close(vms->mailstream);
+ vmstate_delete(vms);
+}
+
+#endif
+
static int handle_unsubscribe(void *datap)
{
struct mwi_sub *mwi_sub;
@@ -13117,6 +13151,9 @@
AST_LIST_REMOVE_CURRENT(entry);
/* Don't break here since a duplicate uniqueid
* may have been added as a result of a cache dump. */
+#ifdef IMAP_STORAGE
+ imap_logout(mwi_sub->mailbox);
+#endif
mwi_sub_destroy(mwi_sub);
}
}
--
To view, visit https://gerrit.asterisk.org/5837
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4ff964026002b2817b48c20fb4239f0a880228fd
Gerrit-Change-Number: 5837
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170615/12619042/attachment-0001.html>
More information about the asterisk-commits
mailing list