Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread Uday S Reddy
John Stoffel writes:

> Sure, and someday pigs will fly as MS ships a perfectly conformant
> IMAP server implementation.  

Perhaps.  But, if the users don't complain, you will ensure that they will
never fix things.

> Quick question though, how is the best way to force VM to re-read
> vm-imap.el as I'm hacking away on it?  load-library?  

load-file can be used to load the file you are editing.  If it is a single
function, you can just do C-M-X to reload the defun.

Cheers,
Uday



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread John Stoffel
> "Uday" == Uday S Reddy  writes:

Uday> Kyle Farrell writes:
>> Attempting to store any flag the server doesn't recognize is causing
>> none of the flags to be stored.  I would guess the right thing for VM
>> to do would be only attempt to store flags that are explicitly
>> recognized by the server.

Uday> I don't think you meant that.  The "right thing" for VM to do is
Uday> to follow the standard.

Yes, that would be ideal.  But when the server doesn't implement the
standard properly, what else are we to do?  

Uday> You, or somebody on your behalf, is paying money to Microsoft to
Uday> deliver quality software.  It is their job to ask Microsoft to
Uday> do the "right thing".  So far, I don't see any evidence that
Uday> this has been done.

Sure, and someday pigs will fly as MS ships a perfectly conformant
IMAP server implementation.  

Uday> I will find some work around so that you don't have to put up
Uday> with too much pain.  But I don't regard it as my job to change
Uday> VM to work with bad servers.

Sure, I can understand your frustration, but I'm hoping this won't be
a big problem to fix.  I think that maybe the change could be
localized to vm-imap.el with a variable that us poor suffering fools
would have to use, which restricts FLAGS.SILENT usage when stupid
servers are in the loop.

Maybe I'll be able to whip up a test patch later on to see how it
works.

Quick question though, how is the best way to force VM to re-read
vm-imap.el as I'm hacking away on it?  load-library?  

John



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread John Stoffel
> "Uday" == Uday S Reddy  writes:

Uday> John Stoffel writes:
>> which tells me that MS doesn't want to support extra flags.

Uday> That is not the point.  To repeat what I wrote to you several months ago:

Uday> The IMAP standard (RFC 3501) says:

Uday> 59) It is not an error for the client to store a flag that is not in
Uday> the PERMANENTFLAGS list; however, the server will either ignore the
Uday> change or make the change in the session only.

Uday> So, unfortunately, your Exchange server is not adhering to the 
standard.
Uday> Please do complain to whoever is running your Exchange server.

Uday> You haven't said whether a complaint has been made to Microsoft.

I have NOT made a complaint to MS, since I doubt it will do anything.
And since when has not following the spec been a new thing for
Microsoft?  

Uday> Not only is Exchange giving an error message where it shouldn't,
Uday> but it is also forcibly disconnecting you after a few attempts.
Uday> That is quite a misbehaviour if you ask me!

Yup, I agree 100%.  But the chances of MS making a change is much less
than getting you to make the fix from the VM side.  I hope. *grin*

Uday> You guys are paying good money to Microsoft.  Why don't you get
Uday> on their backs?  Make them earn their living.

I wish I could, I really do.  And maybe I will be forced down this
route.  But for now, since I have the source, it's more likely I'll
learn elisp and hack the code myself to fix this issue.

Yes, I know they're abusing the standard, but I can't fix that.

John




Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread Uday S Reddy
Kyle Farrell writes:

> I was wondering why my deleted messages where getting cleared, then I
> realized what was happening: I'd read, reply, file, and delete my
> mail.  Messages are marked "\deleted" and "filed" (or another imap
> label Exchange doesn't recognize such as "junk").  Since Exchange
> can't store the flag, the command fails so none of the flags are being
> stored.  VM then syncs flags from the server, so my deleted flag is
> cleared from my inbox since the server rejected the store command.

Here is the work-around for this problem.

1. Set `vm-imap-sync-on-get' to nil, so that VM doesn't attempt to save
attributes when you get new mail.

2. Set `vm-expunge-before-save' and `vm-expunge-before-quit' to `t' so that
the deleted messages are expunged before saving.  

3. Set `vm-delete-after-saving' to `t' so that filed messages get deleted.

4. Use `s' to save folders. Or you can quit using `q' which does an
automatic save.

5. I suppose you will refrain from adding any labels to messages because VM
will attempt to save them to the server, which will then misbehave.  (The
"junk" flag is not created by VM.  You will need to figure out how it got
there.)

6. There will still be some VM-specific flags such as "forwarded" and
"redistributed" which Exchange won't understand.  Hopefully, they won't be
too many to get into trouble with Exchange.

As I have said before, I am happy to make VM resilient so that it doesn't
break when the server misbehaves.  But I haven't yet received a proper bug
report that explains how VM is breaking.  

Cheers,
Uday



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread Uday S Reddy
John Stoffel writes:

> which tells me that MS doesn't want to support extra flags.

That is not the point.  To repeat what I wrote to you several months ago:

The IMAP standard (RFC 3501) says:

59) It is not an error for the client to store a flag that is not in
the PERMANENTFLAGS list; however, the server will either ignore the
change or make the change in the session only.

So, unfortunately, your Exchange server is not adhering to the standard.
Please do complain to whoever is running your Exchange server.

You haven't said whether a complaint has been made to Microsoft.

Not only is Exchange giving an error message where it shouldn't, but it is
also forcibly disconnecting you after a few attempts.  That is quite a
misbehaviour if you ask me!

You guys are paying good money to Microsoft.  Why don't you get on their
backs?  Make them earn their living.

Cheers,
Uday



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread John Stoffel

Kyle> I did a bit more playing around and the "filed" flag is a red
Kyle> herring.  It's really any label that the imap server doesn't
Kyle> recognize that causes issue.

Right.  I think most IMAP servers will just accept the labels, and
then just discard them at the end of the session.  The IMAP spec says
"Should" for this.  MS probably decided to not bother since they
didn't have to meet the spec with it.  To quote RFC3501:

   A keyword is defined by the server implementation.  Keywords do not
   begin with "\".  Servers MAY permit the client to define new keywords
   in the mailbox (see the description of the PERMANENTFLAGS response
   code for more information).

And reading more seems to say that if the "OK [PERMANENTFLAGS (
)]" result you see on login doesn't include \*, then you can't
create new flags.  So probably VM should be patched to notice which
flags are allowed and to only use them.

For example, my login shows:

   * OK The Microsoft Exchange IMAP4 service is ready.
   -- connected for checkmail
   VM CAPABILITY
   * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN STARTTLS
   UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+
   VM OK CAPABILITY completed.
   VM LOGIN 
   VM OK LOGIN completed.
   VM SELECT "inbox"
   *  EXISTS
   * 0 RECENT
   * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
   * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft
   $MDNSent)] Permanent flags
   * OK [UNSEEN 2199] Is the first unseen message
   * OK [UIDVALIDITY 5840] UIDVALIDITY value
   * OK [UIDNEXT 122141] The next unique identifier value
   VM OK [READ-WRITE] SELECT completed.
   VM LOGOUT
   * BYE Microsoft Exchange Server 2010 IMAP4 server signing off.
   VM OK LOGOUT completed.

which tells me that MS doesn't want to support extra flags.

Kyle> I was wondering why my deleted messages where getting cleared,
Kyle> then I realized what was happening: I'd read, reply, file, and
Kyle> delete my mail.  Messages are marked "\deleted" and "filed" (or
Kyle> another imap label Exchange doesn't recognize such as "junk").
Kyle> Since Exchange can't store the flag, the command fails so none
Kyle> of the flags are being stored.  VM then syncs flags from the
Kyle> server, so my deleted flag is cleared from my inbox since the
Kyle> server rejected the store command.

I just tried changing the 'filed' flag as set in vm-imap.el to \filed,
but my simple attempt at hacking failed and didn't seem to make a
difference.

Kyle> Attempting to store any flag the server doesn't recognize is
Kyle> causing none of the flags to be stored.  I would guess the right
Kyle> thing for VM to do would be only attempt to store flags that are
Kyle> explicitly recognized by the server.

I wonder if VM could be taught to use the 



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread Uday S Reddy
Kyle Farrell writes:

> Attempting to store any flag the server doesn't recognize is causing
> none of the flags to be stored.  I would guess the right thing for VM
> to do would be only attempt to store flags that are explicitly
> recognized by the server.

I don't think you meant that.  The "right thing" for VM to do is to follow
the standard.

You, or somebody on your behalf, is paying money to Microsoft to deliver
quality software.  It is their job to ask Microsoft to do the "right thing".
So far, I don't see any evidence that this has been done.

I will find some work around so that you don't have to put up with too much
pain.  But I don't regard it as my job to change VM to work with bad
servers.

Cheers,
Uday



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread Kyle Farrell
I did a bit more playing around and the "filed" flag is a red herring.
It's really any label that the imap server doesn't recognize that
causes issue.

I was wondering why my deleted messages where getting cleared, then I
realized what was happening: I'd read, reply, file, and delete my
mail.  Messages are marked "\deleted" and "filed" (or another imap
label Exchange doesn't recognize such as "junk").  Since Exchange
can't store the flag, the command fails so none of the flags are being
stored.  VM then syncs flags from the server, so my deleted flag is
cleared from my inbox since the server rejected the store command.

Attempting to store any flag the server doesn't recognize is causing
none of the flags to be stored.  I would guess the right thing for VM
to do would be only attempt to store flags that are explicitly
recognized by the server.

-Kyle



Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-23 Thread John Stoffel

Uday> Kyle Farrell writes:
>> This surfaces as a "vm-imap-send-command: writing to process:
>> invalid argment, IMAP over SSL" and I can't get new mail or run
>> vm-imap-synchronize.  The workaround I've employed is to expunge filed
>> messages prior to getting new mail.

Uday> Ok, that is useful information, but still a long way off from what I would
Uday> need to track down the problems.

Sorry I haven't been able to provide enough info on this.  It comes
and goes, but I suspect it's partly based on how many filed and
deleted messages you have.  If I do more than... oh... say 8 to 10
messages which are filed and deleted, then try to expunge them from
the IMAP server, it then fails.  Again, I suspect it's because MS
Exchange has a poor IMAP implementation.  

Uday> I believe that VM recovers from the "BAD Command" errors fine.
Uday> VM knows that they don't matter.  But John Stoffel's trace log
Uday> showed that the server was disconnecting him after a few such
Uday> errors.  This could leave VM in a confused or inconsistent
Uday> state.  I can't tell from your description what exactly
Uday> happened.

Could it be that the server says "whoa, too many bad commands, I'm
kicking you out!" so it might be useful to do the commands in smaller
batches, then flush changes?  

Or maybe, because MS Exchange just sucks, we don't store any flags
beyond the ones defined in the IMAP standard?  Or maybe we need to
pre-define the 'filed' flag as a PERMANENTFLAGS somehow?  Yes, I'm
quickly looking over the IMAP specs as shown in:

  https://tools.ietf.org/html/rfc3501#section-6

Uday> Note that I can't reproduce your errors.  You will need to give
Uday> me a blow-by-blow description of what happens and be as precise
Uday> as possible.  For instance, "this surfaces as" is too vague.  Is
Uday> it an error?  Is it a warning?  Does VM stop and report the
Uday> error, or go on continuing?

Sometimes it works, in other words, I can save the buffer, expunge
deleted messages, etc.  Othertimes the IMAP connection gets closed and
I don't get to make any changes at all to my inbox. I then have to
login with Outlook, find and nuke some/all of the messages giving
problems, and then VM works again.

Uday> What do you do next?  What is VM's response?  What does the
Uday> *Messages* buffer show?  Et cetra.

Uday> Please report it to viewmail-b...@nongnu.org so that we don't have to bore
Uday> everybody with these problems.

>> How could this be fixed client side, in VM?  What should VM do in this
>> situation?  Does anyone have alternative workarounds for Exchange
>> 2010?  Is there a way to clear the filed flag from messages?

Uday> Yes, there is.  Please see the manual section "Message Attributes".

Uday> Cheers,
Uday> Uday




Re: [VM] Exchange 2010 IMAP4 & storing "filed"

2013-07-22 Thread Uday Reddy
Kyle Farrell writes:

> This surfaces as a "vm-imap-send-command: writing to process:
> invalid argment, IMAP over SSL" and I can't get new mail or run
> vm-imap-synchronize.  The workaround I've employed is to expunge filed
> messages prior to getting new mail.

Ok, that is useful information, but still a long way off from what I would
need to track down the problems.

I believe that VM recovers from the "BAD Command" errors fine.  VM knows
that they don't matter.  But John Stoffel's trace log showed that the server
was disconnecting him after a few such errors.  This could leave VM in a
confused or inconsistent state.  I can't tell from your description what
exactly happened.

Note that I can't reproduce your errors.  You will need to give me a
blow-by-blow description of what happens and be as precise as possible.  For
instance, "this surfaces as" is too vague.  Is it an error?  Is it a
warning?  Does VM stop and report the error, or go on continuing?

What do you do next?  What is VM's response?  What does the *Messages*
buffer show?  Et cetra.

Please report it to viewmail-b...@nongnu.org so that we don't have to bore
everybody with these problems.

> How could this be fixed client side, in VM?  What should VM do in this
> situation?  Does anyone have alternative workarounds for Exchange
> 2010?  Is there a way to clear the filed flag from messages?

Yes, there is.  Please see the manual section "Message Attributes".

Cheers,
Uday