At 18.03 16/11/2005, Jonathan Angliss wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, November 16, 2005 09:30, tonix (Antonio Nati) wrote:
> I've done some changes in squirrelmail code, and
> it works extremely good (speaking about performances I can see on a test
> machine).
>
> This solves any problem about copying/moving/deleting messages.
>
>
> These routines substitute the original ones within
> functions/imap_messages.php.
>
> /**
> * Copy a set of messages ($id) to another mailbox ($mailbox)
> */
> function sqimap_msgs_list_copy($imap_stream, $id, $mailbox) { global
> $uid_support;
> $msgs_id = sqimap_message_list_squisher($id);
> $id_array = explode (",", $msgs_id);
> foreach ($id_array as $id_single) { $id_limits = explode (":", $id_single);
Instead of doing two loops, simply use $id instead of $msgs_id. The
sqimap_message_list_squisher is what convers a 1,2,3,4 to 1:4. Or just
change:
$msgs_id = sqimap_message_list_squisher($id);
Into:
$msgs_id = $id;
It saves two loops, and processing you're never going to use anyway.
> $read = sqimap_mailbox_expunge($imap_stream, $mailbox, true); }
Thanks!
Code is much more compact and readable, with the changes you suggested.
/**
* Copy a set of messages ($id) to another mailbox ($mailbox)
*/
function sqimap_msgs_list_copy($imap_stream, $id, $mailbox) {
global $uid_support;
foreach ($id as $id_single) {
$read = sqimap_run_command ($imap_stream, "COPY $id_single
\"$mailbox\"", true, $response, $message, $uid_support);
$read = sqimap_run_command ($imap_stream, "STORE $id_single
+FLAGS (\\Deleted)", true, $response, $message, $uid_support);
$read = sqimap_mailbox_expunge($imap_stream, $mailbox, true);
}
}
/**
* Deletes a message and move it to trash or expunge the mailbox
*/
function sqimap_msgs_list_delete($imap_stream, $mailbox, $id) {
global $move_to_trash, $trash_folder, $uid_support;
foreach ($id as $id_single) {
if (($move_to_trash == true) &&
(sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox !=
$trash_folder))) {
$read = sqimap_run_command ($imap_stream, "COPY
$id_single \"$trash_folder\"", true, $response, $message, $uid_support);
}
$read = sqimap_run_command ($imap_stream, "STORE $id_single
+FLAGS (\\Deleted)", true, $response, $message, $uid_support);
$read = sqimap_mailbox_expunge($imap_stream, $mailbox, true);
}
}
And as somebody has already suggested, this can be quite expensive on some
IMAP servers. It'll be even more costly on larger mailboxes, and moving
large amounts of emails will result in quite a slow down of your
interface, and most likely cause higher CPU usage on your web server.
I agree, but how much is semplified life to end user?
I feel people pay more for better services. They are not going to
move often so large bunch od messages, but when it happens why deny
them the possibility of making it easily?
Thanks again!
Tonino
- --
Jonathan Angliss
<[EMAIL PROTECTED]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iEYEARECAAYFAkN7Zk8ACgkQK4PoFPj9H3PZJQCgtkhumsZNxD+LK8CvtO/a0r5V
37wAoOpxpxrtLbI9n1GF4ejtn1qnpEE0
=YD2a
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&opick
--
squirrelmail-users mailing list
Posting Guidelines:
http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: [email protected]
List Archives:
http://news.gmane.org/thread.php?groupane.mail.squirrelmail.user
List Archives: http://sourceforge.net/mailarchive/forum.php?forum_id)95
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
--
squirrelmail-users mailing list
Posting Guidelines:
http://www.squirrelmail.org/wiki/MailingListPostingGuidelines
List Address: [email protected]
List Archives:
http://news.gmane.org/thread.php?group=gmane.mail.squirrelmail.user
List Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=2995
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-users