andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

Flags add vs replace #28

Closed AndyClaw closed 12 years ago

AndyClaw commented 12 years ago

The store method of the ImapClient looks like it will replace flags when it is supposed to add and add when it is supposed to replace.

There is a ternary expression in the code as follows: replace ? "+" : ""

Yet the plus sign is intended for adding flags, whereas no sign is intended for replacing flags.

From the RFC:

FLAGS Replace the flags for the message (other than \Recent) with the argument. The new value of the flags is returned as if a FETCH of those flags was done.

  FLAGS.SILENT <flag list>
     Equivalent to FLAGS, but without returning a new value.

  +FLAGS <flag list>
     Add the argument to the flags for the message.  The new value
     of the flags is returned as if a FETCH of those flags was done.

  +FLAGS.SILENT <flag list>
     Equivalent to +FLAGS, but without returning a new value.

  -FLAGS <flag list>
     Remove the argument from the flags for the message.  The new
     value of the flags is returned as if a FETCH of those flags was
     done.

  -FLAGS.SILENT <flag list>
     Equivalent to -FLAGS, but without returning a new value.
andyedinborough commented 12 years ago

You may have noticed that I have an innate ability to write very complex code only to write very simple code in exactly the opposite way intended. :]

AndyClaw commented 12 years ago

Don't worry, you may have noticed that I have an innate ability to find your logic errors. :]