Re: Automatically authenticating at local imap server

2008-02-15 Thread Ted Zlatanov
On Wed, 06 Feb 2008 21:07:31 +0100 David [EMAIL PROTECTED] wrote: 

D I also noticed that when the same message is in two different groups the
D registry will only return the group where it first saw it, right? I
D guess it would be quite difficult to extend the registry in a way so
D that it can return all groups where a message exists?

Fortunately, gnus-registry-fetch-groups already does it :)

Ted
___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-07 Thread Tassilo Horn
Reiner Steib [EMAIL PROTECTED] writes:

Hi Reiner,

 On Mon, Feb 04 2008, Tassilo Horn wrote:

 The problem is, that in my ~/.authinfo I specified the port as imap (or
 now I omit it) and on the gnus side I said 143.  So
 `netrc-machine-user-or-password' is called with ports = (143) and
 defaults = (imap imaps) which won't find a match.

 I think the right fix would be to add 143 and 993 to the call of
 `netrc-machine-user-or-password' in `nnimap-open-connection', because
 these are the default ports for imap and imaps.

 Would you like to submit a patch?  (Please send it to [EMAIL PROTECTED])

Sure, so here it is.

--8---cut here---start-8---
Index: lisp/nnimap.el
===
RCS file: /usr/local/cvsroot/gnus/lisp/nnimap.el,v
retrieving revision 7.41
diff -u -r7.41 nnimap.el
--- lisp/nnimap.el  20 Jan 2008 05:23:57 -  7.41
+++ lisp/nnimap.el  7 Feb 2008 09:55:03 -
@@ -802,7 +802,7 @@
(or nnimap-server-address
nnimap-address))
  (list port)
- (list imap imaps)))
+ (list imap imaps 143 993)))
   (passwd (netrc-machine-user-or-password
password
list
@@ -810,7 +810,7 @@
  (or nnimap-server-address
  nnimap-address))
(list port)
-   (list imap imaps
+   (list imap imaps 143 993
   (if (imap-authenticate user passwd nnimap-server-buffer)
  (prog2
  (setq nnimap-server-buffer-alist
--8---cut here---end---8---

And here's a ChangeLog entry.

--8---cut here---start-8---
2008-02-07  Tassilo Horn  [EMAIL PROTECTED]

* nnimap.el (nnimap-open-connection): Add 143 and 993 as default
ports to the calls to `netrc-machine-user-or-password' in addition to
imap and imaps.
--8---cut here---end---8---

Bye,
Tassilo



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-06 Thread Tassilo Horn
David [EMAIL PROTECTED] writes:

Hi David, hi Ted,

 You could use the Gnus registry if it's loaded.  It will tell you the
 last place a message ID was seen (it learns this by looking at the
 visible messages every time you enter a group, and by hooking into
 spool/move/copy/delete on each backend).

 Yes, I guess the best way would be to first check the registry for the
 group and do the additional mairix search only if the registry is not
 loaded or does not know the location of the message. I don't want to
 rely solely on the registry though, because of the limitations you
 describe:

Here's a works-for-me draft:

--8---cut here---start-8---
(setq gnus-registry-max-entries 1
  gnus-registry-use-long-group-names t)

(gnus-registry-initialize)

 Select an article by message-id with the registry

(defun th-gnus-registry-select-article (message-id)
  (interactive sMessage-ID: )
  (let ((group-buffer (get-buffer gnus-group-buffer))
(group (gnus-registry-fetch-group message-id)))
(pop-to-buffer group-buffer)
(gnus-group-list-all-groups)
(gnus-group-goto-group group t)
(gnus-group-select-group 1)
(gnus-summary-refer-article message-id)))

(defun th-gnus-select-article-in-original-group (header)
  (interactive (gnus-interactive H))
  (th-gnus-registry-select-article
   (mail-header-message-id header)))
--8---cut here---end---8---

I've bound th-gnus-select-article-in-original-group to M-^ in nnmairix
groups to get fast access to it.

One annoying thing is that it seems I must use (gnus-group-select-group
1), if I provide 0 or nil, the group won't be selected.  So you'll have
another message in the group after you press M-^ in the nnmairix
group.

Improvements welcome.

Bye,
Tassilo



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-06 Thread David
Tassilo Horn [EMAIL PROTECTED] writes:
 One annoying thing is that it seems I must use (gnus-group-select-group
 1), if I provide 0 or nil, the group won't be selected.  So you'll have
 another message in the group after you press M-^ in the nnmairix
 group.

Yes, but you can limit the summary buffer to the message containing the
message-id. I'd suggest the following:

(defun th-gnus-registry-select-article (message-id)
  (interactive sMessage-ID: )
  (let ((group-buffer (get-buffer gnus-group-buffer))
(group (gnus-registry-fetch-group message-id)))
(pop-to-buffer group-buffer)
(gnus-group-jump-to-group group)
(gnus-summary-read-group group 1 t nil nil nil nil) 
(gnus-summary-refer-article message-id)
(gnus-summary-limit-to-headers (format message-id: %s message-id))
(gnus-summary-select-article)))

I'm currently working on the code that finds the original group based on
the message file path. As soon as this is ready I'll post an update to
nnmairix also containing the registry code.

Thanks for your input,
David



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-06 Thread Ted Zlatanov
On Tue, 05 Feb 2008 22:58:49 +0100 David [EMAIL PROTECTED] wrote: 

D Yes, I guess the best way would be to first check the registry for the
D group and do the additional mairix search only if the registry is not
D loaded or does not know the location of the message. I don't want to
D rely solely on the registry though, because of the limitations you
D describe: [...]

Cool.  Also note the group could be wrong, e.g. someone modified a
Maildir spool externally and the registry doesn't know.  So it's a bit
like asking a random person for directions: very nice when it works but
don't rely on it :)

Ted
___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-06 Thread David
Ted Zlatanov [EMAIL PROTECTED] writes:
 D Yes, I guess the best way would be to first check the registry for the
 D group and do the additional mairix search only if the registry is not
 D loaded or does not know the location of the message. I don't want to
 D rely solely on the registry though, because of the limitations you
 D describe: [...]

 Cool.  Also note the group could be wrong, e.g. someone modified a
 Maildir spool externally and the registry doesn't know.  So it's a bit
 like asking a random person for directions: very nice when it works but
 don't rely on it :)

When the user notices that the registry is wrong he will be able revert
to the file path method by calling the function with a prefix.

I also noticed that when the same message is in two different groups the
registry will only return the group where it first saw it, right? I
guess it would be quite difficult to extend the registry in a way so
that it can return all groups where a message exists?

-David





___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-06 Thread Reiner Steib
On Mon, Feb 04 2008, Tassilo Horn wrote:

 The problem is, that in my ~/.authinfo I specified the port as imap (or
 now I omit it) and on the gnus side I said 143.  So
 `netrc-machine-user-or-password' is called with ports = (143) and
 defaults = (imap imaps) which won't find a match.

 I think the right fix would be to add 143 and 993 to the call of
 `netrc-machine-user-or-password' in `nnimap-open-connection', because
 these are the default ports for imap and imaps.

Would you like to submit a patch?  (Please send it to [EMAIL PROTECTED])

Bye, Reiner.
-- 
   ,,,
  (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/
___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-05 Thread Tassilo Horn
David [EMAIL PROTECTED] writes:

Hi David,

 ,[ C-h f gnus-summary-refer-article RET ]
 | gnus-summary-refer-article is an interactive compiled Lisp function in 
 `gnus-sum.el'.
 | (gnus-summary-refer-article message-id)
 | 
 | Fetch an article specified by message-id.
 `

 Ah, OK. I only tried nnimap-retrieve-headers with a message-id and it
 didn't work.

BTW, I have tested this with my rather large (1+ messages)
emacs-devel group, and it's quite fast.  I enter the summary buffer with
`C-u 0 RET' so that no articles are displayed and then do `M-x
gnus-summary-refer-article RET message-id'.  Even with m-ids of
ancient articles I don't get a noticable delay.  Maybe dovecot does some
indexing to make that possible.  At least the feature list says:

  Dovecot's indexes are self-optimizing. They contain exactly what the
  user's client commonly needs, no more and no less.

Seems the message-id is included there.

Bye,
Tassilo
-- 
Chuck  Norris  doesn't  daydream.  He's  too busy  giving  other  people
nightmares.



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-05 Thread David
Ted Zlatanov [EMAIL PROTECTED] writes:
 D Jumping to the original message in this group is another problem
 D since we only know the message-id but not the article
 D number. 

 You could use the Gnus registry if it's loaded.  It will tell you the
 last place a message ID was seen (it learns this by looking at the
 visible messages every time you enter a group, and by hooking into
 spool/move/copy/delete on each backend).  

Yes, I guess the best way would be to first check the registry for the
group and do the additional mairix search only if the registry is not
loaded or does not know the location of the message. I don't want to
rely solely on the registry though, because of the limitations you
describe:

 It may not know the location for various reasons, e.g. the user limits
 the size of the registry or the message hasn't been seen yet, 

I guess the latter would be a problem for users with big archive groups
which they rarely open.

 The registry doesn't currently record the article number, but it could.

The article number won't be necessary as Tassilo already mentioned. The
lookup through gnus-read-header works just fine.

-David




___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-04 Thread Tassilo Horn
Gour [EMAIL PROTECTED] writes:

Hi Gour,

 Tassilo Everytime I start Gnus it asks me how to logon at the local
 Tassilo IMAP server, but instead I want that it uses the username and
 Tassilo password that are in my ~/.authinfo.

 Here is my ~/.authinfo:

 machine localhost login gour password 

Hm, reading your config below I would thing that localhost-IMAP would be
the correct machine name.  Else, how would gnus figure out how to login
on i.e. a local newsserver that uses a different user/password.

 and snippet from .gnus:

 (setq mail-sources nil)
 (setq gnus-select-method '(nntp  news.gmane.org)
   gnus-secondary-select-methods
 '((nnimap localhost-IMAP (nnimap-address localhost)) 
   (nntp news.iskon.hr)))

No big difference to my config.  I only set the stream/authenticator to
use no encryption, because the tls connection broke down several times.
But even if I use exactly your config (with my name for the method) it
won't logon automatically.  Well, I'll try to edebug it as Reiner
suggested.

 That's all and it works with dovecot server.

Yeah, dovecot here, too.  I never tried running a local IMAP server
because I thought it would be quite complex, but in fact it was easy,
basically: emerge dovecot; edit a few lines in the well commented
dovecot.conf, start the server.

Another question about dovecot: When I used nnmaildir I indexed the
mails with mairix and could do very fast searches with the nnmairix
backend.  Currently I use nnir's imap backend to search on the local
imap server, but that takes ages for huge groups.  Is there a way to
teach dovecot to use a mailindexing tool to speed that up?

Bye,
Tassilo
-- 
If you were somehow able to land a punch on Chuck Norris your entire arm
would shatter upon  impact. This is only in theory,  since, come on, who
in their right mind would try this?



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-04 Thread Tassilo Horn
Reiner Steib [EMAIL PROTECTED] writes:

Hi Reiner,

 Everytime I start Gnus it asks me how to logon at the local IMAP
 server, but instead I want that it uses the username and password
 that are in my ~/.authinfo.

 Here's the Gnus side of the configuration:

 ,[ ~/.gnus.el ]
 | (require 'nnir)
 | (add-to-list 'gnus-secondary-select-methods
 |  '(nnimap Fastmail
 |   (nnimap-address localhost)
 |   (nnimap-server-port 143)

 If you use a standard port, you can omit it here.

I removed that line and edebugged the two functions and all worked as
expected.  In fact, exactly this line triggeres the bug.

The problem is, that in my ~/.authinfo I specified the port as imap (or
now I omit it) and on the gnus side I said 143.  So
`netrc-machine-user-or-password' is called with ports = (143) and
defaults = (imap imaps) which won't find a match.

I think the right fix would be to add 143 and 993 to the call of
`netrc-machine-user-or-password' in `nnimap-open-connection', because
these are the default ports for imap and imaps.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-04 Thread David
Tassilo Horn [EMAIL PROTECTED] writes:
 Another question about dovecot: When I used nnmaildir I indexed the
 mails with mairix and could do very fast searches with the nnmairix
 backend.  Currently I use nnir's imap backend to search on the local
 imap server, but that takes ages for huge groups.  Is there a way to
 teach dovecot to use a mailindexing tool to speed that up?

I use the same setup here and nnmairix works nicely with nnimap. If you
feel uncomfortable with nnmairix creating/deleting groups on your local
IMAP server, you can also create a nnmaildir secondary select method
exclusively for nnmairix.

-David





___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-04 Thread Tassilo Horn
David [EMAIL PROTECTED] writes:

Hi David,

 Another question about dovecot: When I used nnmaildir I indexed the
 mails with mairix and could do very fast searches with the nnmairix
 backend.  Currently I use nnir's imap backend to search on the local
 imap server, but that takes ages for huge groups.  Is there a way to
 teach dovecot to use a mailindexing tool to speed that up?

 I use the same setup here and nnmairix works nicely with nnimap. If
 you feel uncomfortable with nnmairix creating/deleting groups on your
 local IMAP server, you can also create a nnmaildir secondary select
 method exclusively for nnmairix.

Ah, right.  Now I let mairix index the maildirs in /var/mail/heimdall/.
Those are the maildirs dovecot serves.  The search results go into
groups of a separate nnml backend.  This works very nice. :-)

But one thing is left: Is there a way to jump from a message in the
search result group to the original nnimap group?  I often do a search
to find a message I want to reply to and the reply has to be done from
the original group so that posting styles and group parameters are
considered.

(If there's no builtin way, I'm happy with a dirty hack or a suggestion
for a dirty hack, too.)

Bye,
Tassilo



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-04 Thread David
Tassilo Horn [EMAIL PROTECTED] writes:
 But one thing is left: Is there a way to jump from a message in the
 search result group to the original nnimap group?  I often do a search
 to find a message I want to reply to and the reply has to be done from
 the original group so that posting styles and group parameters are
 considered.

That's on the TODO list - I always wanted a function that jumps to the
original message in the original group, but it's not trivial to do. My
idea was to call mairix with m:MID, where MID is the message-id of
the article. Using the -r option, we get the full path of the mail
file and it should be possible to uniquely identify the group from the
path (the problem here is that the user might index several different
mail back ends with one mairix installation). Jumping to the original
message in this group is another problem since we only know the
message-id but not the article number. nnmaildir and nnml support
fetching articles by message-id, but AFAIK nnimap does not. Maybe it is
somehow possible to apply the correct posting style even when replying
from the nnmairix group, then we wouldn't have to get the original
article in the first place.

-David



___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english


Re: Automatically authenticating at local imap server

2008-02-03 Thread Reiner Steib
On Sun, Feb 03 2008, Tassilo Horn wrote:

 Everytime I start Gnus it asks me how to logon at the local IMAP server,
 but instead I want that it uses the username and password that are in my
 ~/.authinfo.

 Here's the Gnus side of the configuration:

 ,[ ~/.gnus.el ]
 | (require 'nnir)
 | (add-to-list 'gnus-secondary-select-methods
 |  '(nnimap Fastmail
 |   (nnimap-address localhost)
 |   (nnimap-server-port 143)

If you use a standard port, you can omit it here.

 |   (nnimap-stream network)
 |   (nnimap-authenticator login)
 |   (nnir-search-engine imap)))
 `

 In my ~/.authinfo I have:

 ,[ ~/.authinfo ]
 | machine Fastmail login heimdall password XXX port imap force yes
 | machine localhost login heimdall password XXX port imap force yes
 `

I don't see anything obvious.  (Though one of the entries seem
redundant, port imap as well, IIRC.)

So I'd suggest to edebug `imap-interactive-login' and
`nnimap-open-connection'.

In a nutshell (see (info (elisp)Edebug) for details):

- Require imap and nnimap.  Put the cursor inside the function
  definitions in imap.el/nnimap.el and press `C-u C-M-x'.

- Repeat the problem.  Step through the code using `SPC' or `n' and
  watch the results of the evaluated expressions in the echo area (or
  *Messages*).

- You may also evaluate expressions using `e' (including let-bound
  variable, etc.) and jump to a specified location: (info
  (elisp)Edebug Eval), (info (elisp)Jumping), ...

Bye, Reiner.
-- 
   ,,,
  (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/
___
info-gnus-english mailing list
info-gnus-english@gnu.org
http://lists.gnu.org/mailman/listinfo/info-gnus-english