2010-09-18 10:02:19 +00:00
|
|
|
;;; nnimap.el --- IMAP interface for Gnus
|
2005-08-06 19:51:42 +00:00
|
|
|
|
2011-01-25 04:08:28 +00:00
|
|
|
;; Copyright (C) 2010-2011 Free Software Foundation, Inc.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
|
|
|
|
;; Simon Josefsson <simon@josefsson.org>
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:56:49 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-09-19 13:40:08 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:56:49 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-05-06 03:56:49 +00:00
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2000-09-19 13:40:08 +00:00
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 03:56:49 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
;; nnimap interfaces Gnus with IMAP servers.
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2010-10-11 23:29:33 +00:00
|
|
|
;; For Emacs <22.2 and XEmacs.
|
|
|
|
(eval-and-compile
|
|
|
|
(unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
|
|
|
|
|
Stop message.el from loading about 40 libraries it doesn't always need.
The general approach is to autoload rather than require, and to
require in the specific functions rather than the file. (Bug#5642)
* url/url.el: Move mailcap require earlier in the file.
* gnus/gmm-utils.el: Don't require wid-edit.
(widget-create-child-value, widget-convert, widget-default-get):
Autoload.
* gnus/gnus-util.el: Don't require time-date, netrc.
(message-fetch-field, gnus-group-name-decode): Declare rather than
autoloading.
(gnus-fetch-field): Require message.
(gnus-decode-newsgroups): Require gnus-group.
* gnus/ietf-drums.el: Don't require time-date.
* gnus/message.el: Don't require hashcash, canlock, ecomplete.
Do require mail-utils. Require nnheader only when compiling.
(smtpmail-default-smtp-server): Remove declaration.
(message-send-mail-function): Check smtpmail-default-smtp-server
is bound rather than requiring smtpmail.
(message-auto-save-directory, message-insert-signature): Use
expand-file-name rather than nnheader-concat.
(nnheader-insert-file-contents): Autoload.
(hashcash-wait-async): Declare.
(message-send-mail): Only call gnus-setup-posting-charset if
gnus-group-posting-charset-alist is bound. Require hashcash if needed.
(message-send-mail-with-sendmail): Require sendmail.
(canlock-password, canlock-password-for-verify): Declare.
(message-canlock-password): Require canlock.
(nnheader-get-report): Autoload.
(gnus-setup-posting-charset): Declare.
(message-send-news): Require gnus-msg.
(message-make-references, message-make-in-reply-to): Use mail-header-id
rather than the alias mail-header-message-id.
(ecomplete-add-item, ecomplete-save): Declare.
(message-put-addresses-in-ecomplete): Require ecomplete.
(ecomplete-display-matches): Autoload.
* gnus/mm-decode.el: Don't require mailcap, gnus-util.
(gnus-map-function, gnus-replace-in-string, gnus-read-shell-command)
(message-fetch-field, mailcap-parse-mailcaps, mailcap-mime-info):
Autoload.
(mailcap-mime-extensions): Declare.
* gnus/mm-encode.el: Don't require mailcap.
(mailcap-extension-to-mime): Autoload.
* gnus/mml-sec.el: Don't require password-cache.
* gnus/mml.el (gnus-setup-posting-charset): Declare rather than autoload.
(mailcap-parse-mimetypes, mailcap-mime-types): Declare.
(mml-minibuffer-read-type): Require mailcap.
(mml-preview): Require gnus-msg.
* gnus/mml1991.el: Require password-cache.
(password-cache-expiry): Remove declaration.
* gnus/mml2015.el: Require password-cache.
(password-cache-expiry): Remove declaration.
* gnus/nneething.el (mailcap): Require mailcap.
* gnus/nnheader.el: (declare-function): Add compatibility stub.
(message-remove-header): Declare rather than autoload.
(nnheader-replace-header): Require message.
* gnus/nnimap.el (declare-function): Add compatibility stub.
(netrc-parse, netrc-machine-user-or-password): Declare.
(nnimap-open-connection): Require netrc.
* gnus/nntp.el (declare-function): Add compatibility stub.
(netrc-parse, netrc-machine, netrc-get): Declare.
(nntp-send-authinfo): Require netrc.
* gnus/rfc2047.el: Don't require qp.
(quoted-printable-encode-region, quoted-printable-decode-string):
Autoload.
* gnus/sieve-mode.el: Don't require easymenu.
(easy-menu-add-item): Autoload it.
* gnus/spam-stat.el (time-to-number-of-days): Autoload it.
* password-cache.el (password-cache, password-cache-expiry):
Autoload.
2010-03-19 02:55:37 +00:00
|
|
|
(eval-and-compile
|
2011-04-02 23:41:03 +00:00
|
|
|
(require 'nnheader)
|
|
|
|
;; In Emacs 24, `open-protocol-stream' is an autoloaded alias for
|
|
|
|
;; `make-network-stream'.
|
|
|
|
(unless (fboundp 'open-protocol-stream)
|
|
|
|
(require 'proto-stream)))
|
Stop message.el from loading about 40 libraries it doesn't always need.
The general approach is to autoload rather than require, and to
require in the specific functions rather than the file. (Bug#5642)
* url/url.el: Move mailcap require earlier in the file.
* gnus/gmm-utils.el: Don't require wid-edit.
(widget-create-child-value, widget-convert, widget-default-get):
Autoload.
* gnus/gnus-util.el: Don't require time-date, netrc.
(message-fetch-field, gnus-group-name-decode): Declare rather than
autoloading.
(gnus-fetch-field): Require message.
(gnus-decode-newsgroups): Require gnus-group.
* gnus/ietf-drums.el: Don't require time-date.
* gnus/message.el: Don't require hashcash, canlock, ecomplete.
Do require mail-utils. Require nnheader only when compiling.
(smtpmail-default-smtp-server): Remove declaration.
(message-send-mail-function): Check smtpmail-default-smtp-server
is bound rather than requiring smtpmail.
(message-auto-save-directory, message-insert-signature): Use
expand-file-name rather than nnheader-concat.
(nnheader-insert-file-contents): Autoload.
(hashcash-wait-async): Declare.
(message-send-mail): Only call gnus-setup-posting-charset if
gnus-group-posting-charset-alist is bound. Require hashcash if needed.
(message-send-mail-with-sendmail): Require sendmail.
(canlock-password, canlock-password-for-verify): Declare.
(message-canlock-password): Require canlock.
(nnheader-get-report): Autoload.
(gnus-setup-posting-charset): Declare.
(message-send-news): Require gnus-msg.
(message-make-references, message-make-in-reply-to): Use mail-header-id
rather than the alias mail-header-message-id.
(ecomplete-add-item, ecomplete-save): Declare.
(message-put-addresses-in-ecomplete): Require ecomplete.
(ecomplete-display-matches): Autoload.
* gnus/mm-decode.el: Don't require mailcap, gnus-util.
(gnus-map-function, gnus-replace-in-string, gnus-read-shell-command)
(message-fetch-field, mailcap-parse-mailcaps, mailcap-mime-info):
Autoload.
(mailcap-mime-extensions): Declare.
* gnus/mm-encode.el: Don't require mailcap.
(mailcap-extension-to-mime): Autoload.
* gnus/mml-sec.el: Don't require password-cache.
* gnus/mml.el (gnus-setup-posting-charset): Declare rather than autoload.
(mailcap-parse-mimetypes, mailcap-mime-types): Declare.
(mml-minibuffer-read-type): Require mailcap.
(mml-preview): Require gnus-msg.
* gnus/mml1991.el: Require password-cache.
(password-cache-expiry): Remove declaration.
* gnus/mml2015.el: Require password-cache.
(password-cache-expiry): Remove declaration.
* gnus/nneething.el (mailcap): Require mailcap.
* gnus/nnheader.el: (declare-function): Add compatibility stub.
(message-remove-header): Declare rather than autoload.
(nnheader-replace-header): Require message.
* gnus/nnimap.el (declare-function): Add compatibility stub.
(netrc-parse, netrc-machine-user-or-password): Declare.
(nnimap-open-connection): Require netrc.
* gnus/nntp.el (declare-function): Add compatibility stub.
(netrc-parse, netrc-machine, netrc-get): Declare.
(nntp-send-authinfo): Require netrc.
* gnus/rfc2047.el: Don't require qp.
(quoted-printable-encode-region, quoted-printable-decode-string):
Autoload.
* gnus/sieve-mode.el: Don't require easymenu.
(easy-menu-add-item): Autoload it.
* gnus/spam-stat.el (time-to-number-of-days): Autoload it.
* password-cache.el (password-cache, password-cache-expiry):
Autoload.
2010-03-19 02:55:37 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(eval-when-compile
|
|
|
|
(require 'cl))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-18 20:27:52 +00:00
|
|
|
(require 'nnheader)
|
|
|
|
(require 'gnus-util)
|
|
|
|
(require 'gnus)
|
|
|
|
(require 'nnoo)
|
2010-09-18 10:02:19 +00:00
|
|
|
(require 'netrc)
|
2010-09-27 13:22:21 +00:00
|
|
|
(require 'utf7)
|
2010-10-01 00:25:50 +00:00
|
|
|
(require 'tls)
|
2010-09-21 23:13:46 +00:00
|
|
|
(require 'parse-time)
|
2010-11-01 02:07:01 +00:00
|
|
|
(require 'nnmail)
|
|
|
|
|
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
|
|
|
(autoload 'auth-source-forget+ "auth-source")
|
|
|
|
(autoload 'auth-source-search "auth-source")
|
2010-09-28 05:12:21 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(nnoo-declare nnimap)
|
|
|
|
|
|
|
|
(defvoo nnimap-address nil
|
2010-09-18 10:02:19 +00:00
|
|
|
"The address of the IMAP server.")
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2011-04-22 01:01:32 +00:00
|
|
|
(defvoo nnimap-user nil
|
|
|
|
"Username to use for authentication to the IMAP server.")
|
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(defvoo nnimap-server-port nil
|
2010-09-18 10:02:19 +00:00
|
|
|
"The IMAP port used.
|
|
|
|
If nnimap-stream is `ssl', this will default to `imaps'. If not,
|
|
|
|
it will default to `imap'.")
|
|
|
|
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
(defvoo nnimap-stream 'undecided
|
2011-03-30 02:21:28 +00:00
|
|
|
"How nnimap talks to the IMAP server.
|
|
|
|
The value should be either `undecided', `ssl' or `tls',
|
|
|
|
`network', `starttls', `plain', or `shell'.
|
|
|
|
|
|
|
|
If the value is `undecided', nnimap tries `ssl' first, then falls
|
|
|
|
back on `network'.")
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defvoo nnimap-shell-program (if (boundp 'imap-shell-program)
|
|
|
|
(if (listp imap-shell-program)
|
|
|
|
(car imap-shell-program)
|
|
|
|
imap-shell-program)
|
|
|
|
"ssh %s imapd"))
|
|
|
|
|
|
|
|
(defvoo nnimap-inbox nil
|
2011-02-22 13:31:15 +00:00
|
|
|
"The mail box where incoming mail arrives and should be split out of.
|
|
|
|
For example, \"INBOX\".")
|
2010-09-18 10:02:19 +00:00
|
|
|
|
2010-09-26 04:03:19 +00:00
|
|
|
(defvoo nnimap-split-methods nil
|
|
|
|
"How mail is split.
|
2011-02-22 13:31:15 +00:00
|
|
|
Uses the same syntax as `nnmail-split-methods'.")
|
2010-09-26 04:03:19 +00:00
|
|
|
|
2010-10-01 00:25:50 +00:00
|
|
|
(defvoo nnimap-split-fancy nil
|
2011-02-22 13:31:15 +00:00
|
|
|
"Uses the same syntax as `nnmail-split-fancy'.")
|
2010-10-01 00:25:50 +00:00
|
|
|
|
2010-10-30 05:59:34 +00:00
|
|
|
(defvoo nnimap-unsplittable-articles '(%Deleted %Seen)
|
|
|
|
"Articles with the flags in the list will not be considered when splitting.")
|
|
|
|
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
(make-obsolete-variable 'nnimap-split-rule "see `nnimap-split-methods'"
|
2010-10-01 00:25:50 +00:00
|
|
|
"Emacs 24.1")
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
|
2010-09-20 00:36:54 +00:00
|
|
|
(defvoo nnimap-authenticator nil
|
|
|
|
"How nnimap authenticate itself to the server.
|
|
|
|
Possible choices are nil (use default methods) or `anonymous'.")
|
|
|
|
|
2010-09-23 00:30:37 +00:00
|
|
|
(defvoo nnimap-expunge t
|
|
|
|
"If non-nil, expunge articles after deleting them.
|
|
|
|
This is always done if the server supports UID EXPUNGE, but it's
|
|
|
|
not done by default on servers that doesn't support that command.")
|
|
|
|
|
2010-09-26 04:03:19 +00:00
|
|
|
(defvoo nnimap-streaming t
|
|
|
|
"If non-nil, try to use streaming commands with IMAP servers.
|
|
|
|
Switching this off will make nnimap slower, but it helps with
|
|
|
|
some servers.")
|
2010-09-21 23:13:46 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defvoo nnimap-connection-alist nil)
|
2010-09-18 23:36:29 +00:00
|
|
|
|
|
|
|
(defvoo nnimap-current-infos nil)
|
|
|
|
|
2010-09-27 23:07:47 +00:00
|
|
|
(defvoo nnimap-fetch-partial-articles nil
|
|
|
|
"If non-nil, Gnus will fetch partial articles.
|
|
|
|
If t, nnimap will fetch only the first part. If a string, it
|
|
|
|
will fetch all parts that have types that match that string. A
|
|
|
|
likely value would be \"text/\" to automatically fetch all
|
|
|
|
textual parts.")
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defvar nnimap-process nil)
|
|
|
|
|
|
|
|
(defvar nnimap-status-string "")
|
2004-09-04 13:13:48 +00:00
|
|
|
|
|
|
|
(defvar nnimap-split-download-body-default nil
|
|
|
|
"Internal variable with default value for `nnimap-split-download-body'.")
|
|
|
|
|
2010-09-24 22:33:34 +00:00
|
|
|
(defvar nnimap-keepalive-timer nil)
|
|
|
|
(defvar nnimap-process-buffers nil)
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defstruct nnimap
|
2010-09-24 22:33:34 +00:00
|
|
|
group process commands capabilities select-result newlinep server
|
2011-01-25 23:51:40 +00:00
|
|
|
last-command-time greeting examined stream-type)
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defvar nnimap-object nil)
|
|
|
|
|
|
|
|
(defvar nnimap-mark-alist
|
2010-09-23 00:30:37 +00:00
|
|
|
'((read "\\Seen" %Seen)
|
|
|
|
(tick "\\Flagged" %Flagged)
|
|
|
|
(reply "\\Answered" %Answered)
|
2010-09-18 10:02:19 +00:00
|
|
|
(expire "gnus-expire")
|
|
|
|
(dormant "gnus-dormant")
|
|
|
|
(score "gnus-score")
|
|
|
|
(save "gnus-save")
|
|
|
|
(download "gnus-download")
|
|
|
|
(forward "gnus-forward")))
|
|
|
|
|
2010-12-16 22:22:28 +00:00
|
|
|
(defvar nnimap-quirks
|
|
|
|
'(("QRESYNC" "Zimbra" "QRESYNC ")))
|
|
|
|
|
2011-02-14 04:23:59 +00:00
|
|
|
(defvar nnimap-inhibit-logging nil)
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-buffer ()
|
|
|
|
(nnimap-find-process-buffer nntp-server-buffer))
|
|
|
|
|
2010-10-24 22:32:38 +00:00
|
|
|
(defun nnimap-header-parameters ()
|
|
|
|
(format "(UID RFC822.SIZE BODYSTRUCTURE %s)"
|
|
|
|
(format
|
|
|
|
(if (nnimap-ver4-p)
|
|
|
|
"BODY.PEEK[HEADER.FIELDS %s]"
|
|
|
|
"RFC822.HEADER.LINES %s")
|
|
|
|
(append '(Subject From Date Message-Id
|
|
|
|
References In-Reply-To Xref)
|
|
|
|
nnmail-extra-headers))))
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-retrieve-headers (articles &optional group server fetch-old)
|
2000-09-19 13:40:08 +00:00
|
|
|
(with-current-buffer nntp-server-buffer
|
2010-09-18 10:02:19 +00:00
|
|
|
(erase-buffer)
|
|
|
|
(when (nnimap-possibly-change-group group server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(erase-buffer)
|
|
|
|
(nnimap-wait-for-response
|
|
|
|
(nnimap-send-command
|
|
|
|
"UID FETCH %s %s"
|
|
|
|
(nnimap-article-ranges (gnus-compress-sequence articles))
|
2010-10-24 22:32:38 +00:00
|
|
|
(nnimap-header-parameters))
|
2010-09-18 10:02:19 +00:00
|
|
|
t)
|
2010-12-17 22:45:16 +00:00
|
|
|
(nnimap-transform-headers)
|
|
|
|
(nnheader-remove-cr-followed-by-lf))
|
2010-09-18 10:02:19 +00:00
|
|
|
(insert-buffer-substring
|
|
|
|
(nnimap-find-process-buffer (current-buffer))))
|
2010-09-23 23:14:02 +00:00
|
|
|
'headers))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-transform-headers ()
|
|
|
|
(goto-char (point-min))
|
2010-09-23 23:14:02 +00:00
|
|
|
(let (article bytes lines size string)
|
2010-09-18 10:02:19 +00:00
|
|
|
(block nil
|
|
|
|
(while (not (eobp))
|
2011-05-30 22:11:52 +00:00
|
|
|
(while (not (looking-at "\\* [0-9]+ FETCH.+UID \\([0-9]+\\)"))
|
2010-09-18 10:02:19 +00:00
|
|
|
(delete-region (point) (progn (forward-line 1) (point)))
|
|
|
|
(when (eobp)
|
|
|
|
(return)))
|
2010-09-23 23:14:02 +00:00
|
|
|
(setq article (match-string 1))
|
2010-11-25 23:43:16 +00:00
|
|
|
;; Unfold quoted {number} strings.
|
|
|
|
(while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r?\n"
|
|
|
|
(1+ (line-end-position)) t)
|
|
|
|
(setq size (string-to-number (match-string 1)))
|
|
|
|
(delete-region (+ (match-beginning 0) 2) (point))
|
|
|
|
(setq string (buffer-substring (point) (+ (point) size)))
|
|
|
|
(delete-region (point) (+ (point) size))
|
|
|
|
(insert (format "%S" string)))
|
2010-09-23 23:14:02 +00:00
|
|
|
(setq bytes (nnimap-get-length)
|
2010-09-18 10:02:19 +00:00
|
|
|
lines nil)
|
|
|
|
(beginning-of-line)
|
2010-09-20 23:08:33 +00:00
|
|
|
(setq size
|
|
|
|
(and (re-search-forward "RFC822.SIZE \\([0-9]+\\)"
|
|
|
|
(line-end-position)
|
|
|
|
t)
|
|
|
|
(match-string 1)))
|
|
|
|
(beginning-of-line)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when (search-forward "BODYSTRUCTURE" (line-end-position) t)
|
2010-09-23 23:14:02 +00:00
|
|
|
(let ((structure (ignore-errors
|
|
|
|
(read (current-buffer)))))
|
2010-09-18 10:02:19 +00:00
|
|
|
(while (and (consp structure)
|
|
|
|
(not (stringp (car structure))))
|
|
|
|
(setq structure (car structure)))
|
|
|
|
(setq lines (nth 7 structure))))
|
|
|
|
(delete-region (line-beginning-position) (line-end-position))
|
|
|
|
(insert (format "211 %s Article retrieved." article))
|
|
|
|
(forward-line 1)
|
2010-09-20 23:08:33 +00:00
|
|
|
(when size
|
|
|
|
(insert (format "Chars: %s\n" size)))
|
2010-09-18 10:02:19 +00:00
|
|
|
(when lines
|
|
|
|
(insert (format "Lines: %s\n" lines)))
|
2010-10-24 22:32:38 +00:00
|
|
|
(unless (re-search-forward "^\r$" nil t)
|
|
|
|
(goto-char (point-max)))
|
2010-09-18 10:02:19 +00:00
|
|
|
(delete-region (line-beginning-position) (line-end-position))
|
|
|
|
(insert ".")
|
|
|
|
(forward-line 1)))))
|
|
|
|
|
2010-11-25 23:05:10 +00:00
|
|
|
(defun nnimap-unfold-quoted-lines ()
|
|
|
|
;; Unfold quoted {number} strings.
|
2010-11-25 23:43:16 +00:00
|
|
|
(let (size string)
|
|
|
|
(while (re-search-forward " {\\([0-9]+\\)}\r?\n" nil t)
|
|
|
|
(setq size (string-to-number (match-string 1)))
|
|
|
|
(delete-region (1+ (match-beginning 0)) (point))
|
|
|
|
(setq string (buffer-substring (point) (+ (point) size)))
|
|
|
|
(delete-region (point) (+ (point) size))
|
|
|
|
(insert (format "%S" string)))))
|
2010-11-25 23:05:10 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-get-length ()
|
|
|
|
(and (re-search-forward "{\\([0-9]+\\)}" (line-end-position) t)
|
|
|
|
(string-to-number (match-string 1))))
|
|
|
|
|
|
|
|
(defun nnimap-article-ranges (ranges)
|
|
|
|
(let (result)
|
|
|
|
(cond
|
|
|
|
((numberp ranges)
|
|
|
|
(number-to-string ranges))
|
|
|
|
((numberp (cdr ranges))
|
|
|
|
(format "%d:%d" (car ranges) (cdr ranges)))
|
|
|
|
(t
|
|
|
|
(dolist (elem ranges)
|
|
|
|
(push
|
|
|
|
(if (consp elem)
|
|
|
|
(format "%d:%d" (car elem) (cdr elem))
|
|
|
|
(number-to-string elem))
|
|
|
|
result))
|
|
|
|
(mapconcat #'identity (nreverse result) ",")))))
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-open-server (server &optional defs)
|
2000-09-19 13:40:08 +00:00
|
|
|
(if (nnimap-server-opened server)
|
|
|
|
t
|
|
|
|
(unless (assq 'nnimap-address defs)
|
2010-09-18 10:02:19 +00:00
|
|
|
(setq defs (append defs (list (list 'nnimap-address server)))))
|
2000-09-19 13:40:08 +00:00
|
|
|
(nnoo-change-server 'nnimap server defs)
|
2010-09-18 10:02:19 +00:00
|
|
|
(or (nnimap-find-connection nntp-server-buffer)
|
|
|
|
(nnimap-open-connection nntp-server-buffer))))
|
|
|
|
|
|
|
|
(defun nnimap-make-process-buffer (buffer)
|
|
|
|
(with-current-buffer
|
|
|
|
(generate-new-buffer (format "*nnimap %s %s %s*"
|
|
|
|
nnimap-address nnimap-server-port
|
|
|
|
(gnus-buffer-exists-p buffer)))
|
|
|
|
(mm-disable-multibyte)
|
|
|
|
(buffer-disable-undo)
|
|
|
|
(gnus-add-buffer)
|
|
|
|
(set (make-local-variable 'after-change-functions) nil)
|
2010-09-23 00:30:37 +00:00
|
|
|
(set (make-local-variable 'nnimap-object)
|
|
|
|
(make-nnimap :server (nnoo-current-server 'nnimap)))
|
2010-09-18 10:02:19 +00:00
|
|
|
(push (list buffer (current-buffer)) nnimap-connection-alist)
|
2010-09-24 22:33:34 +00:00
|
|
|
(push (current-buffer) nnimap-process-buffers)
|
2010-09-18 10:02:19 +00:00
|
|
|
(current-buffer)))
|
|
|
|
|
2011-04-22 01:01:32 +00:00
|
|
|
(defun nnimap-credentials (address ports user)
|
2011-03-09 13:39:35 +00:00
|
|
|
(let* ((auth-source-creation-prompts
|
|
|
|
'((user . "IMAP user at %h: ")
|
|
|
|
(secret . "IMAP password for %u@%h: ")))
|
|
|
|
(found (nth 0 (auth-source-search :max 1
|
|
|
|
:host address
|
|
|
|
:port ports
|
2011-04-22 01:01:32 +00:00
|
|
|
:user user
|
2011-03-09 13:39:35 +00:00
|
|
|
:require '(:user :secret)
|
|
|
|
:create t))))
|
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
|
|
|
(if found
|
2011-02-18 00:41:50 +00:00
|
|
|
(list (plist-get found :user)
|
|
|
|
(let ((secret (plist-get found :secret)))
|
|
|
|
(if (functionp secret)
|
|
|
|
(funcall secret)
|
2011-03-09 13:39:35 +00:00
|
|
|
secret))
|
|
|
|
(plist-get found :save-function))
|
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
|
|
|
nil)))
|
2010-09-18 23:36:29 +00:00
|
|
|
|
2010-09-24 22:33:34 +00:00
|
|
|
(defun nnimap-keepalive ()
|
|
|
|
(let ((now (current-time)))
|
|
|
|
(dolist (buffer nnimap-process-buffers)
|
|
|
|
(when (buffer-name buffer)
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(when (and nnimap-object
|
|
|
|
(nnimap-last-command-time nnimap-object)
|
2010-11-01 02:07:01 +00:00
|
|
|
(> (gnus-float-time
|
2010-09-24 22:33:34 +00:00
|
|
|
(time-subtract
|
|
|
|
now
|
|
|
|
(nnimap-last-command-time nnimap-object)))
|
|
|
|
;; More than five minutes since the last command.
|
|
|
|
(* 5 60)))
|
|
|
|
(nnimap-send-command "NOOP")))))))
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-open-connection (buffer)
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
;; Be backwards-compatible -- the earlier value of nnimap-stream was
|
|
|
|
;; `ssl' when nnimap-server-port was nil. Sort of.
|
|
|
|
(when (and nnimap-server-port
|
|
|
|
(eq nnimap-stream 'undecided))
|
|
|
|
(setq nnimap-stream 'ssl))
|
|
|
|
(let ((stream
|
|
|
|
(if (eq nnimap-stream 'undecided)
|
2011-03-30 02:21:28 +00:00
|
|
|
(loop for type in '(ssl network)
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
for stream = (let ((nnimap-stream type))
|
|
|
|
(nnimap-open-connection-1 buffer))
|
|
|
|
while (eq stream 'no-connect)
|
|
|
|
finally (return stream))
|
|
|
|
(nnimap-open-connection-1 buffer))))
|
|
|
|
(if (eq stream 'no-connect)
|
|
|
|
nil
|
|
|
|
stream)))
|
|
|
|
|
|
|
|
(defun nnimap-open-connection-1 (buffer)
|
2010-09-24 22:33:34 +00:00
|
|
|
(unless nnimap-keepalive-timer
|
|
|
|
(setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15)
|
|
|
|
'nnimap-keepalive)))
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
(with-current-buffer (nnimap-make-process-buffer buffer)
|
|
|
|
(let* ((coding-system-for-read 'binary)
|
|
|
|
(coding-system-for-write 'binary)
|
|
|
|
(port nil)
|
|
|
|
(ports
|
2010-10-10 22:48:40 +00:00
|
|
|
(cond
|
2011-03-30 02:21:28 +00:00
|
|
|
((memq nnimap-stream '(network plain starttls))
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
(nnheader-message 7 "Opening connection to %s..."
|
|
|
|
nnimap-address)
|
2011-02-25 12:53:00 +00:00
|
|
|
'("imap" "143"))
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
((eq nnimap-stream 'shell)
|
|
|
|
(nnheader-message 7 "Opening connection to %s via shell..."
|
|
|
|
nnimap-address)
|
|
|
|
'("imap"))
|
|
|
|
((memq nnimap-stream '(ssl tls))
|
|
|
|
(nnheader-message 7 "Opening connection to %s via tls..."
|
|
|
|
nnimap-address)
|
2011-02-25 12:53:00 +00:00
|
|
|
'("imaps" "imap" "993" "143"))
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
(t
|
|
|
|
(error "Unknown stream type: %s" nnimap-stream))))
|
|
|
|
login-result credentials)
|
|
|
|
(when nnimap-server-port
|
2011-02-25 12:53:00 +00:00
|
|
|
(push nnimap-server-port ports))
|
2011-03-26 23:18:42 +00:00
|
|
|
(let* ((stream-list
|
|
|
|
(open-protocol-stream
|
|
|
|
"*nnimap*" (current-buffer) nnimap-address (car ports)
|
|
|
|
:type nnimap-stream
|
|
|
|
:return-list t
|
|
|
|
:shell-command nnimap-shell-program
|
|
|
|
:capability-command "1 CAPABILITY\r\n"
|
2011-04-02 23:41:03 +00:00
|
|
|
:end-of-command "\r\n"
|
2011-03-26 23:18:42 +00:00
|
|
|
:success " OK "
|
|
|
|
:starttls-function
|
|
|
|
(lambda (capabilities)
|
|
|
|
(when (gnus-string-match-p "STARTTLS" capabilities)
|
|
|
|
"1 STARTTLS\r\n"))))
|
|
|
|
(stream (car stream-list))
|
|
|
|
(props (cdr stream-list))
|
|
|
|
(greeting (plist-get props :greeting))
|
|
|
|
(capabilities (plist-get props :capabilities))
|
|
|
|
(stream-type (plist-get props :type)))
|
|
|
|
(when (and stream (not (memq (process-status stream) '(open run))))
|
|
|
|
(setq stream nil))
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
(setf (nnimap-process nnimap-object) stream)
|
2011-01-25 23:51:40 +00:00
|
|
|
(setf (nnimap-stream-type nnimap-object) stream-type)
|
Merge changes made in Gnus trunk.
nnir.el: Batch header retrieval.
proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols.
nnimap.el (nnimap-open-connection): Use it.
proto-stream.el (open-proto-stream): Complete the documentation.
nnimap.el (nnimap-open-connection): Check for "OK" from the greeting.
nntp.el: Use proto-streams for the relevant connections types.
nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers.
proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is.
proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el.
proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection.
color.el (color-lab->srgb): Fix function call name.
proto-stream.el: Fix the syntax in the comment.
nntp.el (nntp-open-connection): Fix the STARTTLS command syntax.
proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS.
proto-stream.el (proto-stream-always-use-starttls): New variable.
proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code.
proto-stream.el (proto-stream-open-starttls): Folded back into the main function.
proto-stream.el (proto-stream-command): Refactor out.
nnimap.el (nnimap-stream): Change default to `undecided'.
nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network.
nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port.
nnimap.el (nnimap-open-connection): Be more backwards-compatible.
proto-stream.el (open-protocol-stream): Renamed from open-proto-stream.
proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer.
gnus.texi (Customizing the IMAP Connection): Note the new defaults.
gnus.texi (Direct Functions): Note the STARTTLS upgrade.
proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for.
proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists.
proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection.
proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS.
nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility).
nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port.
nntp.el (nntp-open-connection): Provide a :success condition.
nnimap.el (nnimap-open-connection-1): Ditto.
proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is.
proto-stream.el (proto-stream-open-network): Add some comments.
proto-stream.el: Fix example.
proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade.
nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching.
nnir.el (nnir-ignore-newsgroups): Fix default value.
nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4.
mm-util.el (mm-delete-duplicates): Add comment.
gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry.
nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers.
color.el: fix docstring to use English rather than math notation for intervals.
shr.el (shr-find-fill-point): Don't break before apostrophes.
nnir.el (nnir-request-move-article): Bail out if no move support in group.
color.el (color-rgb->hsv): Fix docstring.
nnir.el (nnir-get-active): Improve active list retrieval.
shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes.
gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil.
nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p.
nnimap.el (nnimap-open-connection-1): Fix PREAUTH.
proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler.
gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers.
gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses.
shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters.
gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names.
nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall.
gnus-msg.el: Remove nastygram thing.
message.el (message-from-style): Fix comment.
message.el (message-user-organization): Do not use gnus-local-organization.
gnus.el: Remove gnus-local-organization.
rtree.el: New file to handle range trees.
nnir.el, gnus-sum.el: Redo the way nnir handles registry updates.
rtree.el (rtree-extract): Simplify.
gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support.
gnus-msg.el: Mark gnus-outgoing-message-group as obsolete.
gnus.texi (Archived Messages): Remove gnus-outgoing-message-group.
gnus-win.el (gnus-configure-frame): Remove old compatibility code.
rtree.el (rtree-memq): Rewrite it as a non-recursive function.
rtree.el (rtree-add, rtree-delq, rtree-length): Implement.
rtree.el (rtree-add): Make code slightly faster.
nnir.el: Allow modified summary-line-format in nnir summary buffers.
2010-12-02 22:21:31 +00:00
|
|
|
(if (not stream)
|
|
|
|
(progn
|
|
|
|
(nnheader-report 'nnimap "Unable to contact %s:%s via %s"
|
|
|
|
nnimap-address port nnimap-stream)
|
|
|
|
'no-connect)
|
|
|
|
(gnus-set-process-query-on-exit-flag stream nil)
|
|
|
|
(if (not (gnus-string-match-p "[*.] \\(OK\\|PREAUTH\\)" greeting))
|
|
|
|
(nnheader-report 'nnimap "%s" greeting)
|
|
|
|
;; Store the greeting (for debugging purposes).
|
|
|
|
(setf (nnimap-greeting nnimap-object) greeting)
|
|
|
|
(setf (nnimap-capabilities nnimap-object)
|
|
|
|
(mapcar #'upcase
|
|
|
|
(split-string capabilities)))
|
|
|
|
(unless (gnus-string-match-p "[*.] PREAUTH" greeting)
|
2010-09-27 23:07:47 +00:00
|
|
|
(if (not (setq credentials
|
|
|
|
(if (eq nnimap-authenticator 'anonymous)
|
|
|
|
(list "anonymous"
|
|
|
|
(message-make-address))
|
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
|
|
|
;; Look for the credentials based on
|
|
|
|
;; the virtual server name and the address
|
|
|
|
(nnimap-credentials
|
2011-02-17 23:46:18 +00:00
|
|
|
(gnus-delete-duplicates
|
|
|
|
(list
|
|
|
|
nnimap-address
|
|
|
|
(nnoo-current-server 'nnimap)))
|
2011-04-22 01:01:32 +00:00
|
|
|
ports
|
|
|
|
nnimap-user))))
|
2010-09-27 23:07:47 +00:00
|
|
|
(setq nnimap-object nil)
|
2011-02-14 04:23:59 +00:00
|
|
|
(let ((nnimap-inhibit-logging t))
|
|
|
|
(setq login-result
|
|
|
|
(nnimap-login (car credentials) (cadr credentials))))
|
2011-03-09 13:39:35 +00:00
|
|
|
(if (car login-result)
|
2011-03-30 14:59:42 +00:00
|
|
|
(progn
|
2011-06-23 00:00:38 +00:00
|
|
|
;; Save the credentials if a save function exists
|
|
|
|
;; (such a function will only be passed if a new
|
|
|
|
;; token was created).
|
2011-03-30 14:59:42 +00:00
|
|
|
(when (functionp (nth 2 credentials))
|
|
|
|
(funcall (nth 2 credentials)))
|
|
|
|
;; 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))))))
|
2010-09-27 23:07:47 +00:00
|
|
|
;; If the login failed, then forget the credentials
|
|
|
|
;; that are now possibly cached.
|
|
|
|
(dolist (host (list (nnoo-current-server 'nnimap)
|
|
|
|
nnimap-address))
|
|
|
|
(dolist (port ports)
|
2011-02-17 12:08:48 +00:00
|
|
|
(auth-source-forget+ :host host :port port)))
|
2010-09-27 23:07:47 +00:00
|
|
|
(delete-process (nnimap-process nnimap-object))
|
|
|
|
(setq nnimap-object nil))))
|
|
|
|
(when nnimap-object
|
2010-10-31 22:31:24 +00:00
|
|
|
(when (nnimap-capability "QRESYNC")
|
2010-09-27 23:07:47 +00:00
|
|
|
(nnimap-command "ENABLE QRESYNC"))
|
2010-10-01 00:25:50 +00:00
|
|
|
(nnimap-process nnimap-object))))))))
|
|
|
|
|
2011-01-02 23:17:32 +00:00
|
|
|
(autoload 'rfc2104-hash "rfc2104")
|
|
|
|
|
|
|
|
(defun nnimap-login (user password)
|
|
|
|
(cond
|
2011-01-25 23:51:40 +00:00
|
|
|
;; Prefer plain LOGIN if it's enabled (since it requires fewer
|
|
|
|
;; round trips than CRAM-MD5, and it's less likely to be buggy),
|
|
|
|
;; and we're using an encrypted connection.
|
|
|
|
((and (not (nnimap-capability "LOGINDISABLED"))
|
|
|
|
(eq (nnimap-stream-type nnimap-object) 'tls))
|
|
|
|
(nnimap-command "LOGIN %S %S" user password))
|
2011-01-02 23:17:32 +00:00
|
|
|
((nnimap-capability "AUTH=CRAM-MD5")
|
|
|
|
(erase-buffer)
|
|
|
|
(let ((sequence (nnimap-send-command "AUTHENTICATE CRAM-MD5"))
|
|
|
|
(challenge (nnimap-wait-for-line "^\\+\\(.*\\)\n")))
|
|
|
|
(process-send-string
|
|
|
|
(get-buffer-process (current-buffer))
|
|
|
|
(concat
|
|
|
|
(base64-encode-string
|
|
|
|
(concat user " "
|
|
|
|
(rfc2104-hash 'md5 64 16 password
|
|
|
|
(base64-decode-string challenge))))
|
|
|
|
"\r\n"))
|
|
|
|
(nnimap-wait-for-response sequence)))
|
|
|
|
((not (nnimap-capability "LOGINDISABLED"))
|
|
|
|
(nnimap-command "LOGIN %S %S" user password))
|
|
|
|
((nnimap-capability "AUTH=PLAIN")
|
|
|
|
(nnimap-command
|
|
|
|
"AUTHENTICATE PLAIN %s"
|
|
|
|
(base64-encode-string
|
|
|
|
(format "\000%s\000%s"
|
|
|
|
(nnimap-quote-specials user)
|
|
|
|
(nnimap-quote-specials password)))))))
|
|
|
|
|
2010-10-30 05:59:34 +00:00
|
|
|
(defun nnimap-quote-specials (string)
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert string)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "[\\\"]" nil t)
|
|
|
|
(forward-char -1)
|
|
|
|
(insert "\\")
|
|
|
|
(forward-char 1))
|
|
|
|
(buffer-string)))
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-find-parameter (parameter elems)
|
|
|
|
(let (result)
|
|
|
|
(dolist (elem elems)
|
|
|
|
(cond
|
|
|
|
((equal (car elem) parameter)
|
|
|
|
(setq result (cdr elem)))
|
|
|
|
((and (equal (car elem) "OK")
|
|
|
|
(consp (cadr elem))
|
|
|
|
(equal (caadr elem) parameter))
|
|
|
|
(setq result (cdr (cadr elem))))))
|
|
|
|
result))
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-close-server (&optional server)
|
2010-10-04 22:26:51 +00:00
|
|
|
(when (nnoo-change-server 'nnimap server nil)
|
|
|
|
(ignore-errors
|
|
|
|
(delete-process (get-buffer-process (nnimap-buffer))))
|
2010-10-13 23:12:47 +00:00
|
|
|
(nnoo-close-server 'nnimap server)
|
2010-10-04 22:26:51 +00:00
|
|
|
t))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-request-close ()
|
2010-09-18 10:02:19 +00:00
|
|
|
t)
|
2004-09-04 13:13:48 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-server-opened (&optional server)
|
2010-09-18 10:02:19 +00:00
|
|
|
(and (nnoo-current-server-p 'nnimap server)
|
|
|
|
nntp-server-buffer
|
|
|
|
(gnus-buffer-live-p nntp-server-buffer)
|
|
|
|
(nnimap-find-connection nntp-server-buffer)))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-status-message (&optional server)
|
2010-09-18 10:02:19 +00:00
|
|
|
nnimap-status-string)
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-request-article (article &optional group server to-buffer)
|
2000-09-19 13:40:08 +00:00
|
|
|
(with-current-buffer nntp-server-buffer
|
2010-09-20 00:36:54 +00:00
|
|
|
(let ((result (nnimap-possibly-change-group group server))
|
2010-09-26 04:03:19 +00:00
|
|
|
parts structure)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when (stringp article)
|
|
|
|
(setq article (nnimap-find-article-by-message-id group article)))
|
|
|
|
(when (and result
|
|
|
|
article)
|
|
|
|
(erase-buffer)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(erase-buffer)
|
2010-09-27 23:07:47 +00:00
|
|
|
(when nnimap-fetch-partial-articles
|
|
|
|
(nnimap-command "UID FETCH %d (BODYSTRUCTURE)" article)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(when (re-search-forward "FETCH.*BODYSTRUCTURE" nil t)
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
(setq structure (ignore-errors
|
|
|
|
(let ((start (point)))
|
|
|
|
(forward-sexp 1)
|
|
|
|
(downcase-region start (point))
|
2010-10-20 10:34:58 +00:00
|
|
|
(goto-char start)
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
(read (current-buffer))))
|
2010-09-27 23:07:47 +00:00
|
|
|
parts (nnimap-find-wanted-parts structure))))
|
2010-09-26 04:03:19 +00:00
|
|
|
(when (if parts
|
|
|
|
(nnimap-get-partial-article article parts structure)
|
|
|
|
(nnimap-get-whole-article article))
|
|
|
|
(let ((buffer (current-buffer)))
|
|
|
|
(with-current-buffer (or to-buffer nntp-server-buffer)
|
2011-05-02 03:37:06 +00:00
|
|
|
(nnheader-insert-buffer-substring buffer)
|
2011-05-01 23:30:18 +00:00
|
|
|
(nnheader-ms-strip-cr)))
|
|
|
|
(cons group article)))))))
|
2010-09-26 04:03:19 +00:00
|
|
|
|
2010-10-24 22:32:38 +00:00
|
|
|
(deffoo nnimap-request-head (article &optional group server to-buffer)
|
|
|
|
(when (nnimap-possibly-change-group group server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(when (stringp article)
|
|
|
|
(setq article (nnimap-find-article-by-message-id group article)))
|
2011-01-30 01:46:32 +00:00
|
|
|
(if (null article)
|
|
|
|
nil
|
|
|
|
(nnimap-get-whole-article
|
|
|
|
article (format "UID FETCH %%d %s"
|
|
|
|
(nnimap-header-parameters)))
|
|
|
|
(let ((buffer (current-buffer)))
|
|
|
|
(with-current-buffer (or to-buffer nntp-server-buffer)
|
|
|
|
(erase-buffer)
|
|
|
|
(insert-buffer-substring buffer)
|
|
|
|
(nnheader-ms-strip-cr)
|
|
|
|
(cons group article)))))))
|
2010-10-24 22:32:38 +00:00
|
|
|
|
|
|
|
(defun nnimap-get-whole-article (article &optional command)
|
2010-09-26 04:03:19 +00:00
|
|
|
(let ((result
|
|
|
|
(nnimap-command
|
2010-10-24 22:32:38 +00:00
|
|
|
(or command
|
|
|
|
(if (nnimap-ver4-p)
|
|
|
|
"UID FETCH %d BODY.PEEK[]"
|
|
|
|
"UID FETCH %d RFC822.PEEK"))
|
2010-09-26 04:03:19 +00:00
|
|
|
article)))
|
|
|
|
;; Check that we really got an article.
|
|
|
|
(goto-char (point-min))
|
2010-09-26 23:01:31 +00:00
|
|
|
(unless (re-search-forward "\\* [0-9]+ FETCH" nil t)
|
2010-09-26 04:03:19 +00:00
|
|
|
(setq result nil))
|
|
|
|
(when result
|
2010-09-26 23:01:31 +00:00
|
|
|
;; Remove any data that may have arrived before the FETCH data.
|
|
|
|
(beginning-of-line)
|
|
|
|
(unless (bobp)
|
|
|
|
(delete-region (point-min) (point)))
|
2010-09-26 04:03:19 +00:00
|
|
|
(let ((bytes (nnimap-get-length)))
|
|
|
|
(delete-region (line-beginning-position)
|
|
|
|
(progn (forward-line 1) (point)))
|
|
|
|
(goto-char (+ (point) bytes))
|
|
|
|
(delete-region (point) (point-max)))
|
|
|
|
t)))
|
|
|
|
|
2010-10-31 22:31:24 +00:00
|
|
|
(defun nnimap-capability (capability)
|
|
|
|
(member capability (nnimap-capabilities nnimap-object)))
|
|
|
|
|
2010-09-26 04:03:19 +00:00
|
|
|
(defun nnimap-ver4-p ()
|
2010-10-31 22:31:24 +00:00
|
|
|
(nnimap-capability "IMAP4REV1"))
|
2010-09-26 04:03:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-get-partial-article (article parts structure)
|
|
|
|
(let ((result
|
|
|
|
(nnimap-command
|
|
|
|
"UID FETCH %d (%s %s)"
|
|
|
|
article
|
|
|
|
(if (nnimap-ver4-p)
|
|
|
|
"BODY.PEEK[HEADER]"
|
|
|
|
"RFC822.HEADER")
|
|
|
|
(if (nnimap-ver4-p)
|
|
|
|
(mapconcat (lambda (part)
|
|
|
|
(format "BODY.PEEK[%s]" part))
|
|
|
|
parts " ")
|
|
|
|
(mapconcat (lambda (part)
|
|
|
|
(format "RFC822.PEEK[%s]" part))
|
|
|
|
parts " ")))))
|
|
|
|
(when result
|
|
|
|
(nnimap-convert-partial-article structure))))
|
|
|
|
|
|
|
|
(defun nnimap-convert-partial-article (structure)
|
|
|
|
;; First just skip past the headers.
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((bytes (nnimap-get-length))
|
|
|
|
id parts)
|
|
|
|
;; Delete "FETCH" line.
|
|
|
|
(delete-region (line-beginning-position)
|
|
|
|
(progn (forward-line 1) (point)))
|
|
|
|
(goto-char (+ (point) bytes))
|
|
|
|
;; Collect all the body parts.
|
|
|
|
(while (looking-at ".*BODY\\[\\([.0-9]+\\)\\]")
|
|
|
|
(setq id (match-string 1)
|
2011-01-11 23:32:50 +00:00
|
|
|
bytes (or (nnimap-get-length) 0))
|
2010-09-26 04:03:19 +00:00
|
|
|
(beginning-of-line)
|
|
|
|
(delete-region (point) (progn (forward-line 1) (point)))
|
|
|
|
(push (list id (buffer-substring (point) (+ (point) bytes)))
|
|
|
|
parts)
|
|
|
|
(delete-region (point) (+ (point) bytes)))
|
|
|
|
;; Delete trailing junk.
|
|
|
|
(delete-region (point) (point-max))
|
|
|
|
;; Now insert all the parts again where they fit in the structure.
|
|
|
|
(nnimap-insert-partial-structure structure parts)
|
|
|
|
t))
|
|
|
|
|
|
|
|
(defun nnimap-insert-partial-structure (structure parts &optional subp)
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
(let (type boundary)
|
|
|
|
(let ((bstruc structure))
|
|
|
|
(while (consp (car bstruc))
|
|
|
|
(pop bstruc))
|
|
|
|
(setq type (car bstruc))
|
|
|
|
(setq bstruc (car (cdr bstruc)))
|
2010-10-20 22:29:38 +00:00
|
|
|
(let ((has-boundary (member "boundary" bstruc)))
|
|
|
|
(when has-boundary
|
|
|
|
(setq boundary (cadr has-boundary)))))
|
2010-09-26 04:03:19 +00:00
|
|
|
(when subp
|
|
|
|
(insert (format "Content-type: multipart/%s; boundary=%S\n\n"
|
|
|
|
(downcase type) boundary)))
|
|
|
|
(while (not (stringp (car structure)))
|
|
|
|
(insert "\n--" boundary "\n")
|
|
|
|
(if (consp (caar structure))
|
|
|
|
(nnimap-insert-partial-structure (pop structure) parts t)
|
|
|
|
(let ((bit (pop structure)))
|
|
|
|
(insert (format "Content-type: %s/%s"
|
|
|
|
(downcase (nth 0 bit))
|
|
|
|
(downcase (nth 1 bit))))
|
|
|
|
(if (member "CHARSET" (nth 2 bit))
|
|
|
|
(insert (format
|
|
|
|
"; charset=%S\n" (cadr (member "CHARSET" (nth 2 bit)))))
|
|
|
|
(insert "\n"))
|
|
|
|
(insert (format "Content-transfer-encoding: %s\n"
|
|
|
|
(nth 5 bit)))
|
|
|
|
(insert "\n")
|
|
|
|
(when (assoc (nth 9 bit) parts)
|
|
|
|
(insert (cadr (assoc (nth 9 bit) parts)))))))
|
|
|
|
(insert "\n--" boundary "--\n")))
|
2010-09-20 00:36:54 +00:00
|
|
|
|
|
|
|
(defun nnimap-find-wanted-parts (structure)
|
|
|
|
(message-flatten-list (nnimap-find-wanted-parts-1 structure "")))
|
|
|
|
|
|
|
|
(defun nnimap-find-wanted-parts-1 (structure prefix)
|
|
|
|
(let ((num 1)
|
|
|
|
parts)
|
|
|
|
(while (consp (car structure))
|
|
|
|
(let ((sub (pop structure)))
|
|
|
|
(if (consp (car sub))
|
|
|
|
(push (nnimap-find-wanted-parts-1
|
|
|
|
sub (if (string= prefix "")
|
|
|
|
(number-to-string num)
|
|
|
|
(format "%s.%s" prefix num)))
|
|
|
|
parts)
|
2010-09-26 04:03:19 +00:00
|
|
|
(let ((type (format "%s/%s" (nth 0 sub) (nth 1 sub)))
|
|
|
|
(id (if (string= prefix "")
|
2010-09-20 00:36:54 +00:00
|
|
|
(number-to-string num)
|
2010-09-26 04:03:19 +00:00
|
|
|
(format "%s.%s" prefix num))))
|
|
|
|
(setcar (nthcdr 9 sub) id)
|
2010-09-27 23:07:47 +00:00
|
|
|
(when (if (eq nnimap-fetch-partial-articles t)
|
|
|
|
(equal id "1")
|
|
|
|
(string-match nnimap-fetch-partial-articles type))
|
2010-09-26 04:03:19 +00:00
|
|
|
(push id parts))))
|
|
|
|
(incf num)))
|
2010-09-20 00:36:54 +00:00
|
|
|
(nreverse parts)))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-request-group (group &optional server dont-check info)
|
2010-10-18 22:09:28 +00:00
|
|
|
(let ((result (nnimap-possibly-change-group
|
|
|
|
;; Don't SELECT the group if we're going to select it
|
|
|
|
;; later, anyway.
|
2011-01-02 11:23:02 +00:00
|
|
|
(if (and (not dont-check)
|
2010-11-01 22:21:10 +00:00
|
|
|
(assoc group nnimap-current-infos))
|
2010-10-18 22:09:28 +00:00
|
|
|
nil
|
|
|
|
group)
|
|
|
|
server))
|
2010-09-20 23:08:33 +00:00
|
|
|
articles active marks high low)
|
|
|
|
(with-current-buffer nntp-server-buffer
|
2010-09-18 10:02:19 +00:00
|
|
|
(when result
|
2010-09-18 23:36:29 +00:00
|
|
|
(if (and dont-check
|
|
|
|
(setq active (nth 2 (assoc group nnimap-current-infos))))
|
|
|
|
(insert (format "211 %d %d %d %S\n"
|
|
|
|
(- (cdr active) (car active))
|
|
|
|
(car active)
|
|
|
|
(cdr active)
|
|
|
|
group))
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(erase-buffer)
|
|
|
|
(let ((group-sequence
|
2010-09-21 23:13:46 +00:00
|
|
|
(nnimap-send-command "SELECT %S" (utf7-encode group t)))
|
2010-09-18 23:36:29 +00:00
|
|
|
(flag-sequence
|
|
|
|
(nnimap-send-command "UID FETCH 1:* FLAGS")))
|
2010-10-18 22:09:28 +00:00
|
|
|
(setf (nnimap-group nnimap-object) group)
|
2010-09-18 23:36:29 +00:00
|
|
|
(nnimap-wait-for-response flag-sequence)
|
|
|
|
(setq marks
|
|
|
|
(nnimap-flags-to-marks
|
|
|
|
(nnimap-parse-flags
|
2010-10-10 00:15:21 +00:00
|
|
|
(list (list group-sequence flag-sequence
|
|
|
|
1 group "SELECT")))))
|
|
|
|
(when (and info
|
|
|
|
marks)
|
2010-11-01 22:21:10 +00:00
|
|
|
(nnimap-update-infos marks (list info))
|
|
|
|
(nnimap-store-info info (gnus-active (gnus-info-group info))))
|
2010-09-18 23:36:29 +00:00
|
|
|
(goto-char (point-max))
|
2010-09-23 23:14:02 +00:00
|
|
|
(let ((uidnext (nth 5 (car marks))))
|
2010-10-01 23:08:25 +00:00
|
|
|
(setq high (or (if uidnext
|
|
|
|
(1- uidnext)
|
|
|
|
(nth 3 (car marks)))
|
|
|
|
0)
|
|
|
|
low (or (nth 4 (car marks)) uidnext 1)))))
|
2010-09-18 23:36:29 +00:00
|
|
|
(erase-buffer)
|
|
|
|
(insert
|
|
|
|
(format
|
2010-09-21 23:13:46 +00:00
|
|
|
"211 %d %d %d %S\n" (1+ (- high low)) low high group)))
|
|
|
|
t))))
|
|
|
|
|
|
|
|
(deffoo nnimap-request-create-group (group &optional server args)
|
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(car (nnimap-command "CREATE %S" (utf7-encode group t))))))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-09-20 23:08:33 +00:00
|
|
|
(deffoo nnimap-request-delete-group (group &optional force server)
|
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
2010-09-21 23:13:46 +00:00
|
|
|
(car (nnimap-command "DELETE %S" (utf7-encode group t))))))
|
|
|
|
|
2010-10-07 11:46:01 +00:00
|
|
|
(deffoo nnimap-request-rename-group (group new-name &optional server)
|
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
2010-11-21 07:11:35 +00:00
|
|
|
(nnimap-unselect-group)
|
2010-10-10 00:15:21 +00:00
|
|
|
(car (nnimap-command "RENAME %S %S"
|
|
|
|
(utf7-encode group t) (utf7-encode new-name t))))))
|
2010-10-07 11:46:01 +00:00
|
|
|
|
2010-11-21 07:11:35 +00:00
|
|
|
(defun nnimap-unselect-group ()
|
|
|
|
;; Make sure we don't have this group open read/write by asking
|
|
|
|
;; to examine a mailbox that doesn't exist. This seems to be
|
|
|
|
;; the only way that allows us to reliably go back to unselected
|
|
|
|
;; state on Courier.
|
|
|
|
(nnimap-command "EXAMINE DOES.NOT.EXIST"))
|
|
|
|
|
2010-09-21 23:13:46 +00:00
|
|
|
(deffoo nnimap-request-expunge-group (group &optional server)
|
|
|
|
(when (nnimap-possibly-change-group group server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(car (nnimap-command "EXPUNGE")))))
|
2010-09-20 23:08:33 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-get-flags (spec)
|
|
|
|
(let ((articles nil)
|
2010-10-10 00:15:21 +00:00
|
|
|
elems end)
|
2010-09-18 10:02:19 +00:00
|
|
|
(with-current-buffer (nnimap-buffer)
|
2000-09-19 13:40:08 +00:00
|
|
|
(erase-buffer)
|
2010-09-18 10:02:19 +00:00
|
|
|
(nnimap-wait-for-response (nnimap-send-command
|
|
|
|
"UID FETCH %s FLAGS" spec))
|
2010-10-10 00:15:21 +00:00
|
|
|
(setq end (point))
|
|
|
|
(subst-char-in-region (point-min) (point-max)
|
|
|
|
?\\ ?% t)
|
2010-09-18 10:02:19 +00:00
|
|
|
(goto-char (point-min))
|
2010-10-10 00:15:21 +00:00
|
|
|
(while (search-forward " FETCH " end t)
|
|
|
|
(setq elems (read (current-buffer)))
|
|
|
|
(push (cons (cadr (memq 'UID elems))
|
|
|
|
(cadr (memq 'FLAGS elems)))
|
2010-09-18 10:02:19 +00:00
|
|
|
articles)))
|
|
|
|
(nreverse articles)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-close-group (group &optional server)
|
2010-09-18 10:02:19 +00:00
|
|
|
t)
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2007-10-28 09:18:39 +00:00
|
|
|
(deffoo nnimap-request-move-article (article group server accept-form
|
2010-09-18 10:02:19 +00:00
|
|
|
&optional last internal-move-group)
|
2010-09-21 23:13:46 +00:00
|
|
|
(with-temp-buffer
|
2010-10-19 00:13:27 +00:00
|
|
|
(mm-disable-multibyte)
|
2010-10-24 22:32:38 +00:00
|
|
|
(when (funcall (if internal-move-group
|
|
|
|
'nnimap-request-head
|
|
|
|
'nnimap-request-article)
|
|
|
|
article group server (current-buffer))
|
2010-09-21 23:13:46 +00:00
|
|
|
;; If the move is internal (on the same server), just do it the easy
|
|
|
|
;; way.
|
|
|
|
(let ((message-id (message-field-value "message-id")))
|
|
|
|
(if internal-move-group
|
|
|
|
(let ((result
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(nnimap-command "UID COPY %d %S"
|
|
|
|
article
|
|
|
|
(utf7-encode internal-move-group t)))))
|
|
|
|
(when (car result)
|
2010-09-20 23:08:33 +00:00
|
|
|
(nnimap-delete-article article)
|
2010-09-21 23:13:46 +00:00
|
|
|
(cons internal-move-group
|
2010-11-26 01:14:40 +00:00
|
|
|
(or (nnimap-find-uid-response "COPYUID" (cadr result))
|
|
|
|
(nnimap-find-article-by-message-id
|
|
|
|
internal-move-group message-id)))))
|
2010-09-21 23:13:46 +00:00
|
|
|
;; Move the article to a different method.
|
|
|
|
(let ((result (eval accept-form)))
|
|
|
|
(when result
|
|
|
|
(nnimap-delete-article article)
|
|
|
|
result)))))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(deffoo nnimap-request-expire-articles (articles group &optional server force)
|
|
|
|
(cond
|
2010-09-21 23:13:46 +00:00
|
|
|
((null articles)
|
|
|
|
nil)
|
2010-09-18 10:02:19 +00:00
|
|
|
((not (nnimap-possibly-change-group group server))
|
|
|
|
articles)
|
2010-09-21 23:13:46 +00:00
|
|
|
((and force
|
|
|
|
(eq nnmail-expiry-target 'delete))
|
2010-09-26 23:01:31 +00:00
|
|
|
(unless (nnimap-delete-article (gnus-compress-sequence articles))
|
2010-10-16 01:55:08 +00:00
|
|
|
(nnheader-message 7 "Article marked for deletion, but not expunged."))
|
2010-09-18 10:02:19 +00:00
|
|
|
nil)
|
|
|
|
(t
|
2010-09-21 23:13:46 +00:00
|
|
|
(let ((deletable-articles
|
2010-09-23 00:30:37 +00:00
|
|
|
(if (or force
|
|
|
|
(eq nnmail-expiry-wait 'immediate))
|
2010-09-21 23:13:46 +00:00
|
|
|
articles
|
|
|
|
(gnus-sorted-intersection
|
|
|
|
articles
|
|
|
|
(nnimap-find-expired-articles group)))))
|
|
|
|
(if (null deletable-articles)
|
|
|
|
articles
|
|
|
|
(if (eq nnmail-expiry-target 'delete)
|
2010-09-26 23:01:31 +00:00
|
|
|
(nnimap-delete-article (gnus-compress-sequence deletable-articles))
|
2010-09-21 23:13:46 +00:00
|
|
|
(setq deletable-articles
|
|
|
|
(nnimap-process-expiry-targets
|
|
|
|
deletable-articles group server)))
|
|
|
|
;; Return the articles we didn't delete.
|
|
|
|
(gnus-sorted-complement articles deletable-articles))))))
|
|
|
|
|
|
|
|
(defun nnimap-process-expiry-targets (articles group server)
|
|
|
|
(let ((deleted-articles nil))
|
2010-12-05 22:17:34 +00:00
|
|
|
(cond
|
|
|
|
;; shortcut further processing if we're going to delete the articles
|
|
|
|
((eq nnmail-expiry-target 'delete)
|
|
|
|
(setq deleted-articles articles)
|
|
|
|
t)
|
|
|
|
;; or just move them to another folder on the same IMAP server
|
|
|
|
((and (not (functionp nnmail-expiry-target))
|
|
|
|
(gnus-server-equal (gnus-group-method nnmail-expiry-target)
|
|
|
|
(gnus-server-to-method
|
|
|
|
(format "nnimap:%s" server))))
|
|
|
|
(and (nnimap-possibly-change-group group server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(nnheader-message 7 "Expiring articles from %s: %s" group articles)
|
|
|
|
(nnimap-command
|
|
|
|
"UID COPY %s %S"
|
|
|
|
(nnimap-article-ranges (gnus-compress-sequence articles))
|
|
|
|
(utf7-encode (gnus-group-real-name nnmail-expiry-target) t))
|
|
|
|
(setq deleted-articles articles)))
|
|
|
|
t)
|
|
|
|
(t
|
|
|
|
(dolist (article articles)
|
|
|
|
(let ((target nnmail-expiry-target))
|
|
|
|
(with-temp-buffer
|
|
|
|
(mm-disable-multibyte)
|
|
|
|
(when (nnimap-request-article article group server (current-buffer))
|
|
|
|
(when (functionp target)
|
|
|
|
(setq target (funcall target group)))
|
2011-06-30 04:07:50 +00:00
|
|
|
(if (and target
|
|
|
|
(not (eq target 'delete)))
|
|
|
|
(if (or (gnus-request-group target t)
|
|
|
|
(gnus-request-create-group target))
|
|
|
|
(progn
|
|
|
|
(nnmail-expiry-target-group target group)
|
|
|
|
(nnheader-message 7 "Expiring article %s:%d to %s"
|
|
|
|
group article target))
|
|
|
|
(setq target nil))
|
|
|
|
(nnheader-message 7 "Expiring article %s:%d" group article))
|
2010-12-05 22:17:34 +00:00
|
|
|
(when target
|
|
|
|
(push article deleted-articles))))))))
|
2010-09-21 23:13:46 +00:00
|
|
|
;; Change back to the current group again.
|
|
|
|
(nnimap-possibly-change-group group server)
|
|
|
|
(setq deleted-articles (nreverse deleted-articles))
|
2010-09-26 23:01:31 +00:00
|
|
|
(nnimap-delete-article (gnus-compress-sequence deleted-articles))
|
2010-09-21 23:13:46 +00:00
|
|
|
deleted-articles))
|
|
|
|
|
|
|
|
(defun nnimap-find-expired-articles (group)
|
|
|
|
(let ((cutoff (nnmail-expired-article-p group nil nil)))
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(let ((result
|
|
|
|
(nnimap-command
|
|
|
|
"UID SEARCH SENTBEFORE %s"
|
|
|
|
(format-time-string
|
|
|
|
(format "%%d-%s-%%Y"
|
|
|
|
(upcase
|
|
|
|
(car (rassoc (nth 4 (decode-time cutoff))
|
|
|
|
parse-time-months))))
|
|
|
|
cutoff))))
|
|
|
|
(and (car result)
|
|
|
|
(delete 0 (mapcar #'string-to-number
|
|
|
|
(cdr (assoc "SEARCH" (cdr result))))))))))
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-find-article-by-message-id (group message-id)
|
2010-10-01 00:25:50 +00:00
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(erase-buffer)
|
2010-11-04 22:18:09 +00:00
|
|
|
(unless (equal group (nnimap-group nnimap-object))
|
|
|
|
(setf (nnimap-group nnimap-object) nil)
|
2010-11-21 07:11:35 +00:00
|
|
|
(setf (nnimap-examined nnimap-object) group)
|
2010-11-04 22:18:09 +00:00
|
|
|
(nnimap-send-command "EXAMINE %S" (utf7-encode group t)))
|
2010-10-01 00:25:50 +00:00
|
|
|
(let ((sequence
|
|
|
|
(nnimap-send-command "UID SEARCH HEADER Message-Id %S" message-id))
|
|
|
|
article result)
|
|
|
|
(setq result (nnimap-wait-for-response sequence))
|
|
|
|
(when (and result
|
|
|
|
(car (setq result (nnimap-parse-response))))
|
|
|
|
;; Select the last instance of the message in the group.
|
|
|
|
(and (setq article
|
2011-06-21 22:13:24 +00:00
|
|
|
(car (last (cdr (assoc "SEARCH" (cdr result))))))
|
2010-10-01 00:25:50 +00:00
|
|
|
(string-to-number article))))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-delete-article (articles)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(nnimap-command "UID STORE %s +FLAGS.SILENT (\\Deleted)"
|
|
|
|
(nnimap-article-ranges articles))
|
2010-09-21 23:13:46 +00:00
|
|
|
(cond
|
2010-10-31 22:31:24 +00:00
|
|
|
((nnimap-capability "UIDPLUS")
|
2010-09-21 23:13:46 +00:00
|
|
|
(nnimap-command "UID EXPUNGE %s"
|
|
|
|
(nnimap-article-ranges articles))
|
|
|
|
t)
|
|
|
|
(nnimap-expunge
|
|
|
|
(nnimap-command "EXPUNGE")
|
2010-09-22 13:34:37 +00:00
|
|
|
t)
|
|
|
|
(t (gnus-message 7 (concat "nnimap: nnimap-expunge is not set and the "
|
|
|
|
"server doesn't support UIDPLUS, so we won't "
|
|
|
|
"delete this article now"))))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(deffoo nnimap-request-scan (&optional group server)
|
|
|
|
(when (and (nnimap-possibly-change-group nil server)
|
|
|
|
nnimap-inbox
|
|
|
|
nnimap-split-methods)
|
2010-10-16 01:55:08 +00:00
|
|
|
(nnheader-message 7 "nnimap %s splitting mail..." server)
|
2011-07-04 13:11:52 +00:00
|
|
|
(nnimap-split-incoming-mail)
|
|
|
|
(nnheader-message 7 "nnimap %s splitting mail...done" server)))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-marks-to-flags (marks)
|
|
|
|
(let (flags flag)
|
|
|
|
(dolist (mark marks)
|
|
|
|
(when (setq flag (cadr (assq mark nnimap-mark-alist)))
|
|
|
|
(push flag flags)))
|
|
|
|
flags))
|
|
|
|
|
2010-12-16 22:22:28 +00:00
|
|
|
(deffoo nnimap-request-update-group-status (group status &optional server)
|
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(let ((command (assoc
|
|
|
|
status
|
|
|
|
'((subscribe "SUBSCRIBE")
|
|
|
|
(unsubscribe "UNSUBSCRIBE")))))
|
|
|
|
(when command
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(nnimap-command "%s %S" (cadr command) (utf7-encode group t)))))))
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-request-set-mark (group actions &optional server)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when (nnimap-possibly-change-group group server)
|
|
|
|
(let (sequence)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
(erase-buffer)
|
2010-09-18 10:02:19 +00:00
|
|
|
;; Just send all the STORE commands without waiting for
|
|
|
|
;; response. If they're successful, they're successful.
|
|
|
|
(dolist (action actions)
|
|
|
|
(destructuring-bind (range action marks) action
|
|
|
|
(let ((flags (nnimap-marks-to-flags marks)))
|
|
|
|
(when flags
|
|
|
|
(setq sequence (nnimap-send-command
|
|
|
|
"UID STORE %s %sFLAGS.SILENT (%s)"
|
|
|
|
(nnimap-article-ranges range)
|
2010-11-26 02:11:40 +00:00
|
|
|
(cond
|
|
|
|
((eq action 'del) "-")
|
2010-11-26 02:17:55 +00:00
|
|
|
((eq action 'add) "+")
|
2010-11-26 02:11:40 +00:00
|
|
|
((eq action 'set) ""))
|
2010-09-18 10:02:19 +00:00
|
|
|
(mapconcat #'identity flags " ")))))))
|
|
|
|
;; Wait for the last command to complete to avoid later
|
|
|
|
;; syncronisation problems with the stream.
|
2010-09-20 23:08:33 +00:00
|
|
|
(when sequence
|
|
|
|
(nnimap-wait-for-response sequence))))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
2000-09-19 13:40:08 +00:00
|
|
|
(deffoo nnimap-request-accept-article (group &optional server last)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(nnmail-check-syntax)
|
2010-10-01 00:25:50 +00:00
|
|
|
(let ((message-id (message-field-value "message-id"))
|
|
|
|
sequence message)
|
|
|
|
(nnimap-add-cr)
|
2010-10-21 01:23:34 +00:00
|
|
|
(setq message (buffer-substring-no-properties (point-min) (point-max)))
|
2010-09-18 10:02:19 +00:00
|
|
|
(with-current-buffer (nnimap-buffer)
|
2011-02-13 13:44:06 +00:00
|
|
|
(when (setq message (or (nnimap-process-quirk "OK Gimap " 'append message)
|
|
|
|
message))
|
2011-02-07 13:03:22 +00:00
|
|
|
;; If we have this group open read-only, then unselect it
|
|
|
|
;; before appending to it.
|
|
|
|
(when (equal (nnimap-examined nnimap-object) group)
|
|
|
|
(nnimap-unselect-group))
|
|
|
|
(erase-buffer)
|
|
|
|
(setq sequence (nnimap-send-command
|
|
|
|
"APPEND %S {%d}" (utf7-encode group t)
|
|
|
|
(length message)))
|
|
|
|
(unless nnimap-streaming
|
|
|
|
(nnimap-wait-for-connection "^[+]"))
|
|
|
|
(process-send-string (get-buffer-process (current-buffer)) message)
|
|
|
|
(process-send-string (get-buffer-process (current-buffer))
|
|
|
|
(if (nnimap-newlinep nnimap-object)
|
|
|
|
"\n"
|
|
|
|
"\r\n"))
|
|
|
|
(let ((result (nnimap-get-response sequence)))
|
|
|
|
(if (not (nnimap-ok-p result))
|
|
|
|
(progn
|
|
|
|
(nnheader-report 'nnimap "%s" result)
|
|
|
|
nil)
|
|
|
|
(cons group
|
|
|
|
(or (nnimap-find-uid-response "APPENDUID" (car result))
|
|
|
|
(nnimap-find-article-by-message-id
|
|
|
|
group message-id))))))))))
|
|
|
|
|
|
|
|
(defun nnimap-process-quirk (greeting-match type data)
|
|
|
|
(when (and (nnimap-greeting nnimap-object)
|
2011-02-13 13:44:06 +00:00
|
|
|
(string-match greeting-match (nnimap-greeting nnimap-object))
|
2011-02-07 13:03:22 +00:00
|
|
|
(eq type 'append)
|
|
|
|
(string-match "\000" data))
|
|
|
|
(let ((choice (gnus-multiple-choice
|
|
|
|
"Message contains NUL characters. Delete, continue, abort? "
|
|
|
|
'((?d "Delete NUL characters")
|
|
|
|
(?c "Try to APPEND the message as is")
|
|
|
|
(?a "Abort")))))
|
|
|
|
(cond
|
|
|
|
((eq choice ?a)
|
|
|
|
(nnheader-report 'nnimap "Aborted APPEND due to NUL characters"))
|
|
|
|
((eq choice ?c)
|
|
|
|
data)
|
|
|
|
(t
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert data)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (search-forward "\000" nil t)
|
|
|
|
(replace-match "" t t))
|
|
|
|
(buffer-string)))))))
|
2010-11-26 01:14:40 +00:00
|
|
|
|
2011-02-03 23:43:22 +00:00
|
|
|
(defun nnimap-ok-p (value)
|
|
|
|
(and (consp value)
|
|
|
|
(consp (car value))
|
|
|
|
(equal (caar value) "OK")))
|
|
|
|
|
2010-11-26 01:14:40 +00:00
|
|
|
(defun nnimap-find-uid-response (name list)
|
2010-11-26 01:27:37 +00:00
|
|
|
(let ((result (car (last (nnimap-find-response-element name list)))))
|
2010-11-26 01:14:40 +00:00
|
|
|
(and result
|
|
|
|
(string-to-number result))))
|
|
|
|
|
|
|
|
(defun nnimap-find-response-element (name list)
|
|
|
|
(let (result)
|
|
|
|
(dolist (elem list)
|
|
|
|
(when (and (consp elem)
|
|
|
|
(equal name (car elem)))
|
|
|
|
(setq result elem)))
|
|
|
|
result))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
2010-10-21 01:23:34 +00:00
|
|
|
(deffoo nnimap-request-replace-article (article group buffer)
|
|
|
|
(let (group-art)
|
|
|
|
(when (and (nnimap-possibly-change-group group nil)
|
|
|
|
;; Put the article into the group.
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(setq group-art
|
|
|
|
(nnimap-request-accept-article group nil t))))
|
|
|
|
(nnimap-delete-article (list article))
|
|
|
|
;; Return the new article number.
|
|
|
|
(cdr group-art))))
|
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-add-cr ()
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "\r?\n" nil t)
|
|
|
|
(replace-match "\r\n" t t)))
|
|
|
|
|
|
|
|
(defun nnimap-get-groups ()
|
2010-11-26 01:14:40 +00:00
|
|
|
(erase-buffer)
|
|
|
|
(let ((sequence (nnimap-send-command "LIST \"\" \"*\""))
|
2010-09-18 10:02:19 +00:00
|
|
|
groups)
|
2010-11-26 01:14:40 +00:00
|
|
|
(nnimap-wait-for-response sequence)
|
|
|
|
(subst-char-in-region (point-min) (point-max)
|
|
|
|
?\\ ?% t)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(nnimap-unfold-quoted-lines)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (search-forward "* LIST " nil t)
|
|
|
|
(let ((flags (read (current-buffer)))
|
|
|
|
(separator (read (current-buffer)))
|
|
|
|
(group (read (current-buffer))))
|
|
|
|
(unless (member '%NoSelect flags)
|
2010-11-26 11:03:16 +00:00
|
|
|
(push (if (stringp group)
|
|
|
|
group
|
|
|
|
(format "%s" group))
|
|
|
|
groups))))
|
2010-11-26 01:14:40 +00:00
|
|
|
(nreverse groups)))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-request-list (&optional server)
|
2011-02-18 00:41:50 +00:00
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(with-current-buffer nntp-server-buffer
|
|
|
|
(erase-buffer)
|
|
|
|
(let ((groups
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(nnimap-get-groups)))
|
|
|
|
sequences responses)
|
|
|
|
(when groups
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(setf (nnimap-group nnimap-object) nil)
|
|
|
|
(dolist (group groups)
|
|
|
|
(setf (nnimap-examined nnimap-object) group)
|
|
|
|
(push (list (nnimap-send-command "EXAMINE %S"
|
|
|
|
(utf7-encode group t))
|
|
|
|
group)
|
|
|
|
sequences))
|
|
|
|
(nnimap-wait-for-response (caar sequences))
|
|
|
|
(setq responses
|
|
|
|
(nnimap-get-responses (mapcar #'car sequences))))
|
|
|
|
(dolist (response responses)
|
|
|
|
(let* ((sequence (car response))
|
|
|
|
(response (cadr response))
|
|
|
|
(group (cadr (assoc sequence sequences))))
|
|
|
|
(when (and group
|
|
|
|
(equal (caar response) "OK"))
|
|
|
|
(let ((uidnext (nnimap-find-parameter "UIDNEXT" response))
|
|
|
|
highest exists)
|
|
|
|
(dolist (elem response)
|
|
|
|
(when (equal (cadr elem) "EXISTS")
|
|
|
|
(setq exists (string-to-number (car elem)))))
|
|
|
|
(when uidnext
|
|
|
|
(setq highest (1- (string-to-number (car uidnext)))))
|
|
|
|
(cond
|
|
|
|
((null highest)
|
|
|
|
(insert (format "%S 0 1 y\n" (utf7-decode group t))))
|
|
|
|
((zerop exists)
|
|
|
|
;; Empty group.
|
|
|
|
(insert (format "%S %d %d y\n"
|
|
|
|
(utf7-decode group t)
|
|
|
|
highest (1+ highest))))
|
|
|
|
(t
|
|
|
|
;; Return the widest possible range.
|
|
|
|
(insert (format "%S %d 1 y\n" (utf7-decode group t)
|
|
|
|
(or highest exists)))))))))
|
|
|
|
t)))))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2010-10-01 23:08:25 +00:00
|
|
|
(deffoo nnimap-request-newgroups (date &optional server)
|
2011-02-18 00:41:50 +00:00
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(with-current-buffer nntp-server-buffer
|
|
|
|
(erase-buffer)
|
|
|
|
(dolist (group (with-current-buffer (nnimap-buffer)
|
|
|
|
(nnimap-get-groups)))
|
|
|
|
(unless (assoc group nnimap-current-infos)
|
|
|
|
;; Insert dummy numbers here -- they don't matter.
|
|
|
|
(insert (format "%S 0 1 y\n" group))))
|
|
|
|
t)))
|
2010-10-01 23:08:25 +00:00
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-retrieve-group-data-early (server infos)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when (nnimap-possibly-change-group nil server)
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
2010-10-10 00:15:21 +00:00
|
|
|
(erase-buffer)
|
|
|
|
(setf (nnimap-group nnimap-object) nil)
|
2010-10-31 22:31:24 +00:00
|
|
|
(let ((qresyncp (nnimap-capability "QRESYNC"))
|
2010-10-10 00:15:21 +00:00
|
|
|
params groups sequences active uidvalidity modseq group)
|
2010-09-18 10:02:19 +00:00
|
|
|
;; Go through the infos and gather the data needed to know
|
|
|
|
;; what and how to request the data.
|
|
|
|
(dolist (info infos)
|
2010-10-10 00:15:21 +00:00
|
|
|
(setq params (gnus-info-params info)
|
|
|
|
group (gnus-group-real-name (gnus-info-group info))
|
|
|
|
active (cdr (assq 'active params))
|
|
|
|
uidvalidity (cdr (assq 'uidvalidity params))
|
|
|
|
modseq (cdr (assq 'modseq params)))
|
2010-11-21 07:11:35 +00:00
|
|
|
(setf (nnimap-examined nnimap-object) group)
|
2010-09-18 10:02:19 +00:00
|
|
|
(if (and qresyncp
|
2010-10-10 00:15:21 +00:00
|
|
|
uidvalidity
|
2011-02-23 13:35:35 +00:00
|
|
|
active
|
2010-10-10 00:15:21 +00:00
|
|
|
modseq)
|
2010-09-18 10:02:19 +00:00
|
|
|
(push
|
2010-12-16 22:22:28 +00:00
|
|
|
(list (nnimap-send-command "EXAMINE %S (%s (%s %s))"
|
2010-10-10 22:48:40 +00:00
|
|
|
(utf7-encode group t)
|
2010-12-16 22:22:28 +00:00
|
|
|
(nnimap-quirk "QRESYNC")
|
2010-10-10 22:48:40 +00:00
|
|
|
uidvalidity modseq)
|
2010-10-10 00:15:21 +00:00
|
|
|
'qresync
|
|
|
|
nil group 'qresync)
|
2010-09-18 10:02:19 +00:00
|
|
|
sequences)
|
|
|
|
(let ((start
|
2010-10-10 00:15:21 +00:00
|
|
|
(if (and active uidvalidity)
|
2010-09-18 10:02:19 +00:00
|
|
|
;; Fetch the last 100 flags.
|
2010-10-10 00:15:21 +00:00
|
|
|
(max 1 (- (cdr active) 100))
|
|
|
|
1))
|
|
|
|
(command
|
|
|
|
(if uidvalidity
|
|
|
|
"EXAMINE"
|
|
|
|
;; If we don't have a UIDVALIDITY, then this is
|
|
|
|
;; the first time we've seen the group, so we
|
|
|
|
;; have to do a SELECT (which is slower than an
|
|
|
|
;; examine), but will tell us whether the group
|
|
|
|
;; is read-only or not.
|
|
|
|
"SELECT")))
|
2010-10-10 22:48:40 +00:00
|
|
|
(push (list (nnimap-send-command "%s %S" command
|
|
|
|
(utf7-encode group t))
|
2010-09-18 10:02:19 +00:00
|
|
|
(nnimap-send-command "UID FETCH %d:* FLAGS" start)
|
2010-10-10 00:15:21 +00:00
|
|
|
start group command)
|
2010-10-24 22:32:38 +00:00
|
|
|
sequences))))
|
2010-09-18 10:02:19 +00:00
|
|
|
sequences))))
|
|
|
|
|
2010-12-16 22:22:28 +00:00
|
|
|
(defun nnimap-quirk (command)
|
|
|
|
(let ((quirk (assoc command nnimap-quirks)))
|
|
|
|
;; If this server is of a type that matches a quirk, then return
|
|
|
|
;; the "quirked" command instead of the proper one.
|
|
|
|
(if (or (null quirk)
|
|
|
|
(not (string-match (nth 1 quirk) (nnimap-greeting nnimap-object))))
|
|
|
|
command
|
|
|
|
(nth 2 quirk))))
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-finish-retrieve-group-infos (server infos sequences)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when (and sequences
|
2011-06-30 01:02:47 +00:00
|
|
|
;; Check that the process is still alive.
|
|
|
|
(get-buffer-process (nnimap-buffer))
|
|
|
|
(memq (process-status (get-buffer-process (nnimap-buffer)))
|
|
|
|
'(open run))
|
2010-09-18 10:02:19 +00:00
|
|
|
(nnimap-possibly-change-group nil server))
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
;; Wait for the final data to trickle in.
|
2010-10-10 00:15:21 +00:00
|
|
|
(when (nnimap-wait-for-response (if (eq (cadar sequences) 'qresync)
|
|
|
|
(caar sequences)
|
|
|
|
(cadar sequences))
|
|
|
|
t)
|
|
|
|
;; Now we should have most of the data we need, no matter
|
|
|
|
;; whether we're QRESYNCING, fetching all the flags from
|
|
|
|
;; scratch, or just fetching the last 100 flags per group.
|
2010-09-26 04:03:19 +00:00
|
|
|
(nnimap-update-infos (nnimap-flags-to-marks
|
|
|
|
(nnimap-parse-flags
|
|
|
|
(nreverse sequences)))
|
|
|
|
infos)
|
|
|
|
;; Finally, just return something resembling an active file in
|
|
|
|
;; the nntp buffer, so that the agent can save the info, too.
|
|
|
|
(with-current-buffer nntp-server-buffer
|
|
|
|
(erase-buffer)
|
|
|
|
(dolist (info infos)
|
|
|
|
(let* ((group (gnus-info-group info))
|
|
|
|
(active (gnus-active group)))
|
|
|
|
(when active
|
|
|
|
(insert (format "%S %d %d y\n"
|
|
|
|
(gnus-group-real-name group)
|
|
|
|
(cdr active)
|
|
|
|
(car active)))))))))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-update-infos (flags infos)
|
|
|
|
(dolist (info infos)
|
2010-10-10 00:15:21 +00:00
|
|
|
(let* ((group (gnus-group-real-name (gnus-info-group info)))
|
|
|
|
(marks (cdr (assoc group flags))))
|
|
|
|
(when marks
|
|
|
|
(nnimap-update-info info marks)))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-update-info (info marks)
|
2010-10-10 00:15:21 +00:00
|
|
|
(destructuring-bind (existing flags high low uidnext start-article
|
|
|
|
permanent-flags uidvalidity
|
|
|
|
vanished highestmodseq) marks
|
|
|
|
(cond
|
|
|
|
;; Ignore groups with no UIDNEXT/marks. This happens for
|
|
|
|
;; completely empty groups.
|
|
|
|
((and (not existing)
|
|
|
|
(not uidnext))
|
2010-10-10 22:48:40 +00:00
|
|
|
(let ((active (cdr (assq 'active (gnus-info-params info)))))
|
|
|
|
(when active
|
|
|
|
(gnus-set-active (gnus-info-group info) active))))
|
2010-10-10 00:15:21 +00:00
|
|
|
;; We have a mismatch between the old and new UIDVALIDITY
|
|
|
|
;; identifiers, so we have to re-request the group info (the next
|
|
|
|
;; time). This virtually never happens.
|
|
|
|
((let ((old-uidvalidity
|
|
|
|
(cdr (assq 'uidvalidity (gnus-info-params info)))))
|
|
|
|
(and old-uidvalidity
|
|
|
|
(not (equal old-uidvalidity uidvalidity))
|
|
|
|
(> start-article 1)))
|
|
|
|
(gnus-group-remove-parameter info 'uidvalidity)
|
|
|
|
(gnus-group-remove-parameter info 'modseq))
|
|
|
|
;; We have the data needed to update.
|
|
|
|
(t
|
2010-10-10 22:48:40 +00:00
|
|
|
(let* ((group (gnus-info-group info))
|
|
|
|
(completep (and start-article
|
|
|
|
(= start-article 1)))
|
|
|
|
(active (or (gnus-active group)
|
|
|
|
(cdr (assq 'active (gnus-info-params info))))))
|
2010-09-23 23:14:02 +00:00
|
|
|
(when uidnext
|
|
|
|
(setq high (1- uidnext)))
|
2010-09-18 10:02:19 +00:00
|
|
|
;; First set the active ranges based on high/low.
|
|
|
|
(if (or completep
|
|
|
|
(not (gnus-active group)))
|
|
|
|
(gnus-set-active group
|
2010-09-24 22:33:34 +00:00
|
|
|
(cond
|
2010-11-10 23:16:01 +00:00
|
|
|
(active
|
|
|
|
(cons (min (or low (car active))
|
|
|
|
(car active))
|
|
|
|
(max (or high (cdr active))
|
|
|
|
(cdr active))))
|
2010-09-24 22:33:34 +00:00
|
|
|
((and low high)
|
|
|
|
(cons low high))
|
|
|
|
(uidnext
|
2010-09-18 10:02:19 +00:00
|
|
|
;; No articles in this group.
|
2010-09-24 22:33:34 +00:00
|
|
|
(cons uidnext (1- uidnext)))
|
|
|
|
(start-article
|
|
|
|
(cons start-article (1- start-article)))
|
|
|
|
(t
|
|
|
|
;; No articles and no uidnext.
|
|
|
|
nil)))
|
2011-02-07 13:03:22 +00:00
|
|
|
(gnus-set-active group
|
|
|
|
(cons (car active)
|
|
|
|
(or high (1- uidnext)))))
|
2010-10-10 00:15:21 +00:00
|
|
|
;; See whether this is a read-only group.
|
|
|
|
(unless (eq permanent-flags 'not-scanned)
|
|
|
|
(gnus-group-set-parameter
|
|
|
|
info 'permanent-flags
|
2010-10-18 22:09:28 +00:00
|
|
|
(and (or (memq '%* permanent-flags)
|
|
|
|
(memq '%Seen permanent-flags))
|
|
|
|
permanent-flags)))
|
2010-10-10 00:15:21 +00:00
|
|
|
;; Update marks and read articles if this isn't a
|
|
|
|
;; read-only IMAP group.
|
2010-10-18 22:09:28 +00:00
|
|
|
(when (setq permanent-flags
|
|
|
|
(cdr (assq 'permanent-flags (gnus-info-params info))))
|
2010-10-10 00:15:21 +00:00
|
|
|
(if (and highestmodseq
|
|
|
|
(not start-article))
|
|
|
|
;; We've gotten the data by QRESYNCing.
|
|
|
|
(nnimap-update-qresync-info
|
2010-10-10 22:48:40 +00:00
|
|
|
info existing (nnimap-imap-ranges-to-gnus-ranges vanished) flags)
|
2010-10-10 00:15:21 +00:00
|
|
|
;; Do normal non-QRESYNC flag updates.
|
|
|
|
;; Update the list of read articles.
|
|
|
|
(let* ((unread
|
|
|
|
(gnus-compress-sequence
|
|
|
|
(gnus-set-difference
|
|
|
|
(gnus-set-difference
|
|
|
|
existing
|
|
|
|
(cdr (assoc '%Seen flags)))
|
|
|
|
(cdr (assoc '%Flagged flags)))))
|
|
|
|
(read (gnus-range-difference
|
|
|
|
(cons start-article high) unread)))
|
|
|
|
(when (> start-article 1)
|
|
|
|
(setq read
|
|
|
|
(gnus-range-nconcat
|
|
|
|
(if (> start-article 1)
|
|
|
|
(gnus-sorted-range-intersection
|
|
|
|
(cons 1 (1- start-article))
|
|
|
|
(gnus-info-read info))
|
|
|
|
(gnus-info-read info))
|
|
|
|
read)))
|
2010-10-18 22:09:28 +00:00
|
|
|
(when (or (not (listp permanent-flags))
|
|
|
|
(memq '%Seen permanent-flags))
|
|
|
|
(gnus-info-set-read info read))
|
2010-10-10 00:15:21 +00:00
|
|
|
;; Update the marks.
|
|
|
|
(setq marks (gnus-info-marks info))
|
|
|
|
(dolist (type (cdr nnimap-mark-alist))
|
2010-10-18 22:09:28 +00:00
|
|
|
(when (or (not (listp permanent-flags))
|
2010-10-30 12:54:28 +00:00
|
|
|
(memq (car (assoc (caddr type) flags))
|
|
|
|
permanent-flags)
|
2010-10-18 22:09:28 +00:00
|
|
|
(memq '%* permanent-flags))
|
|
|
|
(let ((old-marks (assoc (car type) marks))
|
|
|
|
(new-marks
|
|
|
|
(gnus-compress-sequence
|
|
|
|
(cdr (or (assoc (caddr type) flags) ; %Flagged
|
|
|
|
(assoc (intern (cadr type) obarray) flags)
|
|
|
|
(assoc (cadr type) flags)))))) ; "\Flagged"
|
|
|
|
(setq marks (delq old-marks marks))
|
|
|
|
(pop old-marks)
|
|
|
|
(when (and old-marks
|
|
|
|
(> start-article 1))
|
|
|
|
(setq old-marks (gnus-range-difference
|
|
|
|
old-marks
|
|
|
|
(cons start-article high)))
|
|
|
|
(setq new-marks (gnus-range-nconcat old-marks new-marks)))
|
|
|
|
(when new-marks
|
|
|
|
(push (cons (car type) new-marks) marks)))))
|
|
|
|
(gnus-info-set-marks info marks t))))
|
2011-02-07 13:03:22 +00:00
|
|
|
;; Tell Gnus whether there are any \Recent messages in any of
|
|
|
|
;; the groups.
|
|
|
|
(let ((recent (cdr (assoc '%Recent flags))))
|
2011-02-07 22:49:38 +00:00
|
|
|
(when (and active
|
|
|
|
recent
|
|
|
|
(> (car (last recent)) (cdr active)))
|
|
|
|
(push (list (cons (gnus-group-real-name group) 0))
|
|
|
|
nnmail-split-history)))
|
2010-10-10 00:15:21 +00:00
|
|
|
;; Note the active level for the next run-through.
|
|
|
|
(gnus-group-set-parameter info 'active (gnus-active group))
|
|
|
|
(gnus-group-set-parameter info 'uidvalidity uidvalidity)
|
|
|
|
(gnus-group-set-parameter info 'modseq highestmodseq)
|
|
|
|
(nnimap-store-info info (gnus-active group)))))))
|
|
|
|
|
2010-10-10 22:48:40 +00:00
|
|
|
(defun nnimap-update-qresync-info (info existing vanished flags)
|
2010-10-10 00:15:21 +00:00
|
|
|
;; Add all the vanished articles to the list of read articles.
|
|
|
|
(gnus-info-set-read
|
|
|
|
info
|
2010-10-10 22:48:40 +00:00
|
|
|
(gnus-add-to-range
|
|
|
|
(gnus-add-to-range
|
|
|
|
(gnus-range-add (gnus-info-read info)
|
|
|
|
vanished)
|
|
|
|
(cdr (assq '%Flagged flags)))
|
|
|
|
(cdr (assq '%Seen flags))))
|
|
|
|
(let ((marks (gnus-info-marks info)))
|
|
|
|
(dolist (type (cdr nnimap-mark-alist))
|
|
|
|
(let ((ticks (assoc (car type) marks))
|
|
|
|
(new-marks
|
|
|
|
(cdr (or (assoc (caddr type) flags) ; %Flagged
|
|
|
|
(assoc (intern (cadr type) obarray) flags)
|
|
|
|
(assoc (cadr type) flags))))) ; "\Flagged"
|
|
|
|
(setq marks (delq ticks marks))
|
|
|
|
(pop ticks)
|
|
|
|
;; Add the new marks we got.
|
|
|
|
(setq ticks (gnus-add-to-range ticks new-marks))
|
|
|
|
;; Remove the marks from messages that don't have them.
|
|
|
|
(setq ticks (gnus-remove-from-range
|
|
|
|
ticks
|
|
|
|
(gnus-compress-sequence
|
|
|
|
(gnus-sorted-complement existing new-marks))))
|
|
|
|
(when ticks
|
|
|
|
(push (cons (car type) ticks) marks)))
|
|
|
|
(gnus-info-set-marks info marks t))))
|
2010-10-10 00:15:21 +00:00
|
|
|
|
|
|
|
(defun nnimap-imap-ranges-to-gnus-ranges (irange)
|
|
|
|
(if (zerop (length irange))
|
|
|
|
nil
|
|
|
|
(let ((result nil))
|
|
|
|
(dolist (elem (split-string irange ","))
|
|
|
|
(push
|
|
|
|
(if (string-match ":" elem)
|
|
|
|
(let ((numbers (split-string elem ":")))
|
|
|
|
(cons (string-to-number (car numbers))
|
|
|
|
(string-to-number (cadr numbers))))
|
|
|
|
(string-to-number elem))
|
|
|
|
result))
|
|
|
|
(nreverse result))))
|
2010-09-18 23:36:29 +00:00
|
|
|
|
|
|
|
(defun nnimap-store-info (info active)
|
|
|
|
(let* ((group (gnus-group-real-name (gnus-info-group info)))
|
|
|
|
(entry (assoc group nnimap-current-infos)))
|
|
|
|
(if entry
|
|
|
|
(setcdr entry (list info active))
|
|
|
|
(push (list group info active) nnimap-current-infos))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-flags-to-marks (groups)
|
2010-10-10 00:15:21 +00:00
|
|
|
(let (data group totalp uidnext articles start-article mark permanent-flags
|
|
|
|
uidvalidity vanished highestmodseq)
|
2010-09-18 10:02:19 +00:00
|
|
|
(dolist (elem groups)
|
|
|
|
(setq group (car elem)
|
2010-09-23 00:30:37 +00:00
|
|
|
uidnext (nth 1 elem)
|
|
|
|
start-article (nth 2 elem)
|
|
|
|
permanent-flags (nth 3 elem)
|
2010-10-10 00:15:21 +00:00
|
|
|
uidvalidity (nth 4 elem)
|
|
|
|
vanished (nth 5 elem)
|
|
|
|
highestmodseq (nth 6 elem)
|
|
|
|
articles (nthcdr 7 elem))
|
2010-09-18 10:02:19 +00:00
|
|
|
(let ((high (caar articles))
|
|
|
|
marks low existing)
|
|
|
|
(dolist (article articles)
|
|
|
|
(setq low (car article))
|
|
|
|
(push (car article) existing)
|
|
|
|
(dolist (flag (cdr article))
|
|
|
|
(setq mark (assoc flag marks))
|
|
|
|
(if (not mark)
|
|
|
|
(push (list flag (car article)) marks)
|
2010-09-23 00:30:37 +00:00
|
|
|
(setcdr mark (cons (car article) (cdr mark))))))
|
|
|
|
(push (list group existing marks high low uidnext start-article
|
2010-10-10 00:15:21 +00:00
|
|
|
permanent-flags uidvalidity vanished highestmodseq)
|
2010-09-23 00:30:37 +00:00
|
|
|
data)))
|
2010-09-18 10:02:19 +00:00
|
|
|
data))
|
|
|
|
|
|
|
|
(defun nnimap-parse-flags (sequences)
|
|
|
|
(goto-char (point-min))
|
2010-09-23 00:30:37 +00:00
|
|
|
;; Change \Delete etc to %Delete, so that the reader can read it.
|
|
|
|
(subst-char-in-region (point-min) (point-max)
|
|
|
|
?\\ ?% t)
|
2011-03-15 22:38:41 +00:00
|
|
|
;; Remove any MODSEQ entries in the buffer, because they may contain
|
|
|
|
;; numbers that are too large for 32-bit Emacsen.
|
|
|
|
(while (re-search-forward " MODSEQ ([0-9]+)" nil t)
|
|
|
|
(replace-match "" t t))
|
|
|
|
(goto-char (point-min))
|
2010-10-10 00:15:21 +00:00
|
|
|
(let (start end articles groups uidnext elems permanent-flags
|
|
|
|
uidvalidity vanished highestmodseq)
|
2010-09-18 10:02:19 +00:00
|
|
|
(dolist (elem sequences)
|
2010-10-10 00:15:21 +00:00
|
|
|
(destructuring-bind (group-sequence flag-sequence totalp group command)
|
|
|
|
elem
|
2010-09-23 00:30:37 +00:00
|
|
|
(setq start (point))
|
2010-10-10 00:15:21 +00:00
|
|
|
(when (and
|
|
|
|
;; The EXAMINE was successful.
|
|
|
|
(search-forward (format "\n%d OK " group-sequence) nil t)
|
|
|
|
(progn
|
|
|
|
(forward-line 1)
|
|
|
|
(setq end (point))
|
|
|
|
(goto-char start)
|
|
|
|
(setq permanent-flags
|
|
|
|
(if (equal command "SELECT")
|
2010-09-23 00:30:37 +00:00
|
|
|
(and (search-forward "PERMANENTFLAGS "
|
2010-10-10 00:15:21 +00:00
|
|
|
(or end (point-min)) t)
|
|
|
|
(read (current-buffer)))
|
|
|
|
'not-scanned))
|
|
|
|
(goto-char start)
|
|
|
|
(setq uidnext
|
|
|
|
(and (search-forward "UIDNEXT "
|
|
|
|
(or end (point-min)) t)
|
|
|
|
(read (current-buffer))))
|
|
|
|
(goto-char start)
|
|
|
|
(setq uidvalidity
|
|
|
|
(and (re-search-forward "UIDVALIDITY \\([0-9]+\\)"
|
|
|
|
(or end (point-min)) t)
|
|
|
|
;; Store UIDVALIDITY as a string, as it's
|
|
|
|
;; too big for 32-bit Emacsen, usually.
|
|
|
|
(match-string 1)))
|
|
|
|
(goto-char start)
|
|
|
|
(setq vanished
|
|
|
|
(and (eq flag-sequence 'qresync)
|
2010-12-07 22:12:50 +00:00
|
|
|
(re-search-forward "^\\* VANISHED .* \\([0-9:,]+\\)"
|
2010-10-10 00:15:21 +00:00
|
|
|
(or end (point-min)) t)
|
|
|
|
(match-string 1)))
|
|
|
|
(goto-char start)
|
|
|
|
(setq highestmodseq
|
2011-03-15 22:38:41 +00:00
|
|
|
(and (re-search-forward "HIGHESTMODSEQ \\([0-9]+\\)"
|
2010-10-10 00:15:21 +00:00
|
|
|
(or end (point-min)) t)
|
2011-03-15 22:38:41 +00:00
|
|
|
(match-string 1)))
|
2010-10-10 00:15:21 +00:00
|
|
|
(goto-char end)
|
|
|
|
(forward-line -1))
|
|
|
|
;; The UID FETCH FLAGS was successful.
|
|
|
|
(or (eq flag-sequence 'qresync)
|
|
|
|
(search-forward (format "\n%d OK " flag-sequence) nil t)))
|
|
|
|
(if (eq flag-sequence 'qresync)
|
|
|
|
(progn
|
|
|
|
(goto-char start)
|
|
|
|
(setq start end))
|
|
|
|
(setq start (point))
|
|
|
|
(goto-char end))
|
2010-10-13 22:21:20 +00:00
|
|
|
(while (re-search-forward "^\\* [0-9]+ FETCH " start t)
|
2011-03-03 13:21:50 +00:00
|
|
|
(let ((p (point)))
|
2011-03-15 22:38:41 +00:00
|
|
|
(setq elems (read (current-buffer)))
|
2011-03-03 13:21:50 +00:00
|
|
|
(push (cons (cadr (memq 'UID elems))
|
|
|
|
(cadr (memq 'FLAGS elems)))
|
|
|
|
articles)))
|
2010-10-10 00:15:21 +00:00
|
|
|
(push (nconc (list group uidnext totalp permanent-flags uidvalidity
|
|
|
|
vanished highestmodseq)
|
|
|
|
articles)
|
2010-09-23 00:30:37 +00:00
|
|
|
groups)
|
2010-10-10 00:15:21 +00:00
|
|
|
(goto-char end)
|
2010-09-18 10:02:19 +00:00
|
|
|
(setq articles nil))))
|
|
|
|
groups))
|
|
|
|
|
|
|
|
(defun nnimap-find-process-buffer (buffer)
|
|
|
|
(cadr (assoc buffer nnimap-connection-alist)))
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
(deffoo nnimap-request-post (&optional server)
|
2010-09-18 10:02:19 +00:00
|
|
|
(setq nnimap-status-string "Read-only server")
|
|
|
|
nil)
|
2000-09-19 13:40:08 +00:00
|
|
|
|
2011-02-03 07:25:14 +00:00
|
|
|
(declare-function gnus-fetch-headers "gnus-sum"
|
|
|
|
(articles &optional limit force-new dependencies))
|
|
|
|
|
2011-07-14 14:19:53 +00:00
|
|
|
(deffoo nnimap-request-thread (header &optional group server)
|
|
|
|
(when (nnimap-possibly-change-group group server)
|
|
|
|
(let* ((id (mail-header-id header))
|
2010-12-06 22:16:10 +00:00
|
|
|
(refs (split-string
|
|
|
|
(or (mail-header-references header)
|
2010-11-07 00:22:06 +00:00
|
|
|
"")))
|
|
|
|
(cmd (let ((value
|
|
|
|
(format
|
|
|
|
"(OR HEADER REFERENCES %s HEADER Message-Id %s)"
|
|
|
|
id id)))
|
|
|
|
(dolist (refid refs value)
|
|
|
|
(setq value (format
|
|
|
|
"(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
|
|
|
|
refid refid value)))))
|
|
|
|
(result (with-current-buffer (nnimap-buffer)
|
|
|
|
(nnimap-command "UID SEARCH %s" cmd))))
|
2011-03-08 14:26:05 +00:00
|
|
|
(when result
|
|
|
|
(gnus-fetch-headers
|
|
|
|
(and (car result) (delete 0 (mapcar #'string-to-number
|
|
|
|
(cdr (assoc "SEARCH" (cdr result))))))
|
2011-07-14 14:19:53 +00:00
|
|
|
nil t)))))
|
2010-10-14 22:39:54 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-possibly-change-group (group server)
|
|
|
|
(let ((open-result t))
|
|
|
|
(when (and server
|
|
|
|
(not (nnimap-server-opened server)))
|
|
|
|
(setq open-result (nnimap-open-server server)))
|
|
|
|
(cond
|
|
|
|
((not open-result)
|
|
|
|
nil)
|
|
|
|
((not group)
|
|
|
|
t)
|
|
|
|
(t
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(if (equal group (nnimap-group nnimap-object))
|
|
|
|
t
|
|
|
|
(let ((result (nnimap-command "SELECT %S" (utf7-encode group t))))
|
|
|
|
(when (car result)
|
2010-09-18 23:36:29 +00:00
|
|
|
(setf (nnimap-group nnimap-object) group
|
|
|
|
(nnimap-select-result nnimap-object) result)
|
2010-09-18 10:02:19 +00:00
|
|
|
result))))))))
|
|
|
|
|
|
|
|
(defun nnimap-find-connection (buffer)
|
|
|
|
"Find the connection delivering to BUFFER."
|
|
|
|
(let ((entry (assoc buffer nnimap-connection-alist)))
|
|
|
|
(when entry
|
|
|
|
(if (and (buffer-name (cadr entry))
|
|
|
|
(get-buffer-process (cadr entry))
|
|
|
|
(memq (process-status (get-buffer-process (cadr entry)))
|
|
|
|
'(open run)))
|
|
|
|
(get-buffer-process (cadr entry))
|
|
|
|
(setq nnimap-connection-alist (delq entry nnimap-connection-alist))
|
|
|
|
nil))))
|
|
|
|
|
|
|
|
(defvar nnimap-sequence 0)
|
|
|
|
|
|
|
|
(defun nnimap-send-command (&rest args)
|
2011-02-14 04:23:59 +00:00
|
|
|
(setf (nnimap-last-command-time nnimap-object) (current-time))
|
2010-09-18 10:02:19 +00:00
|
|
|
(process-send-string
|
|
|
|
(get-buffer-process (current-buffer))
|
|
|
|
(nnimap-log-command
|
2010-09-18 23:36:29 +00:00
|
|
|
(format "%d %s%s\n"
|
2010-09-18 10:02:19 +00:00
|
|
|
(incf nnimap-sequence)
|
2010-09-18 23:36:29 +00:00
|
|
|
(apply #'format args)
|
|
|
|
(if (nnimap-newlinep nnimap-object)
|
|
|
|
""
|
|
|
|
"\r"))))
|
2010-10-24 22:32:38 +00:00
|
|
|
;; Some servers apparently can't have many outstanding
|
|
|
|
;; commands, so throttle them.
|
|
|
|
(unless nnimap-streaming
|
|
|
|
(nnimap-wait-for-response nnimap-sequence))
|
2010-09-18 10:02:19 +00:00
|
|
|
nnimap-sequence)
|
|
|
|
|
|
|
|
(defun nnimap-log-command (command)
|
|
|
|
(with-current-buffer (get-buffer-create "*imap log*")
|
|
|
|
(goto-char (point-max))
|
2011-02-14 04:23:59 +00:00
|
|
|
(insert (format-time-string "%H:%M:%S") " "
|
|
|
|
(if nnimap-inhibit-logging
|
2011-02-18 00:41:50 +00:00
|
|
|
"(inhibited)\n"
|
2011-02-14 04:23:59 +00:00
|
|
|
command)))
|
2010-09-18 10:02:19 +00:00
|
|
|
command)
|
|
|
|
|
|
|
|
(defun nnimap-command (&rest args)
|
|
|
|
(erase-buffer)
|
|
|
|
(let* ((sequence (apply #'nnimap-send-command args))
|
|
|
|
(response (nnimap-get-response sequence)))
|
|
|
|
(if (equal (caar response) "OK")
|
|
|
|
(cons t response)
|
|
|
|
(nnheader-report 'nnimap "%s"
|
2010-09-20 23:08:33 +00:00
|
|
|
(mapconcat (lambda (a)
|
|
|
|
(format "%s" a))
|
|
|
|
(car response) " "))
|
2010-09-18 10:02:19 +00:00
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun nnimap-get-response (sequence)
|
|
|
|
(nnimap-wait-for-response sequence)
|
|
|
|
(nnimap-parse-response))
|
|
|
|
|
2010-10-31 22:31:24 +00:00
|
|
|
(defun nnimap-wait-for-connection (&optional regexp)
|
2011-01-02 23:17:32 +00:00
|
|
|
(nnimap-wait-for-line (or regexp "^[*.] .*\n") "[*.] \\([A-Z0-9]+\\)"))
|
|
|
|
|
|
|
|
(defun nnimap-wait-for-line (regexp &optional response-regexp)
|
2010-09-18 23:36:29 +00:00
|
|
|
(let ((process (get-buffer-process (current-buffer))))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (and (memq (process-status process)
|
|
|
|
'(open run))
|
2010-10-31 22:31:24 +00:00
|
|
|
(not (re-search-forward regexp nil t)))
|
2010-09-18 23:36:29 +00:00
|
|
|
(nnheader-accept-process-output process)
|
|
|
|
(goto-char (point-min)))
|
2010-09-20 00:36:54 +00:00
|
|
|
(forward-line -1)
|
2011-01-02 23:17:32 +00:00
|
|
|
(and (looking-at (or response-regexp regexp))
|
2010-09-20 00:36:54 +00:00
|
|
|
(match-string 1))))
|
2010-09-18 23:36:29 +00:00
|
|
|
|
2010-09-18 10:02:19 +00:00
|
|
|
(defun nnimap-wait-for-response (sequence &optional messagep)
|
2010-09-26 04:03:19 +00:00
|
|
|
(let ((process (get-buffer-process (current-buffer)))
|
|
|
|
openp)
|
2010-10-10 22:48:40 +00:00
|
|
|
(condition-case nil
|
|
|
|
(progn
|
|
|
|
(goto-char (point-max))
|
|
|
|
(while (and (setq openp (memq (process-status process)
|
|
|
|
'(open run)))
|
2011-01-31 04:41:38 +00:00
|
|
|
(progn
|
|
|
|
;; Skip past any "*" lines that the server has
|
|
|
|
;; output.
|
|
|
|
(while (and (not (bobp))
|
|
|
|
(progn
|
|
|
|
(forward-line -1)
|
|
|
|
(looking-at "\\*"))))
|
2011-02-20 04:08:04 +00:00
|
|
|
(not (looking-at (format "%d .*\n" sequence)))))
|
2010-10-10 22:48:40 +00:00
|
|
|
(when messagep
|
2010-10-16 01:55:08 +00:00
|
|
|
(nnheader-message 7 "nnimap read %dk" (/ (buffer-size) 1000)))
|
2010-10-10 22:48:40 +00:00
|
|
|
(nnheader-accept-process-output process)
|
|
|
|
(goto-char (point-max)))
|
|
|
|
openp)
|
|
|
|
(quit
|
2011-03-15 22:38:41 +00:00
|
|
|
(when debug-on-quit
|
|
|
|
(debug "Quit"))
|
2010-10-10 22:48:40 +00:00
|
|
|
;; The user hit C-g while we were waiting: kill the process, in case
|
|
|
|
;; it's a gnutls-cli process that's stuck (tends to happen a lot behind
|
|
|
|
;; NAT routers).
|
|
|
|
(delete-process process)
|
|
|
|
nil))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-parse-response ()
|
|
|
|
(let ((lines (split-string (nnimap-last-response-string) "\r\n" t))
|
|
|
|
result)
|
|
|
|
(dolist (line lines)
|
|
|
|
(push (cdr (nnimap-parse-line line)) result))
|
|
|
|
;; Return the OK/error code first, and then all the "continuation
|
|
|
|
;; lines" afterwards.
|
|
|
|
(cons (pop result)
|
|
|
|
(nreverse result))))
|
|
|
|
|
|
|
|
;; Parse an IMAP response line lightly. They look like
|
|
|
|
;; "* OK [UIDVALIDITY 1164213559] UIDs valid", typically, so parse
|
|
|
|
;; the lines into a list of strings and lists of string.
|
|
|
|
(defun nnimap-parse-line (line)
|
|
|
|
(let (char result)
|
|
|
|
(with-temp-buffer
|
2010-10-19 00:13:27 +00:00
|
|
|
(mm-disable-multibyte)
|
2010-09-18 10:02:19 +00:00
|
|
|
(insert line)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(if (eql (setq char (following-char)) ? )
|
|
|
|
(forward-char 1)
|
|
|
|
(push
|
|
|
|
(cond
|
|
|
|
((eql char ?\[)
|
2010-10-10 00:15:21 +00:00
|
|
|
(split-string
|
|
|
|
(buffer-substring
|
|
|
|
(1+ (point))
|
2010-11-01 22:21:10 +00:00
|
|
|
(if (search-forward "]" (line-end-position) 'move)
|
|
|
|
(1- (point))
|
|
|
|
(point)))))
|
2010-09-18 10:02:19 +00:00
|
|
|
((eql char ?\()
|
2010-10-10 00:15:21 +00:00
|
|
|
(split-string
|
|
|
|
(buffer-substring
|
|
|
|
(1+ (point))
|
2010-11-01 22:21:10 +00:00
|
|
|
(if (search-forward ")" (line-end-position) 'move)
|
|
|
|
(1- (point))
|
|
|
|
(point)))))
|
2010-09-18 10:02:19 +00:00
|
|
|
((eql char ?\")
|
|
|
|
(forward-char 1)
|
2010-09-27 23:07:47 +00:00
|
|
|
(buffer-substring
|
|
|
|
(point)
|
|
|
|
(1- (or (search-forward "\"" (line-end-position) 'move)
|
|
|
|
(point)))))
|
2010-09-18 10:02:19 +00:00
|
|
|
(t
|
|
|
|
(buffer-substring (point) (if (search-forward " " nil t)
|
|
|
|
(1- (point))
|
|
|
|
(goto-char (point-max))))))
|
|
|
|
result)))
|
|
|
|
(nreverse result))))
|
|
|
|
|
|
|
|
(defun nnimap-last-response-string ()
|
|
|
|
(save-excursion
|
|
|
|
(forward-line 1)
|
|
|
|
(let ((end (point)))
|
|
|
|
(forward-line -1)
|
|
|
|
(when (not (bobp))
|
|
|
|
(forward-line -1)
|
|
|
|
(while (and (not (bobp))
|
|
|
|
(eql (following-char) ?*))
|
|
|
|
(forward-line -1))
|
|
|
|
(unless (eql (following-char) ?*)
|
|
|
|
(forward-line 1)))
|
|
|
|
(buffer-substring (point) end))))
|
|
|
|
|
|
|
|
(defun nnimap-get-responses (sequences)
|
|
|
|
(let (responses)
|
|
|
|
(dolist (sequence sequences)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(when (re-search-forward (format "^%d " sequence) nil t)
|
|
|
|
(push (list sequence (nnimap-parse-response))
|
|
|
|
responses)))
|
|
|
|
responses))
|
|
|
|
|
|
|
|
(defvar nnimap-incoming-split-list nil)
|
|
|
|
|
|
|
|
(defun nnimap-fetch-inbox (articles)
|
|
|
|
(erase-buffer)
|
|
|
|
(nnimap-wait-for-response
|
|
|
|
(nnimap-send-command
|
|
|
|
"UID FETCH %s %s"
|
|
|
|
(nnimap-article-ranges articles)
|
|
|
|
(format "(UID %s%s)"
|
|
|
|
(format
|
2010-09-26 04:03:19 +00:00
|
|
|
(if (nnimap-ver4-p)
|
2011-03-18 13:45:04 +00:00
|
|
|
"BODY.PEEK"
|
2010-09-18 10:02:19 +00:00
|
|
|
"RFC822.PEEK"))
|
2011-03-18 13:45:04 +00:00
|
|
|
(cond
|
|
|
|
(nnimap-split-download-body-default
|
|
|
|
"[]")
|
|
|
|
((nnimap-ver4-p)
|
|
|
|
"[HEADER]")
|
|
|
|
(t
|
|
|
|
"[1]"))))
|
2010-09-18 10:02:19 +00:00
|
|
|
t))
|
|
|
|
|
|
|
|
(defun nnimap-split-incoming-mail ()
|
|
|
|
(with-current-buffer (nnimap-buffer)
|
|
|
|
(let ((nnimap-incoming-split-list nil)
|
2011-06-30 10:04:56 +00:00
|
|
|
(nnmail-split-methods
|
|
|
|
(cond
|
|
|
|
((eq nnimap-split-methods 'default)
|
|
|
|
nnmail-split-methods)
|
|
|
|
(nnimap-split-methods
|
|
|
|
nnimap-split-methods)
|
|
|
|
(nnimap-split-fancy
|
|
|
|
'nnmail-split-fancy)))
|
2010-10-01 00:25:50 +00:00
|
|
|
(nnmail-split-fancy (or nnimap-split-fancy
|
|
|
|
nnmail-split-fancy))
|
2010-09-18 10:02:19 +00:00
|
|
|
(nnmail-inhibit-default-split-group t)
|
|
|
|
(groups (nnimap-get-groups))
|
|
|
|
new-articles)
|
|
|
|
(erase-buffer)
|
|
|
|
(nnimap-command "SELECT %S" nnimap-inbox)
|
2010-10-30 05:59:34 +00:00
|
|
|
(setf (nnimap-group nnimap-object) nnimap-inbox)
|
2010-09-18 10:02:19 +00:00
|
|
|
(setq new-articles (nnimap-new-articles (nnimap-get-flags "1:*")))
|
|
|
|
(when new-articles
|
|
|
|
(nnimap-fetch-inbox new-articles)
|
|
|
|
(nnimap-transform-split-mail)
|
|
|
|
(nnheader-ms-strip-cr)
|
|
|
|
(nnmail-cache-open)
|
|
|
|
(nnmail-split-incoming (current-buffer)
|
|
|
|
#'nnimap-save-mail-spec
|
|
|
|
nil nil
|
2010-09-23 00:30:37 +00:00
|
|
|
#'nnimap-dummy-active-number
|
|
|
|
#'nnimap-save-mail-spec)
|
2010-09-18 10:02:19 +00:00
|
|
|
(when nnimap-incoming-split-list
|
|
|
|
(let ((specs (nnimap-make-split-specs nnimap-incoming-split-list))
|
2010-09-23 00:30:37 +00:00
|
|
|
sequences junk-articles)
|
2010-09-18 10:02:19 +00:00
|
|
|
;; Create any groups that doesn't already exist on the
|
|
|
|
;; server first.
|
|
|
|
(dolist (spec specs)
|
2010-09-23 00:30:37 +00:00
|
|
|
(when (and (not (member (car spec) groups))
|
|
|
|
(not (eq (car spec) 'junk)))
|
2010-09-18 10:02:19 +00:00
|
|
|
(nnimap-command "CREATE %S" (utf7-encode (car spec) t))))
|
|
|
|
;; Then copy over all the messages.
|
|
|
|
(erase-buffer)
|
|
|
|
(dolist (spec specs)
|
|
|
|
(let ((group (car spec))
|
|
|
|
(ranges (cdr spec)))
|
2010-09-23 00:30:37 +00:00
|
|
|
(if (eq group 'junk)
|
|
|
|
(setq junk-articles ranges)
|
|
|
|
(push (list (nnimap-send-command
|
|
|
|
"UID COPY %s %S"
|
|
|
|
(nnimap-article-ranges ranges)
|
|
|
|
(utf7-encode group t))
|
|
|
|
ranges)
|
|
|
|
sequences))))
|
2010-09-18 10:02:19 +00:00
|
|
|
;; Wait for the last COPY response...
|
|
|
|
(when sequences
|
|
|
|
(nnimap-wait-for-response (caar sequences))
|
|
|
|
;; And then mark the successful copy actions as deleted,
|
|
|
|
;; and possibly expunge them.
|
|
|
|
(nnimap-mark-and-expunge-incoming
|
2010-09-24 22:33:34 +00:00
|
|
|
(nnimap-parse-copied-articles sequences)))
|
|
|
|
(nnimap-mark-and-expunge-incoming junk-articles)))))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-mark-and-expunge-incoming (range)
|
|
|
|
(when range
|
|
|
|
(setq range (nnimap-article-ranges range))
|
Merge changes made in Gnus trunk.
nndraft.el (nndraft-request-expire-articles): Use the group name instead if "nndraft".
gnus.texi (Using IMAP): Remove the @acronyms from the headings.
nnregistry.el: Added.
nnimap.el (nnimap-insert-partial-structure): Be way more permissive when interpreting the structures.
GNUS-NEWS: Minor error in GNUS-NEWS - password-cache.el.
nnimap.el (nnimap-request-accept-article): Add \r\n to the lines to make this work with Cyrus.
gnus-registry.el: Don't prompt on load, which makes it impossible to build Gnus.
gnus-gravatar.el: Add gnus-gravatar-properties.
gnus-agent.el, gnus-art.el, gnus-bookmark.el, gnus-dired.el, gnus-group.el,\
gnus-int.el, gnus-msg.el, gnus-registry.el, gnus-score.el, gnus-srvr.el,\
gnus-sum.el, gnus-topic.el, gnus-util.el, gnus.el, mm-decode.el, mm-util.el,\
mm-view.el, mml-smime.el, mml.el, nnmairix.el, nnrss.el, smime.el:\
Introduce gnus-completing-read.
gnus-util.el: Make completing-read function configurable.
gnus-util.el: Add requires and fix history for iswitchb.
webmail.el: Remove netscape/my-deja, since they no longer exist.
gnus.el (gnus-local-domain): Declare variable obsolete.
nnimap.el (nnimap-insert-partial-structure): Get the type from the correct slot, too.
pop3.el (pop3-send-streaming-command, pop3-stream-length): New variable.
nnimap.el (nnimap-open-connection): Revert the auto-network->starttls code.
nnimap.el (nnimap-request-set-mark): Erase the buffer before issuing commands.
nnimap.el (nnimap-split-rule): Mark as obsolete.
gnus-sum.el (gnus-valid-move-group-p): Make sure that `group' is a symbol.
nnimap.el (nnimap-split-incoming-mail): Allow `default' as nnimap-split-methods value.
nnimap.el (nnimap-request-article): Downcase the NILs so that they are nil.
nndoc.el (nndoc-retrieve-groups): New function.
gnus.texi: Fix Gravatar documentation.
2010-09-30 08:39:23 +00:00
|
|
|
(erase-buffer)
|
2010-09-21 23:13:46 +00:00
|
|
|
(let ((sequence
|
|
|
|
(nnimap-send-command
|
|
|
|
"UID STORE %s +FLAGS.SILENT (\\Deleted)" range)))
|
|
|
|
(cond
|
|
|
|
;; If the server supports it, we now delete the message we have
|
|
|
|
;; just copied over.
|
2010-10-31 22:31:24 +00:00
|
|
|
((nnimap-capability "UIDPLUS")
|
2010-09-21 23:13:46 +00:00
|
|
|
(setq sequence (nnimap-send-command "UID EXPUNGE %s" range)))
|
|
|
|
;; If it doesn't support UID EXPUNGE, then we only expunge if the
|
|
|
|
;; user has configured it.
|
2010-09-23 00:30:37 +00:00
|
|
|
(nnimap-expunge
|
2010-09-21 23:13:46 +00:00
|
|
|
(setq sequence (nnimap-send-command "EXPUNGE"))))
|
|
|
|
(nnimap-wait-for-response sequence))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-parse-copied-articles (sequences)
|
|
|
|
(let (sequence copied range)
|
|
|
|
(goto-char (point-min))
|
2011-02-19 09:45:07 +00:00
|
|
|
(while (re-search-forward "^\\([0-9]+\\) OK\\b" nil t)
|
2010-09-18 10:02:19 +00:00
|
|
|
(setq sequence (string-to-number (match-string 1)))
|
|
|
|
(when (setq range (cadr (assq sequence sequences)))
|
|
|
|
(push (gnus-uncompress-range range) copied)))
|
|
|
|
(gnus-compress-sequence (sort (apply #'nconc copied) #'<))))
|
|
|
|
|
|
|
|
(defun nnimap-new-articles (flags)
|
|
|
|
(let (new)
|
|
|
|
(dolist (elem flags)
|
2010-10-30 05:59:34 +00:00
|
|
|
(unless (gnus-list-memq-of-list nnimap-unsplittable-articles
|
|
|
|
(cdr elem))
|
2010-09-18 10:02:19 +00:00
|
|
|
(push (car elem) new)))
|
|
|
|
(gnus-compress-sequence (nreverse new))))
|
|
|
|
|
|
|
|
(defun nnimap-make-split-specs (list)
|
|
|
|
(let ((specs nil)
|
|
|
|
entry)
|
|
|
|
(dolist (elem list)
|
|
|
|
(destructuring-bind (article spec) elem
|
|
|
|
(dolist (group (delete nil (mapcar #'car spec)))
|
|
|
|
(unless (setq entry (assoc group specs))
|
|
|
|
(push (setq entry (list group)) specs))
|
|
|
|
(setcdr entry (cons article (cdr entry))))))
|
|
|
|
(dolist (entry specs)
|
|
|
|
(setcdr entry (gnus-compress-sequence (sort (cdr entry) #'<))))
|
|
|
|
specs))
|
|
|
|
|
|
|
|
(defun nnimap-transform-split-mail ()
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let (article bytes)
|
|
|
|
(block nil
|
|
|
|
(while (not (eobp))
|
2011-05-30 22:11:52 +00:00
|
|
|
(while (not (looking-at "\\* [0-9]+ FETCH.+UID \\([0-9]+\\)"))
|
2010-09-18 10:02:19 +00:00
|
|
|
(delete-region (point) (progn (forward-line 1) (point)))
|
|
|
|
(when (eobp)
|
|
|
|
(return)))
|
|
|
|
(setq article (match-string 1)
|
|
|
|
bytes (nnimap-get-length))
|
|
|
|
(delete-region (line-beginning-position) (line-end-position))
|
|
|
|
;; Insert MMDF separator, and a way to remember what this
|
|
|
|
;; article UID is.
|
|
|
|
(insert (format "\^A\^A\^A\^A\n\nX-nnimap-article: %s" article))
|
|
|
|
(forward-char (1+ bytes))
|
|
|
|
(setq bytes (nnimap-get-length))
|
|
|
|
(delete-region (line-beginning-position) (line-end-position))
|
2010-10-11 22:27:28 +00:00
|
|
|
;; There's a body; skip past that.
|
|
|
|
(when bytes
|
|
|
|
(forward-char (1+ bytes))
|
|
|
|
(delete-region (line-beginning-position) (line-end-position)))))))
|
2010-09-18 10:02:19 +00:00
|
|
|
|
|
|
|
(defun nnimap-dummy-active-number (group &optional server)
|
|
|
|
1)
|
|
|
|
|
|
|
|
(defun nnimap-save-mail-spec (group-art &optional server full-nov)
|
|
|
|
(let (article)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(if (not (re-search-forward "X-nnimap-article: \\([0-9]+\\)" nil t))
|
|
|
|
(error "Invalid nnimap mail")
|
|
|
|
(setq article (string-to-number (match-string 1))))
|
2010-09-23 00:30:37 +00:00
|
|
|
(push (list article
|
|
|
|
(if (eq group-art 'junk)
|
|
|
|
(list (cons 'junk 1))
|
|
|
|
group-art))
|
2010-09-18 10:02:19 +00:00
|
|
|
nnimap-incoming-split-list)))
|
2000-09-19 13:40:08 +00:00
|
|
|
|
|
|
|
(provide 'nnimap)
|
|
|
|
|
|
|
|
;;; nnimap.el ends here
|