Check PERMANENTFLAGS before saving MDNSent flag (#1484963, #1485163)

release-0.6
thomascube 16 years ago
parent e3e597e3b6
commit 5b3dd412d2

@ -4,6 +4,7 @@ CHANGELOG RoundCube Webmail
2008/07/14 (thomasb) 2008/07/14 (thomasb)
---------- ----------
- Re-enable autocomplete attribute for login form (#1485211) - Re-enable autocomplete attribute for login form (#1485211)
- Check PERMANENTFLAGS before saving $MDNSent flag (#1484963, #1485163)
2008/06/30 (alec) 2008/06/30 (alec)
---------- ----------

@ -248,7 +248,7 @@ class html_inputfield extends html
{ {
protected $tagname = 'input'; protected $tagname = 'input';
protected $type = 'text'; protected $type = 'text';
protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked'); protected $allowed = array('type','name','value','size','tabindex','autocomplete','checked','onchange');
public function __construct($attrib = array()) public function __construct($attrib = array())
{ {
@ -416,7 +416,7 @@ class html_checkbox extends html_inputfield
class html_textarea extends html class html_textarea extends html
{ {
protected $tagname = 'textarea'; protected $tagname = 'textarea';
protected $allowed = array('name','rows','cols','wrap','tabindex'); protected $allowed = array('name','rows','cols','wrap','tabindex','onchange');
/** /**
* Get HTML code for this object * Get HTML code for this object
@ -473,6 +473,7 @@ class html_select extends html
{ {
protected $tagname = 'select'; protected $tagname = 'select';
protected $options = array(); protected $options = array();
protected $allowed = array('name','size','tabindex','autocomplete','multiple','onchange');
/** /**
* Add a new option to this drop-down * Add a new option to this drop-down
@ -513,7 +514,7 @@ class html_select extends html
$attr = array( $attr = array(
'value' => $option['value'], 'value' => $option['value'],
'selected' => (in_array($option['value'], $select, true) || 'selected' => (in_array($option['value'], $select, true) ||
in_array($option['text'], $select, true)) ? 1 : null); in_array($option['text'], $select, true)) ? 1 : null);
$this->content .= self::tag('option', $attr, Q($option['text'])); $this->content .= self::tag('option', $attr, Q($option['text']));
} }

@ -345,6 +345,21 @@ class rcube_imap
} }
/**
* Checks the PERMANENTFLAGS capability of the current mailbox
* and returns true if the given flag is supported by the IMAP server
*
* @param string Permanentflag name
* @return mixed True if this flag is supported
* @access public
*/
function check_permflag($flag)
{
$flagsmap = $GLOBALS['IMAP_FLAGS'];
return (($imap_flag = $flagsmap[strtoupper($flag)]) && in_array_nocase($imap_flag, $this->conn->permanentflags));
}
/** /**
* Returns the delimiter that is used by the IMAP server for folder separation * Returns the delimiter that is used by the IMAP server for folder separation
* *

@ -90,6 +90,16 @@ $GLOBALS['IMAP_MONTHS'] = array("Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4,
$GLOBALS['IMAP_SERVER_TZ'] = date('Z'); $GLOBALS['IMAP_SERVER_TZ'] = date('Z');
$GLOBALS['IMAP_FLAGS'] = array(
'SEEN' => '\\Seen',
'DELETED' => '\\Deleted',
'RECENT' => '\\Recent',
'ANSWERED' => '\\Answered',
'DRAFT' => '\\Draft',
'FLAGGED' => '\\Flagged',
'FORWARDED' => '$Forwarded',
'MDNSENT' => '$MDNSent');
$iil_error; $iil_error;
$iil_errornum; $iil_errornum;
$iil_selected; $iil_selected;
@ -113,6 +123,7 @@ class iilConnection
var $rootdir; var $rootdir;
var $delimiter; var $delimiter;
var $capability = array(); var $capability = array();
var $permanentflags = array();
} }
/** /**
@ -142,7 +153,7 @@ class iilBasicHeader
var $priority; var $priority;
var $mdn_to; var $mdn_to;
var $mdn_sent = false; var $mdn_sent = false;
var $is_reply = false; var $is_draft = false;
var $seen = false; var $seen = false;
var $deleted = false; var $deleted = false;
var $recent = false; var $recent = false;
@ -716,7 +727,7 @@ function iil_C_Select(&$conn, $mailbox) {
return false; return false;
} }
if (strcmp($conn->selected, $mailbox) == 0) { if (strcmp($conn->selected, $mailbox) == 0) {
return true; return true;
} }
iil_C_LoadCache($conn, $mailbox); iil_C_LoadCache($conn, $mailbox);
@ -729,9 +740,12 @@ function iil_C_Select(&$conn, $mailbox) {
if (strcasecmp($a[2], 'EXISTS') == 0) { if (strcasecmp($a[2], 'EXISTS') == 0) {
$conn->exists = (int) $a[1]; $conn->exists = (int) $a[1];
} }
if (strcasecmp($a[2], 'RECENT') == 0) { if (strcasecmp($a[2], 'RECENT') == 0) {
$conn->recent = (int) $a[1]; $conn->recent = (int) $a[1];
} }
}
else if (preg_match('/\[?PERMANENTFLAGS\s+\(([^\)]+)\)\]/U', $line, $match)) {
$conn->permanentflags = explode(' ', $match[1]);
} }
} while (!iil_StartsWith($line, 'sel1')); } while (!iil_StartsWith($line, 'sel1'));
@ -1757,6 +1771,8 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false)
$result[$id]->answered = true; $result[$id]->answered = true;
} else if (strcasecmp($val, '$Forwarded') == 0) { } else if (strcasecmp($val, '$Forwarded') == 0) {
$result[$id]->forwarded = true; $result[$id]->forwarded = true;
} else if (strcasecmp($val, 'Draft') == 0) {
$result[$id]->is_draft = true;
} else if (strcasecmp($val, '$MDNSent') == 0) { } else if (strcasecmp($val, '$MDNSent') == 0) {
$result[$id]->mdn_sent = true; $result[$id]->mdn_sent = true;
} else if (strcasecmp($val, 'Flagged') == 0) { } else if (strcasecmp($val, 'Flagged') == 0) {
@ -1909,15 +1925,7 @@ function iil_C_ModFlag(&$conn, $mailbox, $messages, $flag, $mod) {
} }
$fp = $conn->fp; $fp = $conn->fp;
$flags = array( $flags = $GLOBALS['IMAP_FLAGS'];
'SEEN' => '\\Seen',
'DELETED' => '\\Deleted',
'RECENT' => '\\Recent',
'ANSWERED' => '\\Answered',
'DRAFT' => '\\Draft',
'FLAGGED' => '\\Flagged',
'FORWARDED' => '$Forwarded',
'MDNSENT' => '$MDNSent');
$flag = strtoupper($flag); $flag = strtoupper($flag);
$flag = $flags[$flag]; $flag = $flags[$flag];

@ -1069,7 +1069,7 @@ function rcmail_send_mdn($uid)
$message = new rcube_message($uid); $message = new rcube_message($uid);
if ($message->headers->mdn_to && !$message->headers->mdn_sent) if ($message->headers->mdn_to && !$message->headers->mdn_sent && $IMAP->check_permflag('MDNSENT'))
{ {
$identity = $RCMAIL->user->get_identity(); $identity = $RCMAIL->user->get_identity();
$sender = format_email_recipient($identity['email'], $identity['name']); $sender = format_email_recipient($identity['email'], $identity['name']);

@ -82,8 +82,11 @@ if ($_GET['_uid']) {
$OUTPUT->set_env('sender', $MESSAGE->sender['string']); $OUTPUT->set_env('sender', $MESSAGE->sender['string']);
// check for unset disposition notification // check for unset disposition notification
if ($MESSAGE->headers->mdn_to && !$MESSAGE->headers->mdn_sent && if ($MESSAGE->headers->mdn_to &&
$mbox_name != $CONFIG['drafts_mbox'] && $mbox_name != $CONFIG['sent_mbox']) !$MESSAGE->headers->mdn_sent &&
$IMAP->check_permflag('MDNSENT') &&
$mbox_name != $CONFIG['drafts_mbox'] &&
$mbox_name != $CONFIG['sent_mbox'])
{ {
if (intval($CONFIG['mdn_requests']) === 1) if (intval($CONFIG['mdn_requests']) === 1)
{ {

Loading…
Cancel
Save