Simplify change_subscription() code, removed unused vars

pull/300/head
Aleksander Machniak 9 years ago
parent 6a94f69bd1
commit aada285660

@ -4274,22 +4274,16 @@ class rcube_imap extends rcube_storage
*/ */
protected function change_subscription($folders, $mode) protected function change_subscription($folders, $mode)
{ {
$updated = false; $updated = 0;
$folders = (array) $folders;
if (!empty($folders)) { if (!empty($folders)) {
if (!$this->check_connection()) { if (!$this->check_connection()) {
return false; return false;
} }
foreach ((array)$folders as $i => $folder) { foreach ($folders as $folder) {
$folders[$i] = $folder; $updated += (int) $this->conn->{$mode}($folder);
if ($mode == 'subscribe') {
$updated = $this->conn->subscribe($folder);
}
else if ($mode == 'unsubscribe') {
$updated = $this->conn->unsubscribe($folder);
}
} }
} }
@ -4298,7 +4292,7 @@ class rcube_imap extends rcube_storage
$this->clear_cache('mailboxes', true); $this->clear_cache('mailboxes', true);
} }
return $updated; return $updated == count($folders) ? true : false;
} }
/** /**

Loading…
Cancel
Save