mdnCheck() public method

Check if we need to send a MDN, and send if needed.
public mdnCheck ( Horde_Mime_Headers $headers, boolean $confirmed = false ) : boolean
$headers Horde_Mime_Headers The headers of the message.
$confirmed boolean Has the MDN request been confirmed?
return boolean True if the MDN request needs to be confirmed.
Beispiel #1
0
 /**
  * Create the object used to display the message.
  *
  * @return array  Array with the following keys:
  *   - atc: (object) Attachment information.
  *     - download: (string) The URL for the download all action.
  *     - label: (string) The attachment label.
  *     - list: (array) Attachment information.
  *   - md: (array) Metadata.
  *   - msgtext: (string) The text of the message.
  *   - onepart: (boolean) True if message only contains one part.
  *
  * @throws IMP_Exception
  */
 public function showMessage()
 {
     global $prefs, $registry, $session;
     $result = array();
     // Create message text and attachment list.
     $result['msgtext'] = '';
     $show_parts = $prefs->getValue('parts_display');
     /* Do MDN processing now. */
     switch ($registry->getView()) {
         case $registry::VIEW_DYNAMIC:
             if ($this->_indices->mdnCheck($this->_loadHeaders())) {
                 $status = new IMP_Mime_Status(null, array(_("The sender of this message is requesting notification from you when you have read this message."), Horde::link('#', '', '', '', '', '', '', array('id' => 'send_mdn_link')) . _("Click to send the notification message.") . '</a>'));
                 $status->domid('sendMdnMessage');
                 $result['msgtext'] .= strval($status);
             }
     }
     /* Build body text. This needs to be done before we build the
      * attachment list. */
     $session->close();
     $inlineout = $this->getInlineOutput();
     $session->start();
     $result['md'] = $inlineout['metadata'];
     $result['msgtext'] .= $inlineout['msgtext'];
     if ($inlineout['one_part']) {
         $result['onepart'] = true;
     }
     if (count($inlineout['atc_parts']) || $show_parts == 'all' && count($inlineout['display_ids']) > 2) {
         $result['atc']['label'] = $show_parts == 'all' ? _("Parts") : sprintf(ngettext("%d Attachment", "%d Attachments", count($inlineout['atc_parts'])), count($inlineout['atc_parts']));
         if (count($inlineout['atc_parts']) > 1) {
             $result['atc']['download'] = strval($this->contents->urlView($this->contents->getMIMEMessage(), 'download_all')->setRaw(true));
         }
     }
     /* Show attachment information in headers? */
     if (!empty($inlineout['atc_parts'])) {
         $partlist = array();
         $contents_mask = IMP_Contents::SUMMARY_DESCRIP | IMP_Contents::SUMMARY_DESCRIP_LINK | IMP_Contents::SUMMARY_DOWNLOAD | IMP_Contents::SUMMARY_ICON | IMP_Contents::SUMMARY_SIZE;
         $part_info = array('icon', 'description', 'size', 'download', 'description_raw', 'download_url');
         if ($show_parts == 'all') {
             array_unshift($part_info, 'id');
         }
         foreach ($inlineout['atc_parts'] as $id) {
             $summary = $this->contents->getSummary($id, $contents_mask);
             $tmp = array();
             foreach ($part_info as $val) {
                 if (isset($summary[$val])) {
                     $tmp[$val] = $summary[$val] instanceof Horde_Url ? strval($summary[$val]->setRaw(true)) : $summary[$val];
                 }
             }
             $partlist[] = array_filter($tmp);
         }
         $result['atc']['list'] = $partlist;
     }
     return $result;
 }
Beispiel #2
0
 /**
  * Check if we need to send a MDN, and send if needed/able. Will only send
  * MDN if the request does NOT need to be confirmed by the user.
  *
  * @param Horde_Mime_Headers $headers  The headers of the message.
  *
  * @return boolean  True if the MDN request was able to be sent.
  */
 public function mdnSend(Horde_Mime_Headers $headers, $mailbox, $uid)
 {
     $indices = new IMP_Indices($mailbox, $uid);
     return !$indices->mdnCheck($headers);
 }