- Fix so TEXT key will remove all HEADER keys in IMAP SEARCH (#1488208)

pull/1/head
alecpl 13 years ago
parent 6a6168619a
commit 3e5c709fa7

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Fix so TEXT key will remove all HEADER keys in IMAP SEARCH (#1488208)
- Fix handling contact photo url with https:// prefix (#1488202)
- Prevent from memory_limit exceeding when trying to parse big messages bodies (#1487424)
- Add possibility to add SASL mechanisms for SMTP in smtp_connect hook (#1487937)

@ -31,6 +31,7 @@ $str = get_input_value('_q', RCUBE_INPUT_GET, true);
$mbox = get_input_value('_mbox', RCUBE_INPUT_GET, true);
$filter = get_input_value('_filter', RCUBE_INPUT_GET);
$headers = get_input_value('_headers', RCUBE_INPUT_GET);
$subject = array();
$search_request = md5($mbox.$filter.$str);
@ -70,14 +71,19 @@ else if (preg_match("/^body:.*/i", $str))
list(,$srch) = explode(":", $str);
$subject['text'] = "TEXT";
}
else if(trim($str))
else if (strlen(trim($str)))
{
if ($headers) {
foreach(explode(',', $headers) as $header)
switch ($header) {
case 'text': $subject['text'] = 'TEXT'; break;
default: $subject[$header] = 'HEADER '.strtoupper($header);
foreach (explode(',', $headers) as $header) {
if ($header == 'text') {
// #1488208: get rid of other headers when searching by "TEXT"
$subject = array('text' => 'TEXT');
break;
}
else {
$subject[$header] = 'HEADER '.strtoupper($header);
}
}
// save search modifiers for the current folder to user prefs
$search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
@ -89,9 +95,9 @@ else if(trim($str))
}
}
$search = $srch ? trim($srch) : trim($str);
$search = isset($srch) ? trim($srch) : trim($str);
if ($subject) {
if (!empty($subject)) {
$search_str .= str_repeat(' OR', count($subject)-1);
foreach ($subject as $sub)
$search_str .= sprintf(" %s {%d}\r\n%s", $sub, strlen($search), $search);

@ -192,29 +192,32 @@ searchmenu: function(show)
if (show && ref) {
var pos = $(ref).offset();
obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)})
.find(':checked').prop('checked', false);
obj.css({left:pos.left, top:(pos.top + ref.offsetHeight + 2)});
if (rcmail.env.search_mods) {
var n, mbox = rcmail.env.mailbox, mods = rcmail.env.search_mods;
var n, all,
list = $('input:checkbox[name="s_mods[]"]', obj),
mbox = rcmail.env.mailbox,
mods = rcmail.env.search_mods;
if (rcmail.env.task != 'addressbook') {
if (rcmail.env.task == 'mail') {
mods = mods[mbox] ? mods[mbox] : mods['*'];
all = 'text';
}
else {
all = '*';
}
if (mods[all])
list.map(function() {
this.checked = true;
this.disabled = this.value != all;
});
else {
list.prop('disabled', false).prop('checked', false);
for (n in mods)
$('#s_mod_' + n).prop('checked', true);
}
else {
if (mods['*'])
$('input:checkbox[name="s_mods[]"]').map(function() {
this.checked = true;
this.disabled = this.value != '*';
});
else {
for (n in mods)
$('#s_mod_' + n).prop('checked', true);
}
}
}
}
obj[show?'show':'hide']();
@ -222,7 +225,7 @@ searchmenu: function(show)
set_searchmod: function(elem)
{
var task = rcmail.env.task,
var all, m, task = rcmail.env.task,
mods = rcmail.env.search_mods,
mbox = rcmail.env.mailbox;
@ -232,36 +235,37 @@ set_searchmod: function(elem)
if (task == 'mail') {
if (!mods[mbox])
mods[mbox] = rcube_clone_object(mods['*']);
if (!elem.checked)
delete(mods[mbox][elem.value]);
else
mods[mbox][elem.value] = 1;
m = mods[mbox];
all = 'text';
}
else { //addressbook
if (!elem.checked)
delete(mods[elem.value]);
else
mods[elem.value] = 1;
m = mods;
all = '*';
}
if (!elem.checked)
delete(m[elem.value]);
else
m[elem.value] = 1;
// mark all fields
if (elem.value == '*') {
$('input:checkbox[name="s_mods[]"]').map(function() {
if (this == elem)
return;
// mark all fields
if (elem.value != all)
return;
if (elem.checked) {
mods[this.value] = 1;
this.checked = true;
this.disabled = true;
}
else {
this.disabled = false;
}
});
}
}
$('input:checkbox[name="s_mods[]"]').map(function() {
if (this == elem)
return;
rcmail.env.search_mods = mods;
this.checked = true;
if (elem.checked) {
this.disabled = true;
delete m[this.value];
}
else {
this.disabled = false;
m[this.value] = 1;
}
});
},
listmenu: function(show)

Loading…
Cancel
Save