This plugin provides another visual indicator for message flags. 

E.g. The standard Squirrelmail distribution indicates a new message by displaying 
the header info in BOLD in the mailbox listing. With this plugin, a graphic 
envelope is placed in front of the message subject, a yellow envelope indicates a 
new message, a white one indicates a previously read message. The following flags 
are covered: new,read,reply,flagged,deleted,attachment.

****************************
NOTE
****************************
I included the modified mailbox_display.php and move_messages.php and left_main.php
from Squirrelmail version 1.2.8 If you're using SM 1.2.8 then copy them to the right 
dir and you're done :-)

If you like to make the changes your self :-)
Here is what needs to be changed:

This plugin requires the following change to
functions/mailbox_display.php:

On line 23 add the following:

        global $checkall,  ****ADD THIS HERE ==>$msg,

And on line 182 replace case 5 with this: 

      case 5: /* flags */
	$stuff = false;
	echo "   <td bgcolor=\"$hlt_color\" align=right nowrap><b><small>\n";
        if (isset($msg['FLAG_FLAGGED']) && $msg['FLAG_FLAGGED'] == true) {
	  echo "<IMG SRC=\"../plugins/msg_flags/flagged.gif\" border=\"0\">\n";
	  $stuff = true;
	}
	/*if (isset($msg['FLAG_ANSWERED']) && $msg['FLAG_ANSWERED'] == true) {
	  echo _("A") . "\n";
	  $stuff = true;
	}*/
	if ($default_use_priority) {
	  if ( ($msg['PRIORITY'] == 1) || ($msg['PRIORITY'] == 2) ) {
	    echo "<IMG SRC=\"../plugins/msg_flags/prio_high.gif\" border=\"0\">\n";
	    $stuff = true;
	  }
	  else if ($msg['PRIORITY'] == 5) {
	    echo "<IMG SRC=\"../plugins/msg_flags/prio_low.gif\" border=\"0\">\n";
	    $stuff = true;
	  }
	  else echo "<IMG SRC=\"../plugins/msg_flags/transparent.gif\" border=\"0\" width=\"5\"> ";
	}
	if ($msg['TYPE0'] == 'multipart') {
	  echo "<IMG SRC=\"../plugins/msg_flags/attach.gif\" border=\"0\">\n";
	  $stuff = true;
	}
	else echo "<IMG SRC=\"../plugins/msg_flags/transparent.gif\" border=\"0\" width=\"6\"> ";
	/*if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'] == true) {
	  echo "<font color=\"$color[1]\">D</font>\n";
	  $stuff = true;
	}*/
	if (!$stuff) {
	  echo "&nbsp;\n";
	}
	do_hook("msg_envelope");
	echo "</small></b></td>\n";
	break;

And on line 708 add the following:

    . '<INPUT TYPE="SUBMIT" NAME="markFlagged" VALUE="' . _("Flag") . '">'
    . '<INPUT TYPE="SUBMIT" NAME="markUnflagged" VALUE="' . _("Unflag") . '">'

This plugin requires the following change to
src/move_messages.php

On line 176 add the following:

if (isset($_POST['markFlagged'])) {
    $markFlagged = $_POST['markFlagged'];
}
if (isset($_POST['markUnflagged'])) {
    $markUnflagged = $_POST['markUnflagged'];
}

On line 259 add the following:

                } else if (isset($markFlagged)) {
		    sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Flagged");
		} else if (isset($markUnflagged)) {
		    sqimap_messages_remove_flag($imapConnection, $msg[$i], $msg[$i], "Flagged");

This plugin requires the following change to
src/left_main.php

Replace the function on line 161 with this:

function create_collapse_link($boxnum) {
    global $boxes;
    $mailbox = urlencode($boxes[$boxnum]['unformatted']);

    /* Create the link for this collapse link. */
    $link = '<a target="left" style="text-decoration:none" ' .
            'href="left_main.php?';
    if ($boxes[$boxnum]['collapse'] == SM_BOX_COLLAPSED) {
        $link .= "unfold=$mailbox\"><IMG SRC=\"../images/plus.gif\" border=\"0\">";
    } else {
        $link .= "fold=$mailbox\"><IMG SRC=\"../images/minus.gif\" border=\"0\">";
    }
    $link .= '</a>';

    /* Return the finished product. */
    return ($link);
}

****************************

To install the plugin:

  1.  Change to the plugins directory.

        $ cd plugins/

  2.  Unarchive the plugin.

        $ tar zxvf /your/path/to/msg_flags-x.x.tgz

  2.  This should create a msg_flags/ directory under plugins.

  3.  Copy the modified mailbox_display.php to the functions dir 
      Copy move_messages.php and left_main.php to the src dir

  4.  Go to the config directory and run conf.pl

        $ cd ../../config/
        $ ./conf.pl

  5.  Choose option 8 and proceed to add the new plugin following
      the instructions there.  Save and exit, and your plugin should
      be in place.


Possible enhancements:

- Tree line in the folder list.
- Deleted flag separate from the envelope like SM 1.2.7
- ?? You tell me :-)


Any questions or problems, feel free to contact me:

Forum:
http://www.jaakke.com/index.php?mode=forum
The look for "Projects" 

E-mail:
Robert Jaakke
Robert@jaakke.com

Special Thanks to Emil Broekmeulen for helping me with some coding issues. 

=======================
Revision history
=======================

09/04/02 - ver 0.1
- initial release

02/05/02 - ver 0.2
- Updated readme for SM 1.2.6
- Added mailbox_display.php and move_messages.php for SM 1.2.6
- Removed mailbox_display.php and move_messages.php for SM 1.2.5

07/05/02 - ver 0.3
- Moved the envelope icon to the flags cell instead of the subject line cell.
- Aligned the flags cell LEFT
- If a flag is not set a transparent image of the same width is placed instead to 
  align the flags vertically.
- Updated README -> Do it your self instructions.

08/05/02 - ver 0.4
- I had a bug reported and noticed that the case5 wasn't the same as included in SM 1.2.6
  So i took the fresh mailbox_display.php and move_messages.php from the SM 1.2.6 src and 
  modified these, so hopefully no more bugs now.
- Replaced the + and - in the folder list with images.
- Modified the envelope images. They now have the same width for better vertical alignment.
 
08/05/02 - ver 0.5
- Folder collapse wouldn't work after installing msg_flags 0.4, sorry for that, this version fixes it.

14/06/02 - ver 0.6
- After 1816 downloads someone noticed that the priority images were wrong.
  High prio was shown with a low prio image and low prio with the high prio image.
  Anyway this is what's fixed in this verion. If you are upgrading from ver 0.5 
  you can simply copy the mailbox_display.php from the archive since the rest is still the same.
  
26/06/02 - ver 0.7
- I updated the plugin to work with SM 1.2.7.
  First off all, my desktop died :-( so i had to work on my server and that delayed
  the work on Msg_Flags. But here it is :-)
- If you're using SM 1.2.6 there is no reason to upgrade this plugin since it's the same
  except the code might be a little different.
- The SM 1.2.7 tarball has the + and - images included in the image dir. This version of the 
  plugin uses them. If they're missing for some reason then copy the + and - img from the 
  Msg_flags dir to the SM image dir.

17/09/02 - ver 0.8
- I updated the plugin to work with SM 1.2.8 and it works with the register_globals set to off.
- Note! If you're using a version before SM 1.2.8 there is no reason to upgrade this plugin.  