From: "Bojan Petrovic" <bojan_petrovic@fastmail.fm>
To: ding@lists.math.uh.edu
Subject: Re: pop3.el: Display the size of the message being fetched (POP3 LIST command)
Date: Sun, 08 Feb 2009 00:35:54 +0100 [thread overview]
Message-ID: <1234049754.2390.1299107629@webmail.messagingengine.com> (raw)
> That looks useful; have you signed papers to contribute? Also, can you
> add a few lines to the manual listing the new variable?
I'd be glad to sign them, but I am not familiar with procedure.
I'm sending the changelog, the texinfo patch, and a slightly revised
previous patch: I've changed the commentary to reflect the addition of
pop3-list, the docstring of pop3-list and the version number in
defcustom (23.1).
Please tell me if any changes are needed.
Regards,
Bojan
--snip----------------------------------------------------
2009-02-07 Bojan Petrovic <bpetrovi@f.bg.ac.rs>
* gnus.texi (Mail Source Specifiers): Describe
`pop3-display-message-size-flag' and add it to the index.
2009-02-07 Bojan Petrovic <bpetrovi@f.bg.ac.rs>
* pop3.el (pop3-list): Implement the POP3 LIST command.
(global): Change the commentary to reflect the above change.
(pop3-movemail): Optionally display the size of the message that
is being fetched.
(pop3-display-message-size-flag): New variable.
--snip----------------------------------------------------
Index: gnus.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/misc/gnus.texi,v
retrieving revision 1.40
diff -u -r1.40 gnus.texi
--- gnus.texi 19 Jan 2009 01:06:25 -0000 1.40
+++ gnus.texi 7 Feb 2009 21:57:47 -0000
@@ -15224,6 +15224,11 @@
do not, then you may get duplicate mails or the whole thing can fall
apart and leave you with a corrupt mailbox.
+@vindex pop3-display-message-size-flag
+If @code{pop3-display-message-size-flag} is non-@code{nil}, the size
+in kilobytes of the message that is being fetched will be displayed in
+the echo area.
+
Here are some examples for getting mail from a @acronym{POP} server.
Fetch from the default @acronym{POP} server, using the default user
name, and default fetcher:
--snip----------------------------------------------------
Index: pop3.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/gnus/pop3.el,v
retrieving revision 1.50
diff -u -r1.50 pop3.el
--- pop3.el 9 Jan 2009 03:01:52 -0000 1.50
+++ pop3.el 7 Feb 2009 21:51:15 -0000
@@ -24,9 +24,8 @@
;;; Commentary:
-;; Most of the standard Post Office Protocol version 3 (RFC 1460) commands
-;; are implemented. The LIST command has not been implemented due to lack
-;; of actual usefulness.
+;; The entire Post Office Protocol version 3 (RFC 1460) minimal
+;; command set and the optional APOP command are implemented.
;; The optional POP3 command TOP has not been implemented.
;; This program was inspired by Kyle E. Jones's vm-pop program.
@@ -98,6 +97,12 @@
:type 'boolean
:group 'pop3)
+(defcustom pop3-display-message-size-flag t
+ "*If non-nil, display the size of the message that is being fetched."
+ :version "23.1" ;; No Gnus
+ :type 'boolean
+ :group 'pop3)
+
(defvar pop3-timestamp nil
"Timestamp returned when initially connected to the POP server.
Used for APOP authentication.")
@@ -135,6 +140,7 @@
(crashbuf (get-buffer-create " *pop3-retr*"))
(n 1)
message-count
+ message-sizes
(pop3-password pop3-password))
;; for debugging only
(if pop3-debug (switch-to-buffer (process-buffer process)))
@@ -149,10 +155,18 @@
(pop3-pass process))
(t (error "Invalid POP3 authentication scheme")))
(setq message-count (car (pop3-stat process)))
+ (when (and pop3-display-message-size-flag
+ (> message-count 0))
+ (setq message-sizes (pop3-list process)))
(unwind-protect
(while (<= n message-count)
- (message "Retrieving message %d of %d from %s..."
- n message-count pop3-mailhost)
+ (if pop3-display-message-size-flag
+ (message "Retrieving message %d of %d from %s... (%.1fk)"
+ n message-count pop3-mailhost
+ (/ (cdr (assoc n message-sizes))
+ 1024.0))
+ (message "Retrieving message %d of %d from %s..."
+ n message-count pop3-mailhost))
(pop3-retr process n crashbuf)
(save-excursion
(set-buffer crashbuf)
@@ -451,8 +465,27 @@
))
(defun pop3-list (process &optional msg)
- "Scan listing of available messages.
-This function currently does nothing.")
+ "Return an alist of (MESSAGE-ID . SIZE) pairs.
+If MSG is supplied, return the size of the message-id MSG"
+ (pop3-send-command process (if msg
+ (format "LIST %d" msg)
+ "LIST"))
+ (let ((response (pop3-read-response process t)))
+ (if msg
+ (string-to-number (nth 2 (split-string response " ")))
+ (let ((start pop3-read-point) end)
+ (save-excursion
+ (set-buffer (process-buffer process))
+ (while (not (re-search-forward "^\\.\r\n" nil t))
+ (pop3-accept-process-output process)
+ (goto-char start))
+ (setq pop3-read-point (point-marker))
+ (goto-char (match-beginning 0))
+ (setq end (point-marker))
+ (mapcar #'(lambda (s) (let ((split (split-string s " ")))
+ (cons (string-to-number (nth 0 split))
+ (string-to-number (nth 1 split)))))
+ (split-string (buffer-substring start end) "\r\n" t)))))))
(defun pop3-retr (process msg crashbuf)
"Retrieve message-id MSG to buffer CRASHBUF."
--
http://www.fastmail.fm - The professional email service
next reply other threads:[~2009-02-07 23:35 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-07 23:35 Bojan Petrovic [this message]
2009-02-09 20:11 ` Ted Zlatanov
2009-02-09 22:48 ` Reiner Steib
2009-02-09 23:07 ` Katsumi Yamaoka
2009-02-09 23:38 ` Bojan Petrovic
2009-02-10 14:44 ` Ted Zlatanov
2009-02-10 22:18 ` Reiner Steib
2009-02-11 1:08 ` Bojan Petrovic
2009-04-01 21:21 ` Bojan Petrovic
2009-04-13 15:54 ` Ted Zlatanov
2009-04-16 19:06 ` Reiner Steib
2009-04-16 20:08 ` Ted Zlatanov
2009-08-04 14:32 ` Ted Zlatanov
2009-12-25 20:07 ` Bojan Petrovic
2010-01-05 19:40 ` Ted Zlatanov
2010-01-12 17:16 ` Reiner Steib
2010-01-13 21:13 ` Gnus VCS issues (was: pop3.el: Display the size of the message being fetched (POP3 LIST command)) Ted Zlatanov
2010-01-14 16:40 ` Gnus VCS issues Bojan Nikolic
2010-01-14 19:49 ` Reiner Steib
2010-01-19 22:04 ` Lars Magne Ingebrigtsen
2010-01-20 15:05 ` Ted Zlatanov
2010-01-20 21:48 ` Andreas Schwab
2010-01-20 22:19 ` Adam Sjøgren
2010-01-20 22:36 ` Reiner Steib
2010-01-20 23:31 ` Adam Sjøgren
2010-01-22 7:11 ` Christian
2010-01-22 16:39 ` Adam Sjøgren
2010-01-25 6:15 ` Miles Bader
2010-01-28 19:16 ` Florian Weimer
2010-01-29 18:39 ` Ted Zlatanov
2010-02-22 20:49 ` Ted Zlatanov
[not found] ` <m3mxytge3r.fsf@quimbies.gnus.org>
2010-03-01 14:28 ` Ted Zlatanov
2010-03-22 13:08 ` Ted Zlatanov
2010-02-01 22:56 ` Byung-Hee HWANG
2010-02-22 21:56 ` Didier Verna
2010-01-20 23:17 ` Andreas Schwab
2010-01-25 6:16 ` Miles Bader
2010-01-20 23:51 ` David Engster
2010-01-21 0:11 ` Adam Sjøgren
2010-01-25 6:20 ` Miles Bader
2010-01-25 11:10 ` David Engster
2010-01-25 13:27 ` Andreas Schwab
2010-03-20 15:21 ` pop3.el: Display the size of the message being fetched (POP3 LIST command) Ted Zlatanov
-- strict thread matches above, loose matches on Subject: below --
2009-02-06 14:34 Bojan Petrovic
2009-02-06 20:44 ` Ted Zlatanov
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=1234049754.2390.1299107629@webmail.messagingengine.com \
--to=bojan_petrovic@fastmail.fm \
--cc=ding@lists.math.uh.edu \
/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).