all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* display-time, mail-icon and POP3 mailboxes
@ 2002-02-07  9:54 Pavel Janík
  2002-02-08 13:57 ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Janík @ 2002-02-07  9:54 UTC (permalink / raw)


Hi,

I'd like to add the ability to check POP3 mailbox for new messages (and
displaying mail icon). Now, we support only looking into file or directory
for new e-mail. POP3 support would be great. The implementation itself is
very easy (and already done, in fact).

But how should i get the hostname, username and password from user?

Rmail uses movemail which checks MAILHOST env. variable or the third field
of inbox (po:user:host). Gnus can set everything in mail-sources:

(setq mail-sources '((pop :server "my-server" :user "MyName" :password "MySecret")))

I do not know about VM and other mail programs. Do you have an idea?
Should I share values with those programs or should I invent new user
options display-time-pop3-{server,user,password}?
-- 
Pavel Janík

Pah! Benchmarks, smenchmarks! Give us your bogomips-rating, that's
the only thing that counts :-)
                  -- David Weinehall in linux-kernel

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-07  9:54 display-time, mail-icon and POP3 mailboxes Pavel Janík
@ 2002-02-08 13:57 ` Richard Stallman
  2002-02-08 20:54   ` Pavel Janík
  0 siblings, 1 reply; 16+ messages in thread
From: Richard Stallman @ 2002-02-08 13:57 UTC (permalink / raw)
  Cc: emacs-devel

    I do not know about VM and other mail programs. 

Don't worry about VM.  Its developer wants it to be separate
from Emacs, and that means it is not our responsibility.



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-08 13:57 ` Richard Stallman
@ 2002-02-08 20:54   ` Pavel Janík
  2002-02-08 23:14     ` Kim F. Storm
  0 siblings, 1 reply; 16+ messages in thread
From: Pavel Janík @ 2002-02-08 20:54 UTC (permalink / raw)
  Cc: emacs-devel

   From: Richard Stallman <rms@gnu.org>
   Date: Fri, 8 Feb 2002 06:57:41 -0700 (MST)

   >     I do not know about VM and other mail programs. 
   > 
   > Don't worry about VM.  Its developer wants it to be separate
   > from Emacs, and that means it is not our responsibility.

OK, but we still have RMAIL and Gnus. Both use different syntax etc. I will
define separate variables which will be display-time specific and not
shared/used with anything else.
-- 
Pavel Janík

printk("Entering UltraSMPenguin Mode...\n");
                  -- 2.2.16 arch/sparc64/kernel/smp.c

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-08 20:54   ` Pavel Janík
@ 2002-02-08 23:14     ` Kim F. Storm
       [not found]       ` <m3pu3dqizu.fsf@Janik.cz>
  0 siblings, 1 reply; 16+ messages in thread
From: Kim F. Storm @ 2002-02-08 23:14 UTC (permalink / raw)


Pavel@Janik.cz (Pavel Janík) writes:

>    From: Richard Stallman <rms@gnu.org>
>    Date: Fri, 8 Feb 2002 06:57:41 -0700 (MST)
> 
>    >     I do not know about VM and other mail programs. 
>    > 
>    > Don't worry about VM.  Its developer wants it to be separate
>    > from Emacs, and that means it is not our responsibility.
> 
> OK, but we still have RMAIL and Gnus. Both use different syntax etc. I will
> define separate variables which will be display-time specific and not
> shared/used with anything else.

I think it should at least be able to use the existing gnus and/or
rmail settings (they cannot be that hard to use).
You can then add extra mailboxes to check specifically.

What about these options:
 - display-time-pop3-check-rmail  (nil/t, default t)
 - display-time-pop3-check-gnus   (nil/t, default t)
 - display-time-pop3-mail-boxes   (alist (server.passwd), default ())


With the pop3 sample code I posted some time ago, there is one serious
problem: If emacs cannot connect to the pop3 server, it may hang (no
user interaction) until the connect times out.  That is not
satisfactory!

I don't know if this is relevant for your code (sorry, but I haven't
had time to look at the code you sent me).

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
       [not found]       ` <m3pu3dqizu.fsf@Janik.cz>
@ 2002-02-10 19:57         ` Kim F. Storm
  2002-02-11 18:48           ` Richard Stallman
       [not found]           ` <200202111848.g1BIm0406891@aztec.santafe.edu>
  0 siblings, 2 replies; 16+ messages in thread
From: Kim F. Storm @ 2002-02-10 19:57 UTC (permalink / raw)
  Cc: GNUS mailing list

Pavel@Janik.cz (Pavel Janík) writes:

>    From: storm@cua.dk (Kim F. Storm)
>    Date: 09 Feb 2002 00:14:55 +0100
> 
>    > I think it should at least be able to use the existing gnus and/or
>    > rmail settings (they cannot be that hard to use).
>    > You can then add extra mailboxes to check specifically.
>    > 
>    > What about these options:
>    >  - display-time-pop3-check-rmail  (nil/t, default t)
>    >  - display-time-pop3-check-gnus   (nil/t, default t)
>    >  - display-time-pop3-mail-boxes   (alist (server.passwd), default ())
> 
> Hmm, when I think about it - it would be better if those mail programs like
> RMAIL and Gnus could tells us alone if there is any new mail. Syntax of
> Gnus' mail-sources variable is pretty easy, but Gnus also support IMAP
> etc. and we should not duplicate code in display-time. What do you think?

I agree.  It seems to be the right approach for such packages to have
a hook function for display-time to check for unread mail (using whatever
method those packages support for retrieving mail).

> 
>    > With the pop3 sample code I posted some time ago, there is one serious
>    > problem: If emacs cannot connect to the pop3 server, it may hang (no
>    > user interaction) until the connect times out.  That is not
>    > satisfactory!
>    > 
>    > I don't know if this is relevant for your code (sorry, but I haven't
>    > had time to look at the code you sent me).
> 
> The same applies to pop3.el from Gnus.

In my experience [based on my own pop3 hacks], this is really, really
annoying (since the poll runs through a timer)!!!

If we want to support this in general, we must implement an async
version of open-network-stream (or add an optional arg to it to make
it async - that arg could be a function which is called when the
connection has been opened.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-10 19:57         ` Kim F. Storm
@ 2002-02-11 18:48           ` Richard Stallman
       [not found]           ` <200202111848.g1BIm0406891@aztec.santafe.edu>
  1 sibling, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2002-02-11 18:48 UTC (permalink / raw)
  Cc: emacs-devel, ding

    >    > With the pop3 sample code I posted some time ago, there is one serious
    >    > problem: If emacs cannot connect to the pop3 server, it may hang (no
    >    > user interaction) until the connect times out.  That is not
    >    > satisfactory!
    > 
    > The same applies to pop3.el from Gnus.

    If we want to support this in general, we must implement an async
    version of open-network-stream (or add an optional arg to it to make
    it async - that arg could be a function which is called when the
    connection has been opened.

Is it hanging in open-network-stream?  If so,
precisely where in open-network-stream is it waiting?
It may be a straightforward matter to implement quitting from
a few places where the waiting typically happens.
That would fix this problem.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
       [not found]           ` <200202111848.g1BIm0406891@aztec.santafe.edu>
@ 2002-02-11 23:31             ` Kim F. Storm
  2002-02-12 16:32               ` Paul Jarc
                                 ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Kim F. Storm @ 2002-02-11 23:31 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     >    > With the pop3 sample code I posted some time ago, there is one serious
>     >    > problem: If emacs cannot connect to the pop3 server, it may hang (no
>     >    > user interaction) until the connect times out.  That is not
>     >    > satisfactory!
>     > 
>     > The same applies to pop3.el from Gnus.
> 
>     If we want to support this in general, we must implement an async
>     version of open-network-stream (or add an optional arg to it to make
>     it async - that arg could be a function which is called when the
>     connection has been opened.
> 
> Is it hanging in open-network-stream?  If so,
> precisely where in open-network-stream is it waiting?
> It may be a straightforward matter to implement quitting from
> a few places where the waiting typically happens.
> That would fix this problem.

I haven't debugged this specifically with emacs, but in other
programs, it has been necessary to make connect non-blocking with
fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
know when the connect has completed (at least on GNU/Linux).

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-11 23:31             ` Kim F. Storm
@ 2002-02-12 16:32               ` Paul Jarc
  2002-02-13  0:27                 ` Kim F. Storm
  2002-02-13 15:38               ` Richard Stallman
       [not found]               ` <200202131538.g1DFcGc08698@aztec.santafe.edu>
  2 siblings, 1 reply; 16+ messages in thread
From: Paul Jarc @ 2002-02-12 16:32 UTC (permalink / raw)


storm@cua.dk (Kim F. Storm) wrote:
> I haven't debugged this specifically with emacs, but in other
> programs, it has been necessary to make connect non-blocking with
> fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
> know when the connect has completed (at least on GNU/Linux).

See also <URL:http://cr.yp.to/docs/connect.html>.


paul

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-12 16:32               ` Paul Jarc
@ 2002-02-13  0:27                 ` Kim F. Storm
  2002-02-14  3:12                   ` Richard Stallman
       [not found]                   ` <200202140312.g1E3CMf09146@aztec.santafe.edu>
  0 siblings, 2 replies; 16+ messages in thread
From: Kim F. Storm @ 2002-02-13  0:27 UTC (permalink / raw)
  Cc: ding

prj@po.cwru.edu (Paul Jarc) writes:

> storm@cua.dk (Kim F. Storm) wrote:
> > I haven't debugged this specifically with emacs, but in other
> > programs, it has been necessary to make connect non-blocking with
> > fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
> > know when the connect has completed (at least on GNU/Linux).
> 
> See also <URL:http://cr.yp.to/docs/connect.html>.

Nice summary, thanks!

In any case, I think it would make sense for open-network-stream
to have an optional 5th argument which serves two purposes:

If it is omitted or nil, the current blocking connect is used.

If it is non-nil, a non-blocking connect is attempted - if supported
by the o/s (and the emacs code) - and when the connection is
established, the argument (which must be a function) is called to
initiate using the connection.  The arguments to that function will
probably be the process and buffer (this is still TBD).

If the o/s (or emacs) does not support non-blocking connect, a
blocking connect will be performed - and the supplied function will
simply be called before open-network-stream returns  (it may need
an arg indicating whether a blocking or non-blocking connect was made
to arrange for different things to happen when open-network-stream
returns).

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-11 23:31             ` Kim F. Storm
  2002-02-12 16:32               ` Paul Jarc
@ 2002-02-13 15:38               ` Richard Stallman
       [not found]               ` <200202131538.g1DFcGc08698@aztec.santafe.edu>
  2 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2002-02-13 15:38 UTC (permalink / raw)
  Cc: emacs-devel, ding

    I haven't debugged this specifically with emacs, but in other
    programs, it has been necessary to make connect non-blocking with
    fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
    know when the connect has completed (at least on GNU/Linux).

Would you like to write that code?

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
       [not found]               ` <200202131538.g1DFcGc08698@aztec.santafe.edu>
@ 2002-02-13 22:13                 ` Kim F. Storm
  2002-02-15 10:37                   ` Richard Stallman
  2002-02-15 10:37                   ` Richard Stallman
  0 siblings, 2 replies; 16+ messages in thread
From: Kim F. Storm @ 2002-02-13 22:13 UTC (permalink / raw)
  Cc: emacs-devel, ding

Richard Stallman <rms@gnu.org> writes:

>     I haven't debugged this specifically with emacs, but in other
>     programs, it has been necessary to make connect non-blocking with
>     fcntl(s,F_SETFL,O_NONBLOCK) and then use the writefds of select to
>     know when the connect has completed (at least on GNU/Linux).
> 
> Would you like to write that code?

I could give it a try - but I can only test it on GNU/Linux,
so I will need to make some sensible choices about how to
conditionally support this feature.

I think I will need to test for the availability of HAVE_SELECT,
F_SETFL, O_NONBLOCK, and HAVE_GETPEERNAME (which is used to check
whether the connect actually succeeded).  

But that might not work on all systems, so I may need to add a
BROKEN_NON_BLOCKING_CONNECT define which can be set for systems where
this doesn't work (just to be defencive).

There is currently no HAVE_GETPEERNAME check in configure, but I
suppose that can be added (by someone who speaks autoconf :-)

-- 
Kim F. Storm  http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-13  0:27                 ` Kim F. Storm
@ 2002-02-14  3:12                   ` Richard Stallman
       [not found]                   ` <200202140312.g1E3CMf09146@aztec.santafe.edu>
  1 sibling, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2002-02-14  3:12 UTC (permalink / raw)
  Cc: emacs-devel, ding

    If it is non-nil, a non-blocking connect is attempted - if supported
    by the o/s (and the emacs code) - and when the connection is
    established, the argument (which must be a function) is called to
    initiate using the connection.

Would it make sense to use the sentinel function for this?  It already
does a similar job.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
       [not found]                   ` <200202140312.g1E3CMf09146@aztec.santafe.edu>
@ 2002-02-14  9:41                     ` Kim F. Storm
  2002-02-15 10:36                       ` Richard Stallman
  0 siblings, 1 reply; 16+ messages in thread
From: Kim F. Storm @ 2002-02-14  9:41 UTC (permalink / raw)
  Cc: emacs-devel, ding

Richard Stallman <rms@gnu.org> writes:

>     If it is non-nil, a non-blocking connect is attempted - if supported
>     by the o/s (and the emacs code) - and when the connection is
>     established, the argument (which must be a function) is called to
>     initiate using the connection.
> 
> Would it make sense to use the sentinel function for this?  It already
> does a similar job.

Yes, that sounds like a good idea.

The steps for making a non-blocking open-network-stream could be:

(defun my-stream-connected (p)
  ...)

(defun my-sentinel (p s)
  (cond
    ((equal s "connected\n") ...)
      ;; connection established
      (my-stream-connected p))
    ((equal s "failed\n") ...)
      ;; connect failed
      )
    (t ...)))

(defun ...
  (setq p (open-network-stream .... t))
  (when p
    (cond
     ((eq (process-status p) 'connecting)     ;; New return value
      ;; connecting, so set sentinel
      (set-process-sentinel p 'my-sentinel))
     ((eq (process-status p) 'open)
      ;; non-blocking connect not supported, connected
      (my-stream-connected p))
     ((eq (process-status p) 'closed)
      ;; failure...  
      ;; will this happen? -- open-network-stream should return nil instead
      (delete-process p)  ;; necessary?
      (setq p nil)))))

Doesn't seem to be too complicated to use...

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-14  9:41                     ` Kim F. Storm
@ 2002-02-15 10:36                       ` Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2002-02-15 10:36 UTC (permalink / raw)
  Cc: emacs-devel, ding

      (setq p (open-network-stream .... t))
      (when p
	(cond
	 ((eq (process-status p) 'connecting)     ;; New return value
	  ;; connecting, so set sentinel
	  (set-process-sentinel p 'my-sentinel))

There may be a timing error here: each call to process-status allows
the value to change.

Perhaps the sentinel should be passed as an argument to
open-network-stream, so that there is no time at which the
connection is open and has no sentinel.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-13 22:13                 ` Kim F. Storm
  2002-02-15 10:37                   ` Richard Stallman
@ 2002-02-15 10:37                   ` Richard Stallman
  1 sibling, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2002-02-15 10:37 UTC (permalink / raw)
  Cc: emacs-devel, ding

    I think I will need to test for the availability of HAVE_SELECT,
    F_SETFL, O_NONBLOCK, and HAVE_GETPEERNAME (which is used to check
    whether the connect actually succeeded).  

    But that might not work on all systems, so I may need to add a
    BROKEN_NON_BLOCKING_CONNECT define which can be set for systems where
    this doesn't work (just to be defencive).

Ok, that sounds fine.

    There is currently no HAVE_GETPEERNAME check in configure, but I
    suppose that can be added (by someone who speaks autoconf :-)

If that function would be in libc, it is trivial--just see how the
other such functions are handled and getpeername to the list.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

* Re: display-time, mail-icon and POP3 mailboxes
  2002-02-13 22:13                 ` Kim F. Storm
@ 2002-02-15 10:37                   ` Richard Stallman
  2002-02-15 10:37                   ` Richard Stallman
  1 sibling, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2002-02-15 10:37 UTC (permalink / raw)
  Cc: emacs-devel, ding

    I think I will need to test for the availability of HAVE_SELECT,
    F_SETFL, O_NONBLOCK, and HAVE_GETPEERNAME (which is used to check
    whether the connect actually succeeded).  

    But that might not work on all systems, so I may need to add a
    BROKEN_NON_BLOCKING_CONNECT define which can be set for systems where
    this doesn't work (just to be defencive).

Ok, that sounds fine.

    There is currently no HAVE_GETPEERNAME check in configure, but I
    suppose that can be added (by someone who speaks autoconf :-)

If that function would be in libc, it is trivial--just see how the
other such functions are handled and getpeername to the list.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


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

end of thread, other threads:[~2002-02-15 10:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-07  9:54 display-time, mail-icon and POP3 mailboxes Pavel Janík
2002-02-08 13:57 ` Richard Stallman
2002-02-08 20:54   ` Pavel Janík
2002-02-08 23:14     ` Kim F. Storm
     [not found]       ` <m3pu3dqizu.fsf@Janik.cz>
2002-02-10 19:57         ` Kim F. Storm
2002-02-11 18:48           ` Richard Stallman
     [not found]           ` <200202111848.g1BIm0406891@aztec.santafe.edu>
2002-02-11 23:31             ` Kim F. Storm
2002-02-12 16:32               ` Paul Jarc
2002-02-13  0:27                 ` Kim F. Storm
2002-02-14  3:12                   ` Richard Stallman
     [not found]                   ` <200202140312.g1E3CMf09146@aztec.santafe.edu>
2002-02-14  9:41                     ` Kim F. Storm
2002-02-15 10:36                       ` Richard Stallman
2002-02-13 15:38               ` Richard Stallman
     [not found]               ` <200202131538.g1DFcGc08698@aztec.santafe.edu>
2002-02-13 22:13                 ` Kim F. Storm
2002-02-15 10:37                   ` Richard Stallman
2002-02-15 10:37                   ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.