Fix unexpected error message when mail refresh involves folder auto-unsubscribe (#6923)

bnet/additions
Aleksander Machniak 5 years ago
parent b470f5a9f3
commit adc08946ef

@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail
- Elastic: Fix bug where it was possible to switch editor mode when 'htmleditor' was in 'dont_override' (#7143) - Elastic: Fix bug where it was possible to switch editor mode when 'htmleditor' was in 'dont_override' (#7143)
- Fix regression where "Open in new window" action didn't work (#7155) - Fix regression where "Open in new window" action didn't work (#7155)
- Fix PHP Warning: array_filter() expects parameter 1 to be array, null given in subscriptions_option plugin (#7165) - Fix PHP Warning: array_filter() expects parameter 1 to be array, null given in subscriptions_option plugin (#7165)
- Fix unexpected error message when mail refresh involves folder auto-unsubscribe (#6923)
RELEASE 1.4.2 RELEASE 1.4.2
------------- -------------

@ -2946,6 +2946,9 @@ class rcube_imap extends rcube_storage
// Add/Remove folders according to some configuration options // Add/Remove folders according to some configuration options
$this->list_folders_filter($result, $root . $name, ($list_extended ? 'ext-' : '') . 'subscribed'); $this->list_folders_filter($result, $root . $name, ($list_extended ? 'ext-' : '') . 'subscribed');
// Save the last command state, so we can ignore errors on any following UNSEBSCRIBE calls
$state = $this->save_conn_state();
if ($list_extended) { if ($list_extended) {
// unsubscribe non-existent folders, remove from the list // unsubscribe non-existent folders, remove from the list
if ($name == '*' && !empty($this->conn->data['LIST'])) { if ($name == '*' && !empty($this->conn->data['LIST'])) {
@ -2977,6 +2980,8 @@ class rcube_imap extends rcube_storage
} }
} }
$this->restore_conn_state($state);
return $result; return $result;
} }
@ -4545,6 +4550,31 @@ class rcube_imap extends rcube_storage
return $date->format('d-M-Y H:i:s O'); return $date->format('d-M-Y H:i:s O');
} }
/**
* Remember state of the IMAP connection (last IMAP command).
* Use e.g. if you want to execute more commands and ignore results of these.
*
* @return array Connection state
*/
protected function save_conn_state()
{
return array(
$this->conn->error,
$this->conn->errornum,
$this->conn->resultcode,
);
}
/**
* Restore saved connection state.
*
* @param array $state Connection result
*/
protected function restore_conn_state($state)
{
list($this->conn->error, $this->conn->errornum, $this->conn->resultcode) = $state;
}
/** /**
* This is our own debug handler for the IMAP connection * This is our own debug handler for the IMAP connection
*/ */

Loading…
Cancel
Save