<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5837">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: IMAP logout on MWI unsubscribe<br><br>Closing IMAP connection on MWI unsubscribe.<br><br>ASTERISK-24052 #close<br><br>Change-Id: I4ff964026002b2817b48c20fb4239f0a880228fd<br>---<br>M apps/app_voicemail.c<br>1 file changed, 37 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index 06f4830..ba93783 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -13106,6 +13106,40 @@<br> ast_free(mwi_sub);<br> }<br> <br>+#ifdef IMAP_STORAGE<br>+static void imap_logout(const char *mailbox_id)<br>+{<br>+ char *context;<br>+ char *mailbox;<br>+ struct ast_vm_user vmus;<br>+ RAII_VAR(struct ast_vm_user *, vmu, NULL, free_user);<br>+ struct vm_state *vms = NULL;<br>+<br>+ if (ast_strlen_zero(mailbox_id)<br>+ || separate_mailbox(ast_strdupa(mailbox_id), &mailbox, &context)) {<br>+ return;<br>+ }<br>+<br>+ memset(&vmus, 0, sizeof(vmus));<br>+<br>+ if (!(vmu = find_user(&vmus, context, mailbox)) || vmu->imapuser[0] == '\0') {<br>+ return;<br>+ }<br>+<br>+ vms = get_vm_state_by_imapuser(vmu->imapuser, 0);<br>+ if (!vms) {<br>+ vms = get_vm_state_by_mailbox(mailbox, context, 0);<br>+ }<br>+ if (!vms) {<br>+ return;<br>+ }<br>+<br>+ vms->mailstream = mail_close(vms->mailstream);<br>+ vmstate_delete(vms);<br>+}<br>+<br>+#endif<br>+<br> static int handle_unsubscribe(void *datap)<br> {<br> struct mwi_sub *mwi_sub;<br>@@ -13117,6 +13151,9 @@<br> AST_LIST_REMOVE_CURRENT(entry);<br> /* Don't break here since a duplicate uniqueid<br> * may have been added as a result of a cache dump. */<br>+#ifdef IMAP_STORAGE<br>+ imap_logout(mwi_sub->mailbox);<br>+#endif<br> mwi_sub_destroy(mwi_sub);<br> }<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5837">change 5837</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5837"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I4ff964026002b2817b48c20fb4239f0a880228fd </div>
<div style="display:none"> Gerrit-Change-Number: 5837 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>