Gnus development mailing list
 help / color / mirror / Atom feed
* Three problems with multiple IMAP accounts
@ 2005-02-17  3:42 Juergen Kreileder
  2005-02-17  4:12 ` Mark Plaksin
  2005-02-18 13:44 ` Three problems with multiple IMAP accounts (patch for 2 of 3) Juergen Kreileder
  0 siblings, 2 replies; 4+ messages in thread
From: Juergen Kreileder @ 2005-02-17  3:42 UTC (permalink / raw)


Hi,

I have a few problems with multiple IMAP accounts:

Problem 1: Excessive reconnecting 
========== 

If I do 'g' with just one IMAP account I see:

,----
| Reading active file from Local via nnimap...
| nnimap: Checking mailboxes...done
`----

With two IMAP accounts this changes to:

,----
| Reading active file from Remote via nnimap...
| Opening nnimap server on Remote...
| Opening nnimap server on Remote...done
| nnimap: Checking mailboxes...done
| Reading active file from Local via nnimap...
| Opening nnimap server on Local...
| Opening nnimap server on Local...done
| nnimap: Checking mailboxes...done
`----

Note the "Opening nnimap ..." lines, they don't show up in the
one-account case.

Now if I enter and immediately leave a group on one of the accounts
(in this case the "Local" account) and do 'g' again, I get:

,----
| Reading active file from Remote via nnimap...
| Opening nnimap server on Remote...
| Opening nnimap server on Remote...done
| nnimap: Checking mailboxes...done
| Reading active file from Local via nnimap...
| Opening nnimap server on Local...
| imap: Connecting to server.jknet...
| imap: Opening SSL connection with `openssl s_client -cert /home/gnustest/.SSL/mailclient.cert -key /home/gnustest/.SSL/mailclient.key -quiet -ssl3 -connect %s:%p'...done
| Waiting for response from server.jknet...done
| imap: Authenticating using CRAM-MD5...done
| Opening nnimap server on Local...done
| nnimap: Checking mailboxes...done
`----

Ie. it closed the perfectly good connection and immediately opened a
new one!  This close&reconnect thing happens each time I leave a group
and do 'g'.
I can work around this reconnecting issue by setting nnimap-dont-close
to nil.  But I suspect the real problem is somewhere else, why does it
take the "Opening nnimap..." path with more than one account?


Problem 2: Agent confusion
==========

Sometimes the agent confuses the two IMAP accounts.  The consequence
is that new mail doesn't show up anymore, or it shows up on the wrong
account.  Entering a group also shows the contents from the group with
the same name on the other account.  To get things working again, I
have to delete ~/News/agent/.


Problem 3: Unprefixed names in nnimap-mailbox-info
=========

nnimap-mailbox-info contains un-prefixed group names.  This slows down
'g' in the group buffer when there are groups with the same name on
both IMAP accounts.

This patch fixes the problem for me:

--- /usr/share/emacs/site-lisp/gnus/lisp/nnimap.el	2005-02-16 12:30:12.000000000 +0100
+++ ./nnimap.el	2005-02-16 14:21:18.000000000 +0100
@@ -989,8 +989,11 @@ function is generally only called when G
 (defun nnimap-update-unseen (group &optional server)
   "Update the unseen count in `nnimap-mailbox-info'."
   (gnus-sethash
-   (gnus-group-prefixed-name group server)
-   (let ((old (gnus-gethash-safe (gnus-group-prefixed-name group server)
+   (gnus-group-prefixed-name group (gnus-server-to-method
+				    (format "nnimap:%s" server)))
+   (let ((old (gnus-gethash-safe (gnus-group-prefixed-name
+				  group (gnus-server-to-method
+					 (format "nnimap:%s" server)))
 				 nnimap-mailbox-info)))
      (list (nth 0 old) (nth 1 old)
 	   (imap-mailbox-status group 'unseen nnimap-server-buffer)
@@ -1098,7 +1101,9 @@ function is generally only called when G
 	  (dolist (group groups)
 	    (gnus-message 9 "nnimap: Quickly checking mailbox %s" group)
 	    (add-to-list (if (gnus-gethash-safe
-			      (gnus-group-prefixed-name group server)
+			      (gnus-group-prefixed-name
+			       group (gnus-server-to-method
+				      (format "nnimap:%s" server)))
 			      nnimap-mailbox-info)
 			     'asyncgroups
 			   'slowgroups)
@@ -1111,20 +1116,26 @@ function is generally only called when G
 		  new old)
 	      (when (imap-ok-p (imap-wait-for-tag tag nnimap-server-buffer))
 		(if (or (not (string=
-			      (nth 0 (gnus-gethash (gnus-group-prefixed-name
-						    group server)
-						   nnimap-mailbox-info))
+			      (nth 0 (gnus-gethash
+				      (gnus-group-prefixed-name
+				       group (gnus-server-to-method
+					      (format "nnimap:%s" server)))
+				      nnimap-mailbox-info))
 			      (imap-mailbox-get 'uidvalidity group
 						nnimap-server-buffer)))
 			(not (string=
-			      (nth 1 (gnus-gethash (gnus-group-prefixed-name
-						    group server)
-						   nnimap-mailbox-info))
+			      (nth 1 (gnus-gethash
+				      (gnus-group-prefixed-name
+				       group (gnus-server-to-method
+					      (format "nnimap:%s" server)))
+				      nnimap-mailbox-info))
 			      (imap-mailbox-get 'uidnext group
 						nnimap-server-buffer))))
 		    (push (list group) slowgroups)
 		  (insert (nth 3 (gnus-gethash (gnus-group-prefixed-name
-						group server)
+						group (gnus-server-to-method
+						       (format "nnimap:%s"
+							       server)))
 					       nnimap-mailbox-info))))))))
 	(dolist (group slowgroups)
 	  (if nnimap-retrieve-groups-asynchronous
@@ -1144,7 +1155,8 @@ function is generally only called when G
 		(insert str)
 		(when nnimap-retrieve-groups-asynchronous
 		  (gnus-sethash
-		   (gnus-group-prefixed-name group server)
+		   (gnus-group-prefixed-name
+		    group (gnus-server-to-method (format "nnimap:%s" server)))
 		   (list (or (imap-mailbox-get
 			      'uidvalidity group nnimap-server-buffer)
 			     (imap-mailbox-status
=



        Juergen

-- 
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux/java2-status/



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

* Re: Three problems with multiple IMAP accounts
  2005-02-17  3:42 Three problems with multiple IMAP accounts Juergen Kreileder
@ 2005-02-17  4:12 ` Mark Plaksin
  2005-02-17  5:31   ` Juergen Kreileder
  2005-02-18 13:44 ` Three problems with multiple IMAP accounts (patch for 2 of 3) Juergen Kreileder
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Plaksin @ 2005-02-17  4:12 UTC (permalink / raw)


Juergen Kreileder <jk@blackdown.de> writes:

> Hi,
>
> I have a few problems with multiple IMAP accounts:
>
> Problem 1: Excessive reconnecting 
> ========== 
>
> If I do 'g' with just one IMAP account I see:
>
> ,----
> | Reading active file from Local via nnimap...
> | nnimap: Checking mailboxes...done
> `----
>
> With two IMAP accounts this changes to:
>
> ,----
> | Reading active file from Remote via nnimap...
> | Opening nnimap server on Remote...
> | Opening nnimap server on Remote...done
> | nnimap: Checking mailboxes...done
> | Reading active file from Local via nnimap...
> | Opening nnimap server on Local...
> | Opening nnimap server on Local...done
> | nnimap: Checking mailboxes...done
> `----

I had the very same problem until I added all of my IMAP servers as
secondary-select-methods.  I also had to G E each nnimap group in the Group
buffer and make sure the short name of the server was specified.

For example, I added this to gnus-secondary-select-methods:
  (nnimap "SERVER"
        (nnimap-address "SERVER.com")
        (nnimap-server-port 993)
        (nnimap-stream ssl)
        (nnimap-list-pattern
         ("INBOX" "Mail/*")))

And then did G E on all my nnimap groups so they looked like this:
  ("nnimap+SERVER:Mail/happy" 1
   ((1 . 119))
   "SERVER" ;; changed this from "nnimap+SERVER:Mail/happy" to "SERVER"
   ((timestamp 16916 1783)
    (uidvalidity . "1107056107")))

After making this change Gnus was *much* faster.
    
Initially I used the Server buffer to add all of my IMAP groups; it never
occurred to me to make them secondary-select-methods.  Seems like adding
via the Server buffer should do some magic for you :)




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

* Re: Three problems with multiple IMAP accounts
  2005-02-17  4:12 ` Mark Plaksin
@ 2005-02-17  5:31   ` Juergen Kreileder
  0 siblings, 0 replies; 4+ messages in thread
From: Juergen Kreileder @ 2005-02-17  5:31 UTC (permalink / raw)


Mark Plaksin <happy@usg.edu> writes:

> I had the very same problem until I added all of my IMAP servers as
> secondary-select-methods.

I've always added them to gnus-secondary-select-methods in my ~/.gnus:

,----[ C-h v gnus-secondary-select-methods RET ]
| gnus-secondary-select-methods's value is shown below.
| [...]
| Value:
| ((nnimap "Local"
|          (nnimap-address "server.jknet")
|          (nnimap-stream ssl)
|          (nnir-search-engine imap))
|  (nnimap ""
|          (nnimap-address "imap.blackdown.de")
|          (nnimap-stream ssl)
|          (nnir-search-engine imap)))
`----

> I also had to G E each nnimap group in the Group buffer and make
> sure the short name of the server was specified.

> And then did G E on all my nnimap groups so they looked like this:
> ("nnimap+SERVER:Mail/happy" 1
> ((1 . 119))
> "SERVER" ;; changed this from "nnimap+SERVER:Mail/happy" to "SERVER"

I see "nnimap:" (resp. "nnimap:Local") at that place.  E.g.

("nnimap:Lists/Auriga" 3
 ((1 . 196))
 ((seen
   (1 . 196))
  (recent 196))
 "nnimap:"
 ((uidvalidity . "1097242187")
  (to-list . "auriga@yahoogroups.de")
  (subscribed . t)
  (broken-reply-to . t)))

If I change that to just "" (resp. "Local"), I can't enter the group
anymore (gnus-server-opened: Trying to require a method that doesn't
exist).

> ((timestamp 16916 1783)
> (uidvalidity . "1107056107")))

> After making this change Gnus was *much* faster.

For me problem 3 was the bigest performance issue.  The more groups
with the same name on both servers existed, the longer 'g' took.

Back to problem 1, I only recently noticed this reconnecting issue.  I
can't remember if it was always there or if it was introduced by some
recent change.


        Juergen

-- 
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux/java2-status/



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

* Re: Three problems with multiple IMAP accounts (patch for 2 of 3)
  2005-02-17  3:42 Three problems with multiple IMAP accounts Juergen Kreileder
  2005-02-17  4:12 ` Mark Plaksin
@ 2005-02-18 13:44 ` Juergen Kreileder
  1 sibling, 0 replies; 4+ messages in thread
From: Juergen Kreileder @ 2005-02-18 13:44 UTC (permalink / raw)


Juergen Kreileder <jk@blackdown.de> writes:

> Problem 1: Excessive reconnecting 
> ========== 

This was caused by comparing imap-state with 'select instead of
'selected.
I've attached a patch which seems to fix that and problem 3.

So this just leaves:

> Problem 2: Agent confusion
> ==========
> Sometimes the agent confuses the two IMAP accounts.  The consequence
> is that new mail doesn't show up anymore, or it shows up on the
> wrong account.  Entering a group also shows the contents from the
> group with the same name on the other account.  To get things
> working again, I have to delete ~/News/agent/.


Fix for problems 1 and 3:

--- /usr/share/emacs/site-lisp/gnus/lisp/imap.el	2005-02-16 12:30:12.000000000 +0100
+++ ./imap.el	2005-02-18 14:24:12.000000000 +0100
@@ -1123,7 +1123,7 @@ password is remembered in the buffer."
   (with-current-buffer (or buffer (current-buffer))
     (if (not (eq imap-state 'nonauth))
 	(or (eq imap-state 'auth)
-	    (eq imap-state 'select)
+	    (eq imap-state 'selected)
 	    (eq imap-state 'examine))
       (make-local-variable 'imap-username)
       (make-local-variable 'imap-password)
--- /usr/share/emacs/site-lisp/gnus/lisp/nnimap.el	2005-02-16 12:30:12.000000000 +0100
+++ ./nnimap.el	2005-02-18 14:23:17.000000000 +0100
@@ -826,7 +826,7 @@ If EXAMINE is non-nil the group is selec
     (or (and nnimap-server-buffer
 	     (imap-opened nnimap-server-buffer)
 	     (if (with-current-buffer nnimap-server-buffer
-		   (memq imap-state '(auth select examine)))
+		   (memq imap-state '(auth selected examine)))
 		 t
 	       (imap-close nnimap-server-buffer)
 	       (nnimap-open-connection server)))
@@ -989,8 +989,11 @@ function is generally only called when G
 (defun nnimap-update-unseen (group &optional server)
   "Update the unseen count in `nnimap-mailbox-info'."
   (gnus-sethash
-   (gnus-group-prefixed-name group server)
-   (let ((old (gnus-gethash-safe (gnus-group-prefixed-name group server)
+   (gnus-group-prefixed-name group (gnus-server-to-method
+				    (format "nnimap:%s" server)))
+   (let ((old (gnus-gethash-safe (gnus-group-prefixed-name
+				  group (gnus-server-to-method
+					 (format "nnimap:%s" server)))
 				 nnimap-mailbox-info)))
      (list (nth 0 old) (nth 1 old)
 	   (imap-mailbox-status group 'unseen nnimap-server-buffer)
@@ -1098,7 +1101,9 @@ function is generally only called when G
 	  (dolist (group groups)
 	    (gnus-message 9 "nnimap: Quickly checking mailbox %s" group)
 	    (add-to-list (if (gnus-gethash-safe
-			      (gnus-group-prefixed-name group server)
+			      (gnus-group-prefixed-name
+			       group (gnus-server-to-method
+				      (format "nnimap:%s" server)))
 			      nnimap-mailbox-info)
 			     'asyncgroups
 			   'slowgroups)
@@ -1111,20 +1116,26 @@ function is generally only called when G
 		  new old)
 	      (when (imap-ok-p (imap-wait-for-tag tag nnimap-server-buffer))
 		(if (or (not (string=
-			      (nth 0 (gnus-gethash (gnus-group-prefixed-name
-						    group server)
-						   nnimap-mailbox-info))
+			      (nth 0 (gnus-gethash
+				      (gnus-group-prefixed-name
+				       group (gnus-server-to-method
+					      (format "nnimap:%s" server)))
+				      nnimap-mailbox-info))
 			      (imap-mailbox-get 'uidvalidity group
 						nnimap-server-buffer)))
 			(not (string=
-			      (nth 1 (gnus-gethash (gnus-group-prefixed-name
-						    group server)
-						   nnimap-mailbox-info))
+			      (nth 1 (gnus-gethash
+				      (gnus-group-prefixed-name
+				       group (gnus-server-to-method
+					      (format "nnimap:%s" server)))
+				      nnimap-mailbox-info))
 			      (imap-mailbox-get 'uidnext group
 						nnimap-server-buffer))))
 		    (push (list group) slowgroups)
 		  (insert (nth 3 (gnus-gethash (gnus-group-prefixed-name
-						group server)
+						group (gnus-server-to-method
+						       (format "nnimap:%s"
+							       server)))
 					       nnimap-mailbox-info))))))))
 	(dolist (group slowgroups)
 	  (if nnimap-retrieve-groups-asynchronous
@@ -1144,7 +1155,8 @@ function is generally only called when G
 		(insert str)
 		(when nnimap-retrieve-groups-asynchronous
 		  (gnus-sethash
-		   (gnus-group-prefixed-name group server)
+		   (gnus-group-prefixed-name
+		    group (gnus-server-to-method (format "nnimap:%s" server)))
 		   (list (or (imap-mailbox-get
 			      'uidvalidity group nnimap-server-buffer)
 			     (imap-mailbox-status
=


        Juergen

-- 
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux/java2-status/



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

end of thread, other threads:[~2005-02-18 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-17  3:42 Three problems with multiple IMAP accounts Juergen Kreileder
2005-02-17  4:12 ` Mark Plaksin
2005-02-17  5:31   ` Juergen Kreileder
2005-02-18 13:44 ` Three problems with multiple IMAP accounts (patch for 2 of 3) Juergen Kreileder

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