Small Question in imap_mailbox.php function..

View: New views
5 Messages — Rating Filter:   Alert me  

Small Question in imap_mailbox.php function..

by Michael Peddemors :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Should it not be:

$ret = boolean_hook_function('special_mailbox',strtolower($box),1);

In the function below...


/**
 * Defines special mailboxes: given a mailbox name, it checks if this is a
 * "special" one: INBOX, Trash, Sent or Draft.
 */
function isSpecialMailbox( $box ) {
    global $trash_folder, $sent_folder, $draft_folder,
           $move_to_trash, $move_to_sent, $save_as_draft;

    $ret = ( (strtolower($box) == 'inbox') ||
             isTrashMailbox($box) || isSentMailbox($box) ||
isDraftMailbox($box) );

    if ( !$ret ) {
        $ret = boolean_hook_function('special_mailbox',$box,1);
    }
    return $ret;
}


--
--
"Catch the Magic of Linux..."
------------------------------------------------------------------------
Michael Peddemors - President/CEO - LinuxMagic
Products, Services, Support and Development
Visit us at http://www.linuxmagic.com
------------------------------------------------------------------------
A Wizard IT Company - For More Info http://www.wizard.ca
"LinuxMagic" is a Registered TradeMark of Wizard Tower TechnoServices Ltd.
------------------------------------------------------------------------
604-589-0037 Beautiful British Columbia, Canada

This email and any electronic data contained are confidential and intended
solely for the use of the individual or entity to which they are addressed.
Please note that any views or opinions presented in this email are solely
those of the author and are not intended to  represent those of the company.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Small Question in imap_mailbox.php function..

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, May 26, 2008 at 3:37 PM, Michael Peddemors
<michael@...> wrote:
> Should it not be:
>
> $ret = boolean_hook_function('special_mailbox',strtolower($box),1);

You're saying you want the strtolower applied?  It may have originally
been an oversight, but OTOH, I'd say it's actually more correct and
sometimes useful to pass any data to a plugin from the core in its
most raw form, and in this case, that means your plugin has to
remember to take care of any details such as applying strtolower.

Cheers,

 Paul

> In the function below...
>
>
> /**
>  * Defines special mailboxes: given a mailbox name, it checks if this is a
>  * "special" one: INBOX, Trash, Sent or Draft.
>  */
> function isSpecialMailbox( $box ) {
>    global $trash_folder, $sent_folder, $draft_folder,
>           $move_to_trash, $move_to_sent, $save_as_draft;
>
>    $ret = ( (strtolower($box) == 'inbox') ||
>             isTrashMailbox($box) || isSentMailbox($box) ||
> isDraftMailbox($box) );
>
>    if ( !$ret ) {
>        $ret = boolean_hook_function('special_mailbox',$box,1);
>    }
>    return $ret;
> }
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Small Question in imap_mailbox.php function..

by Michael Peddemors-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Paul, not sure if you are right in this perspective.. isSpecialMailbox will be
comparing data from external sources, that may have a case sensitvity issue
beyond the plugin writers control..

eg, comparing a mailbox name from sqimap_mailbox_list(), does the plugin
writer know that when he set it, to either say 'spam' or 'Spam' that the
behavior will be constant?  Basically, we have to determine whether
isSpecialMailbox should be a case sensitive form..

We should stay consistant.. you are doing strtolower() on Inbox, so they
expected behavior, if that function treats both Inbox and inbox as special,
that the same behavior will applied in the plugin.. Otherwise core doesn't
have to set two values, but the plugin writer does. Not Fair..;)

On Monday 26 May 2008 17:19, Paul Lesniewski wrote:

> On Mon, May 26, 2008 at 3:37 PM, Michael Peddemors
>
> <michael@...> wrote:
> > Should it not be:
> >
> > $ret = boolean_hook_function('special_mailbox',strtolower($box),1);
>
> You're saying you want the strtolower applied?  It may have originally
> been an oversight, but OTOH, I'd say it's actually more correct and
> sometimes useful to pass any data to a plugin from the core in its
> most raw form, and in this case, that means your plugin has to
> remember to take care of any details such as applying strtolower.
>
> Cheers,
>
>  Paul
>
> > In the function below...
> >
> >
> > /**
> >  * Defines special mailboxes: given a mailbox name, it checks if this is
> > a * "special" one: INBOX, Trash, Sent or Draft.
> >  */
> > function isSpecialMailbox( $box ) {
> >    global $trash_folder, $sent_folder, $draft_folder,
> >           $move_to_trash, $move_to_sent, $save_as_draft;
> >
> >    $ret = ( (strtolower($box) == 'inbox') ||
> >             isTrashMailbox($box) || isSentMailbox($box) ||
> > isDraftMailbox($box) );
> >
> >    if ( !$ret ) {
> >        $ret = boolean_hook_function('special_mailbox',$box,1);
> >    }
> >    return $ret;
> > }
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> -----
> squirrelmail-devel mailing list
> Posting guidelines: http://squirrelmail.org/postingguidelines
> List address: squirrelmail-devel@...
> List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
> List info (subscribe/unsubscribe/change options):
> https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

--
"Products, Services and Support..."
------------------------------------------------------------------------
Michael Peddemors - President/CEO - Wizard IT Services
"Servicing the ISP, Telco and Enterprise Markets since 1997"
------------------------------------------------------------------------
A Wizard IT Company - For More Info http://www.wizard.ca
"Wizard IT" is a company TradeMark of Wizard Tower TechnoServices Ltd.
------------------------------------------------------------------------
604-589-0037 Beautiful British Columbia, Canada

This email and any electronic data contained are confidential and intended
solely for the use of the individual or entity to which they are addressed.
Please note that any views or opinions presented in this email are solely
those of the author and are not intended to  represent those of the company.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Small Question in imap_mailbox.php function..

by Jon Angliss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Peddemors wrote:
| Should it not be:
|
| $ret = boolean_hook_function('special_mailbox',strtolower($box),1);
|
| In the function below...
|
|
| /**
|  * Defines special mailboxes: given a mailbox name, it checks if this is a
|  * "special" one: INBOX, Trash, Sent or Draft.
|  */
| function isSpecialMailbox( $box ) {
|     global $trash_folder, $sent_folder, $draft_folder,
|            $move_to_trash, $move_to_sent, $save_as_draft;
|
|     $ret = ( (strtolower($box) == 'inbox') ||
|              isTrashMailbox($box) || isSentMailbox($box) ||
| isDraftMailbox($box) );
|
|     if ( !$ret ) {
|         $ret = boolean_hook_function('special_mailbox',$box,1);
|     }
|     return $ret;
| }

No, it shouldn't be.  The only folder that is case-insensitive is INBOX
per the IMAP specs (RFC3501).  All other folders are treated in a rather
vague manor per the specs, but case-sensitivity should be used.  Try
reading 5.1 of RFC3501.

- --
Jon Angliss
<jon@...>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkg7eckACgkQK4PoFPj9H3NpPgCg+3+RbFMZ+sfNzeMhZrLLzPY+
wVYAniypDoQFc9dQdS1wqjfB1zXbpMGr
=8Fxa
-----END PGP SIGNATURE-----


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

Re: Small Question in imap_mailbox.php function..

by Michael Peddemors-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 26 May 2008 20:02, Jon Angliss wrote:
> No, it shouldn't be.  The only folder that is case-insensitive is INBOX
> per the IMAP specs (RFC3501).  All other folders are treated in a rather
> vague manor per the specs, but case-sensitivity should be used.  Try
> reading 5.1 of RFC3501.

Okay, good point for the login in that place.  But in the real world, it makes
for a lot of fun with 'trash' and 'Trash' folders being created by email
clients.  I would suggest though that a SM policy on this should be set.

In our case, we only treat 'Spam' as a special folder, which should be
prevented as auto-created, auto-subscribed, and non-deletable, non-renamable
etc..

Not all of the imap functions in SM expressly check for special folders, I
would suggest that core sets the standards, otherwise plugin writers may do
conflicting things..

I think to the average person using email trash is trash is trash, no matter
what the case.. :)

--
"Products, Services and Support..."
------------------------------------------------------------------------
Michael Peddemors - President/CEO - Wizard IT Services
"Servicing the ISP, Telco and Enterprise Markets since 1997"
------------------------------------------------------------------------
A Wizard IT Company - For More Info http://www.wizard.ca
"Wizard IT" is a company TradeMark of Wizard Tower TechnoServices Ltd.
------------------------------------------------------------------------
604-589-0037 Beautiful British Columbia, Canada

This email and any electronic data contained are confidential and intended
solely for the use of the individual or entity to which they are addressed.
Please note that any views or opinions presented in this email are solely
those of the author and are not intended to  represent those of the company.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel