Ticket #1485171 (new Patches)

Opened 2 months ago

Last modified 8 weeks ago

Patch to make using imap subscriptions optional

Reported by: ziba Owned by:
Priority: 5 Milestone: later
Component: IMAP connection Version: svn-trunk
Severity: normal Keywords: imap subscriptions subscribe
Cc:

Description

The majority of the users of our (non-roundcube) webmail system do not use IMAP subscriptions. Many of our shared folders cannot be subscribed to properly and are therefore not accessible under roundcube. Ignoring subscriptions is a must have feature for us.

This small patch enables roundcube to use or ignore imap folder subscription information based on a new config option: use_subscriptions. It also includes an end-user control for the new preference. Please let me know if I can make any changes to help get this patch accepted.

config/main.inc.php.dist | 3 +++ program/include/rcube_imap.php | 7 ++++++- program/localization/en_US/labels.inc | 1 + program/steps/settings/func.inc | 11 +++++++++++ program/steps/settings/manage_folders.inc | 22 +++++++++++++--------- program/steps/settings/save_prefs.inc | 1 + 6 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index ff2109a..7ef3293 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -139,6 +139,9 @@ $rcmail_configproduct_name? = 'RoundCube Webmail';

// only list folders within this path $rcmail_configimap_root? = ;

+// only list subscribed folders +$rcmail_configuse_subscriptions? = TRUE; +

// store draft message is this mailbox // leave blank if draft messages should not be stored $rcmail_configdrafts_mbox? = 'Drafts';

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 858a1e2..b17e93e 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -413,7 +413,12 @@ class rcube_imap

return $a_mboxes;

// retrieve list of folders from IMAP server

- $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter); + if (rcmail::get_instance()->config->get('use_subscriptions', TRUE)){ + $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter); + } + else{ + $a_folders = iil_C_ListMailboxes($this->conn, $this->_mod_mailbox($root), $filter); + }

if (!is_array($a_folders) !sizeof($a_folders))

$a_folders = array();

diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index cf7c54c..1bfd704 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -269,6 +269,7 @@ $labelseverynminutes? = 'every $n minutes';

$labelsnever? = 'never'; $labelsmessagesdisplaying? = 'Messages displaying'; $labelsmessagescomposition? = 'Messages composition';

+$labelsusesubscriptions? = 'Use IMAP subscriptions';

$labelsfolder? = 'Folder'; $labelsfolders? = 'Folders';

diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 4921906..e5d0f0b 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -302,6 +302,17 @@ function rcmail_user_prefs_form($attrib)

$input_expunge->show($configlogout_expunge??1:0));

}

+ // Using IMAP subscription information + if (!isset($no_overrideuse_subscriptions?)) + { + $field_id = 'rcmfd_use_subscriptions'; + $use_subscriptions = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1)); + $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", + $field_id, + Q(rcube_label('usesubscriptions')), + $use_subscriptions->show($configuse_subscriptions??1:0)); + } +

$out .= "\n</table></fieldset>$form_end";

return $out;

diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc index b725d8c..f8da5b7 100644 --- a/program/steps/settings/manage_folders.inc +++ b/program/steps/settings/manage_folders.inc @@ -182,10 +182,12 @@ function rcube_subscription_form($attrib)

// add table header $out .= "<thead><tr>\n";

- $out .= sprintf('<td class="name">%s</td><td class="msgcount">%s</td><td class="subscribed">%s</td>'. - '<td class="rename">&nbsp;</td><td class="delete">&nbsp;</td>', - rcube_label('foldername'), rcube_label('messagecount'), rcube_label('subscribed')); - + $out .= sprintf('<td class="name">%s</td><td class="msgcount">%s</td>', + rcube_label('foldername'), rcube_label('messagecount')); + if ($CONFIGuse_subscriptions?){ + $out .= sprintf('<td class="subscribed">%s</td>', rcube_label('subscribed')); + } + $out .= '<td class="rename">&nbsp;</td><td class="delete">&nbsp;</td>';

$out .= "\n</tr></thead>\n<tbody>\n";

@@ -229,11 +231,13 @@ function rcube_subscription_form($attrib)

$zebra_class, Q($folder_html), $IMAP->messagecount($folder));

- - if ($protected) - $out .= '<td class="subscribed">&nbsp;'.($subscribed ? '&#x2022;' : '-').'</td>'; - else - $out .= '<td class="subscribed">'.$checkbox_subscribe->show($subscribed?$folder_utf8:, array('value' => $folder_utf8)).'</td>'; + + if ($CONFIGuse_subscriptions?){ + if ($protected) + $out .= '<td class="subscribed">&nbsp;'.($subscribed ? '&#x2022;' : '-').'</td>'; + else + $out .= '<td class="subscribed">'.$checkbox_subscribe->show($subscribed?$folder_utf8:, array('value' => $folder_utf8)).'</td>'; + }

// add rename and delete buttons if (!$protected)

diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 750b33b..1e6bdc8 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -36,6 +36,7 @@ $a_user_prefs = array(

'draft_autosave' => isset($_POST_draft_autosave?) ? intval($_POST_draft_autosave?) : 0, 'mdn_requests' => isset($_POST_mdn_requests?) ? intval($_POST_mdn_requests?) : 0, 'skin' => isset($_POST_skin?) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIGskin?,

+ 'use_subscriptions' => isset($_POST_use_subscriptions?) ? TRUE : FALSE,

);

// don't override these parameters

-- 1.5.6

Attachments

imap_subscriptions_preference.patch (6.3 kB) - added by ziba 2 months ago.
Patch for a "use imap subscriptions" preference (updated with folder cache flush)

Change History

Changed 2 months ago by ziba

Patch for a "use imap subscriptions" preference (updated with folder cache flush)

Changed 8 weeks ago by markscarbrough

Hopefully this patch will be included in future releases. This feature is also non-optional in our environment.

Note: See TracTickets for help on using tickets.