Gnus development mailing list
 help / color / mirror / Atom feed
* Dovecot and capabilities
@ 2011-03-22  1:15 Michael Welsh Duggan
  2011-03-24 15:14 ` Ted Zlatanov
  2011-03-29 18:18 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Welsh Duggan @ 2011-03-22  1:15 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

I was trying to figure out why, using my new Dovecot install, I was not
getting UIDPLUS or QRESYNC capabilities.  I found out that it was
because the capabilities were determined at connection time, and the set
of advertised capabilities changes between connection and login.  Upon
login on Dovecot, an updated set of capabilities may be advertised.  I
was able to account for that using the included patch.  A perhaps-better
method might be to re-run CAPABILITY after logging in.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-Allow-capabilities-to-be-set-after-login.patch --]
[-- Type: text/x-diff, Size: 1164 bytes --]

From f6dcf14c70aac1b1c240f0bae4174612b110cf1c Mon Sep 17 00:00:00 2001
From: Michael Welsh Duggan <md5i@md5i.com>
Date: Mon, 21 Mar 2011 21:09:34 -0400
Subject: [PATCH 3/3] Allow capabilities to be set after login

---
 lisp/nnimap.el |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 138875b..b92c4c8 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -395,7 +395,13 @@ textual parts.")
 		(let ((nnimap-inhibit-logging t))
 		  (setq login-result
 			(nnimap-login (car credentials) (cadr credentials))))
-		(unless (car login-result)
+		(if (car login-result)
+                    ;; 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)))))
 		  ;; If the login failed, then forget the credentials
 		  ;; that are now possibly cached.
 		  (dolist (host (list (nnoo-current-server 'nnimap)
-- 
1.7.4.1


[-- Attachment #3: Type: text/plain, Size: 42 bytes --]


-- 
Michael Welsh Duggan
(md5i@md5i.com)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dovecot and capabilities
  2011-03-22  1:15 Dovecot and capabilities Michael Welsh Duggan
@ 2011-03-24 15:14 ` Ted Zlatanov
  2011-03-29 18:18 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2011-03-24 15:14 UTC (permalink / raw)
  To: ding

On Mon, 21 Mar 2011 21:15:11 -0400 Michael Welsh Duggan <md5i@md5i.com> wrote: 

MWD> I was trying to figure out why, using my new Dovecot install, I was not
MWD> getting UIDPLUS or QRESYNC capabilities.  I found out that it was
MWD> because the capabilities were determined at connection time, and the set
MWD> of advertised capabilities changes between connection and login.  Upon
MWD> login on Dovecot, an updated set of capabilities may be advertised.  I
MWD> was able to account for that using the included patch.  A perhaps-better
MWD> method might be to re-run CAPABILITY after logging in.

I am OK with your patch but to be done right it should re-run CAPABILITY
as you noted.  So I'd like Lars to look at it--that's why I haven't
committed it yet.

Ted




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dovecot and capabilities
  2011-03-22  1:15 Dovecot and capabilities Michael Welsh Duggan
  2011-03-24 15:14 ` Ted Zlatanov
@ 2011-03-29 18:18 ` Lars Magne Ingebrigtsen
  2011-03-29 20:23   ` Michael Welsh Duggan
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-03-29 18:18 UTC (permalink / raw)
  To: ding

Michael Welsh Duggan <md5i@md5i.com> writes:

> Upon login on Dovecot, an updated set of capabilities may be
> advertised.  I was able to account for that using the included patch.

Thanks; applied.

> A perhaps-better method might be to re-run CAPABILITY after logging
> in.

I don't see why -- if the LOGIN responds with a CAPABILITY list, then we
should use it.  If not, then the capabilities probably haven't changed.

Not issuing another CAPABILITY saves one round trip.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dovecot and capabilities
  2011-03-29 18:18 ` Lars Magne Ingebrigtsen
@ 2011-03-29 20:23   ` Michael Welsh Duggan
  2011-03-29 20:27     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Welsh Duggan @ 2011-03-29 20:23 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Michael Welsh Duggan <md5i@md5i.com> writes:
>
>> Upon login on Dovecot, an updated set of capabilities may be
>> advertised.  I was able to account for that using the included patch.
>
> Thanks; applied.
>
>> A perhaps-better method might be to re-run CAPABILITY after logging
>> in.
>
> I don't see why -- if the LOGIN responds with a CAPABILITY list, then we
> should use it.  If not, then the capabilities probably haven't changed.
>
> Not issuing another CAPABILITY saves one round trip.  :-)

Only because I don't see any way to guarantee that a server will return
a capability list in response to LOGIN, whereas we know it will return
one in response to CAPABILITY.  My solution will work in Dovecot 2, but
I don't know if it will work anywhere else.  Now, we could certainly use
the capability response if it is there, and re-request capabilities if
it is not.

Either way, my problem is solved with this patch, so it is up to you.

-- 
Michael Welsh Duggan
(mwd@cert.org)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dovecot and capabilities
  2011-03-29 20:23   ` Michael Welsh Duggan
@ 2011-03-29 20:27     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-03-29 20:27 UTC (permalink / raw)
  To: ding

Michael Welsh Duggan <mwd@cert.org> writes:

> Only because I don't see any way to guarantee that a server will return
> a capability list in response to LOGIN, whereas we know it will return
> one in response to CAPABILITY.  My solution will work in Dovecot 2, but
> I don't know if it will work anywhere else.  Now, we could certainly use
> the capability response if it is there, and re-request capabilities if
> it is not.

If there are other servers out there that don't return the changed
capabilities after LOGIN, then I'm sure somebody will notice and send a
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-29 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-22  1:15 Dovecot and capabilities Michael Welsh Duggan
2011-03-24 15:14 ` Ted Zlatanov
2011-03-29 18:18 ` Lars Magne Ingebrigtsen
2011-03-29 20:23   ` Michael Welsh Duggan
2011-03-29 20:27     ` Lars Magne Ingebrigtsen

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).