Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: [PATCH] Use IMAP MOVE extension if available
Date: Mon, 03 Aug 2015 08:40:01 +0800	[thread overview]
Message-ID: <87d1z5cihq.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87vbcx460o.fsf@vostro.rath.org>

Nikolaus Rath <Nikolaus@rath.org> writes:

> On Aug 02 2015, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>> Nikolaus Rath <Nikolaus@rath.org> writes:
>>
>>> On Jul 27 2015, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>>>> diff --git a/lisp/nnimap.el b/lisp/nnimap.el
>>>> index 161a6b4..f8e6e3e 100644
>>>> --- a/lisp/nnimap.el
>>>> +++ b/lisp/nnimap.el
>>>> @@ -489,11 +489,18 @@ textual parts.")
>>>>  		      (when (functionp (nth 2 credentials))
>>>>  			(funcall (nth 2 credentials)))
>>>>  		      ;; See if CAPABILITY is set as part of login
>>>> -		      ;; response.
>>>> -		      (dolist (response (cddr login-result))
>>>> -			(when (string= "CAPABILITY" (upcase (car response)))
>>>> -			  (setf (nnimap-capabilities nnimap-object)
>>>> -				(mapcar #'upcase (cdr response))))))
>>>> +		      ;; response.  If it wasn't, specifically request
>>>> +		      ;; it.
>>>> +		      (when
>>>> +			  (catch 'caps
>>>> +			    (dolist (response (cddr login-result))
>>>> +			      (when (string= "CAPABILITY" (upcase (car response)))
>>>> +				(throw 'caps (setq capabilities (cdr response)))))
>>>> +			    (let ((req (nnimap-command "CAPABILITY")))
>>>> +			      (when (car req)
>>>> +				(throw 'caps (setq capabilities (cdaddr req))))))
>>>> +			(setf (nnimap-capabilities nnimap-object)
>>>> +			      (mapcar #'upcase capabilities))))
>>>>  		  ;; If the login failed, then forget the credentials
>>>>  		  ;; that are now possibly cached.
>>>>  		  (dolist (host (list (nnoo-current-server 'nnimap)
>>>
>>>
>>> This looks a lot more complex, but as far as I can tell it still
>>> needlessy asks for capabilities if they have been supplied in the
>>> response code of OK response instead of a in separate, untagged
>>> response. So is it really worth the extra complexity, if in many cases
>>> we still issue an explicit CAPABILITY command?
>>>
>>> (For everyone unfamiliar with RFC3501, what I mean is that this:
>>>
>>> * CAPABILITY IMAP4rev1 AND SOME MORE \r\n
>>> 1 OK Logged in\r\n
>>>
>>> will be parsed correcly but this:
>>>
>>> 1 OK [CAPABILITY IMAP4rev1 AND SOME MORE] Logged in\r\n
>>>
>>> will still cause Gnus to issue a separate CAPABILITY command).
>>
>> Okay, I pushed the CAPABILITY patch, and the MOVE patch right after
>> that. Sorry this is all going so slowly!
>
> Don't worry, I'm not in a rush. Luckily I can run the patches locally
> until they applied upstream :-).
>
>> I still think that we'll be able to come up with something that doesn't
>> unconditionally issue an extra CAPABILITY command. My patch was more
>> complex, but at least it avoided redundancy in *some* cases -- now we're
>> always doing the extra command.
>
> I don't understand this worry about one additional back and forth during
> *login*. For me, starting Gnus takes about 2 seconds, and issuing the
> CAPABILITY command takes about 160 ms. Is it really worth optimizing
> this?

No, I guess you're right. It just irks, a little.

>> Are you sure that `nnimap-parse-response' and `nnimap-parse-line' can't
>> handle the bracket case above?
>
> Depends what you mean. The data does end up in the list that's returned
> by nnimap-parse-response, because (as the comment says), it just
> "lightly" converts the response to a list of strings and lists of
> string. The problem is the "lightly" - apparently this function
> "succeeds" no matter what data you give it, even if this data completely
> fails the assumptions that went into writing that function. Looking at
> the code, I am not able to tell (in general) at which position the
> response code is going to be. So the best I can do is just use the
> location at which it ends up with my server - but I don't think that's a
> good idea.
>
> That's also the reason why I did not use nnimap-parse-response at all
> for parsing the NAMESPACE command (in my other patch). In that case,
> "parsing" the return value of nnimap-parse-response is actually a lot
> harder than parsing the IMAP response directly. For example, the
> nnimap-parse-response return value contains strings with opening parens,
> but no strings with the corresponding closing parens.
>
>> I haven't had time to test yet, but looking at the code it seems like
>> it ought to be able to handle it. If there are multiple commonly-used
>> formats for IMAP server responses, it seems like we really ought to be
>> handling them at the base level, when parsing responses.
>
> Making nnimap-parse-response into a proper parser would certainly be a
> good idea, but that's probably better left as a separate patch.

Oh certainly -- I'm not in any hurry to get stuck into that! But at some
point, yes, it would probably be nice.

>> I'll admit I only started learning about IMAP about six months ago, so
>> I'm happy to take other people's word on how all this works. Out of
>> curiosity, is there a particular server that returns the kind of
>> response you note above? I suppose we should be making a list of
>> known-good IMAP servers that Gnus can interact happily with.
>
> This is mail.messagingengine.com, the IMAP server from
> www.fastmail.com. IIRC they are using Cyrus.

That's pretty mainstream stuff, and I've heard Cyrus referred to as one
of the "sane" IMAP servers, so we should definitely be trying to play
nice with it...

Thanks,
Eric




  reply	other threads:[~2015-08-03  0:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16  0:29 Nikolaus Rath
2015-07-16  9:00 ` Eric Abrahamsen
2015-07-20  9:53 ` Eric Abrahamsen
2015-07-20 16:18   ` Nikolaus Rath
2015-07-27  4:36     ` Eric Abrahamsen
2015-07-27 16:10       ` Nikolaus Rath
2015-08-02  5:56         ` Eric Abrahamsen
2015-08-02 23:36           ` Nikolaus Rath
2015-08-03  0:40             ` Eric Abrahamsen [this message]
2015-08-03  1:08             ` Dan Christensen
2015-08-03  8:17               ` Steinar Bang
2015-08-03 17:18                 ` Nikolaus Rath
2015-08-04  3:17                   ` Eric Abrahamsen
2015-08-04 17:28                     ` Nikolaus Rath
2015-08-05  1:53                       ` Eric Abrahamsen
  -- strict thread matches above, loose matches on Subject: below --
2015-05-25 19:59 Nikolaus Rath
2015-07-07  2:59 ` Eric Abrahamsen
2015-07-07  3:05 ` Eric Abrahamsen
2015-07-09  2:13   ` Nikolaus Rath
2015-07-09  2:18     ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1z5cihq.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).