diff options
author | thomascube <thomas@roundcube.net> | 2007-11-29 14:17:32 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2007-11-29 14:17:32 +0000 |
commit | ed54070eb5c942e9745efd7ad57a4ff02deeaf04 (patch) | |
tree | cbce9cca45170550476e5a30459d3cdcbb119a7d | |
parent | 11074801923807a9448f7427299ddba76e235e42 (diff) |
Track message disposition notification flag and headers
-rw-r--r-- | program/include/rcube_imap.inc | 4 | ||||
-rw-r--r-- | program/lib/imap.inc | 41 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 4 |
3 files changed, 28 insertions, 21 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 56859b300..2d947a4fd 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -939,7 +939,7 @@ class rcube_imap /** * Check if the given message ID is part of the current search set * - * @return True on match or if no search request is stored + * @return boolean True on match or if no search request is stored */ function in_searchset($msgid) { @@ -1290,7 +1290,7 @@ class rcube_imap * Set message flag to one or several messages * * @param mixed Message UIDs as array or as comma-separated string - * @param string Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT + * @param string Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT * @return boolean True on success, False on failure */ function set_flag($uids, $flag) diff --git a/program/lib/imap.inc b/program/lib/imap.inc index ed2111c57..fef0b8b5d 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -96,17 +96,21 @@ class iilBasicHeader{ var $messageID; var $size; var $encoding; + var $charset; var $ctype; var $flags; var $timestamp; var $f; - var $seen; - var $deleted; - var $recent; - var $answered; - var $junk; var $internaldate; - var $is_reply; + var $references; + var $mdn_to; + var $mdn_sent = false; + var $is_reply = false; + var $seen = false; + var $deleted = false; + var $recent = false; + var $answered = false; + var $junk = false; } @@ -1240,7 +1244,7 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ /* FETCH date,from,subject headers */ $key="fh".($c++); $prefix=$uidfetch?" UID":""; - $request=$key.$prefix." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCES)])\r\n"; + $request=$key.$prefix." FETCH $message_set (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC BCC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID REFERENCES DISPOSITION-NOTIFICATION-TO)])\r\n"; if (!fputs($fp, $request)) return false; do{ @@ -1307,6 +1311,7 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ $result[$id]->ctype = str_replace("\n", " ", $headers["content-type"]); $result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']); $result[$id]->references = $headers["references"]; + $result[$id]->mdn_to = $headers["disposition-notification-to"]; list($result[$id]->ctype, $ctype_add) = explode(";", $headers["content-type"]); @@ -1369,10 +1374,6 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ $flags_a = explode(" ", $flags_str); //echo "<!-- ID: $id FLAGS: ".implode(",", $flags_a)." //-->\n"; - $result[$id]->seen = false; - $result[$id]->recent = false; - $result[$id]->deleted = false; - $result[$id]->answered = false; if (is_array($flags_a)){ reset($flags_a); while (list($key,$val)=each($flags_a)){ @@ -1380,8 +1381,9 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ else if (strcasecmp($val, "Deleted")==0) $result[$id]->deleted=true; else if (strcasecmp($val, "Recent")==0) $result[$id]->recent = true; else if (strcasecmp($val, "Answered")==0) $result[$id]->answered = true; + else if (strcasecmp($val, "\$MDNSent")==0) $result[$id]->mdn_sent = true; } - $result[$id]->flags=$flags_str; + $result[$id]->flags = $flags_a; } // if time is gmt... @@ -1510,13 +1512,14 @@ function iil_C_ModFlag(&$conn, $mailbox, $messages, $flag, $mod){ $fp = $conn->fp; $flags=array( - "SEEN"=>"\\Seen", - "DELETED"=>"\\Deleted", - "RECENT"=>"\\Recent", - "ANSWERED"=>"\\Answered", - "DRAFT"=>"\\Draft", - "FLAGGED"=>"\\Flagged" - ); + "SEEN"=>"\\Seen", + "DELETED"=>"\\Deleted", + "RECENT"=>"\\Recent", + "ANSWERED"=>"\\Answered", + "DRAFT"=>"\\Draft", + "FLAGGED"=>"\\Flagged", + "MDNSENT"=>"\$MDNSent" + ); $flag=strtoupper($flag); $flag=$flags[$flag]; if (iil_C_Select($conn, $mailbox)){ diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 4dcdec362..022edb0ed 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -72,6 +72,10 @@ if ($_GET['_uid']) // give message uid to the client $OUTPUT->set_env('uid', $MESSAGE['UID']); $OUTPUT->set_env('safemode', intval($_GET['_safe'])); + + // check for unset disposition notification + if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent) + $OUTPUT->set_env('mdn_request', true); $next = $prev = -1; // get previous, first, next and last message UID |