- $oMbx =& $aMbxs[$i];
- if (strtoupper($oMbx->mailboxname_full) == 'INBOX' ||
- ($move_to_trash && $oMbx->mailboxname_full == $trash_folder)) {
- if ($unseen_type == 2 ||
- ($oMbx->mailboxname_full == $trash_folder && $move_to_trash)) {
- $aStatus = sqimap_status_messages($imap_stream,$oMbx->mailboxname_full);
- $oMbx->unseen = $aStatus['UNSEEN'];
- $oMbx->total = $aStatus['MESSAGES'];
- } else {
- $oMbx->unseen = sqimap_unseen_messages($imap_stream,$oMbx->mailboxname_full);
- }
- $aMbxs[$i] =& $oMbx;
- if (!$move_to_trash && $trash_folder) {
- break;
- } else {
- // trash comes after INBOX
- if ($oMbx->mailboxname_full == $trash_folder) {
- break;
- }
- }
- }
- }
- }
-}
+ $oMbx =& $aMbxs[$i];
+ if (strtoupper($oMbx->mailboxname_full) == 'INBOX' ||
+ ($move_to_trash && $oMbx->mailboxname_full == $trash_folder)) {
+ if ($unseen_type == 2 ||
+ ($oMbx->mailboxname_full == $trash_folder && $move_to_trash)) {
+ $aStatus = sqimap_status_messages($imap_stream,$oMbx->mailboxname_full);
+ $oMbx->unseen = $aStatus['UNSEEN'];
+ $oMbx->total = $aStatus['MESSAGES'];
+ } else {
+ $oMbx->unseen = sqimap_unseen_messages($imap_stream,$oMbx->mailboxname_full);
+ }
+ $aMbxs[$i] =& $oMbx;
+ if (!$move_to_trash && $trash_folder) {
+ break;
+ } else {
+ // trash comes after INBOX
+ if ($oMbx->mailboxname_full == $trash_folder) {
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Checks if folder is noselect (can't store messages)
+ *
+ * Function does not check if folder subscribed.
+ * @param stream $oImapStream imap connection resource
+ * @param string $sImapFolder imap folder name
+ * @param object $oBoxes mailboxes class object.
+ * @return boolean true, when folder has noselect flag. false in any other case.
+ * @since 1.5.1
+ */
+function sqimap_mailbox_is_noselect($oImapStream,$sImapFolder,&$oBoxes) {
+ // build mailbox object if it is not available
+ if (! is_object($oBoxes)) $oBoxes=sqimap_mailbox_list($oImapStream);
+ foreach($oBoxes as $box) {
+ if ($box['unformatted']==$sImapFolder) {
+ return (bool) check_is_noselect($box['raw']);
+ }
+ }
+ return false;
+}
+
+/**
+ * Checks if folder is noinferiors (can't store other folders)
+ *
+ * Function does not check if folder subscribed.
+ * @param stream $oImapStream imap connection resource
+ * @param string $sImapFolder imap folder name
+ * @param object $oBoxes mailboxes class object.
+ * @return boolean true, when folder has noinferiors flag. false in any other case.
+ * @since 1.5.1
+ */
+function sqimap_mailbox_is_noinferiors($oImapStream,$sImapFolder,&$oBoxes) {
+ // build mailbox object if it is not available
+ if (! is_object($oBoxes)) $oBoxes=sqimap_mailbox_list($oImapStream);
+ foreach($oBoxes as $box) {
+ if ($box['unformatted']==$sImapFolder) {
+ return (bool) check_is_noinferiors($box['raw']);
+ }
+ }
+ return false;
+}