OsStatus RecycleDeletedMsgsCGI::handleOpenVXIRequest( UtlString* out ) { // Instantiate the mailbox manager MailboxManager* pMailboxManager = MailboxManager::getInstance(); OsStatus result = pMailboxManager->recycleDeletedMessages( m_mailboxIdentity, m_messageids ); UtlString dynamicVxml = getVXMLHeader(); if( result == OS_SUCCESS ) { dynamicVxml += VXML_SUCCESS_SNIPPET; } else { dynamicVxml += VXML_FAILURE_SNIPPET; } dynamicVxml += VXML_END; // Write out the dynamic VXML script to be processed by OpenVXI if (out) { out->remove(0); UtlString responseHeaders; MailboxManager::getResponseHeaders(dynamicVxml.length(), responseHeaders); out->append(responseHeaders.data()); out->append(dynamicVxml.data()); } return OS_SUCCESS; }
OsStatus RecycleDeletedMsgsCGI::handleWebRequest( UtlString* out ) { UtlString redirectUrl, dynamicHtml; MailboxManager* pMailboxManager = MailboxManager::getInstance(); OsStatus result = pMailboxManager->getMediaserverURLForWeb( redirectUrl ) ; if( result == OS_SUCCESS ) { // URL of the result webpage redirectUrl += UtlString( CGI_URL ) + "?action=playmsg&fromweb=yes&from=gateway" + "&nextblockhandle=" + UtlString( m_nextBlockHandle ) + "&category=deleted"; if( m_messageids.length() > 0 ) { // Instantiate the mailbox manager result = pMailboxManager->recycleDeletedMessages( m_mailboxIdentity, m_messageids ); // Add status to indicate the status of purge. if( result == OS_SUCCESS ) { redirectUrl += UtlString( "&status=" ) + RECYCLE_DELETED_MSG_SUCCESSFUL ; } else { redirectUrl += UtlString( "&status=" ) + RECYCLE_DELETED_MESSAGES_FAILED ; } } else { redirectUrl += UtlString( "&status=" ) + RECYCLE_DELETED_MSG_NOT_SELECTED ; } // Script for redirecting to the webpage displaying folder contents dynamicHtml = HTML_BEGIN \ REDIRECT_SCRIPT_BEGIN + redirectUrl + REDIRECT_SCRIPT_END \ HTML_END ; } else { dynamicHtml = HTML_BEGIN \ PROTOCOL_MISMATCH \ HTML_END ; } if (out) { out->remove(0); out->append(dynamicHtml.data()); } return OS_SUCCESS; }