aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-09-14 23:14:44 +0000
committerKatsumi Yamaoka2010-09-14 23:14:44 +0000
commit01e80360d0b8390327ac30bbb37230970a7c1ddc (patch)
tree4e62078848ced825d97db8010c30af73351312d3 /lisp
parent3b59c3511cb74d944730b8156bbfd3bd7d8aa69f (diff)
downloademacs-01e80360d0b8390327ac30bbb37230970a7c1ddc.tar.gz
emacs-01e80360d0b8390327ac30bbb37230970a7c1ddc.zip
Merge changes made in Gnus trunk.
imap.el: Revert back to version cb950ed8ff3e0f40dac437a51b269166f9ffb60d, since some of the changes seem problematic. Fix up the w3m/curl dependencies. mm-decode.el (mm-text-html-renderer): Don't have gnus-article-html depend on curl, which isn't essential. gnus-html.el (gnus-html-schedule-image-fetching, gnus-html-prefetch-images): Check for curl before using it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/gnus/ChangeLog12
-rw-r--r--lisp/gnus/gnus-html.el28
-rw-r--r--lisp/gnus/mm-decode.el4
-rw-r--r--lisp/net/imap.el240
5 files changed, 233 insertions, 57 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b18c6c78172..28d197d92be 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-09-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * net/imap.el: Revert back to version
4 cb950ed8ff3e0f40dac437a51b269166f9ffb60d, since some of the changes
5 seem problematic.
6
12010-09-14 Juanma Barranquero <lekktu@gmail.com> 72010-09-14 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * obsolete/old-whitespace.el (whitespace-unload-function): 9 * obsolete/old-whitespace.el (whitespace-unload-function):
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 7bb141ccfc0..8e2309f43a8 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,15 @@
12010-09-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus-html.el (gnus-html-schedule-image-fetching)
4 (gnus-html-prefetch-images): Check for curl before using it.
5
6 * mm-decode.el (mm-text-html-renderer): Don't have gnus-article-html
7 depend on curl, which isn't essential.
8
9 * imap.el: Revert back to version
10 cb950ed8ff3e0f40dac437a51b269166f9ffb60d, since some of the changes
11 seem problematic.
12
12010-09-14 Juanma Barranquero <lekktu@gmail.com> 132010-09-14 Juanma Barranquero <lekktu@gmail.com>
2 14
3 * gnus-registry.el (gnus-registry-install-shortcuts): 15 * gnus-registry.el (gnus-registry-install-shortcuts):
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index 8bfbaaa5279..ffa5ff1acdd 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -288,18 +288,19 @@ fit these criteria."
288(defun gnus-html-schedule-image-fetching (buffer images) 288(defun gnus-html-schedule-image-fetching (buffer images)
289 (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s" 289 (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s"
290 buffer images) 290 buffer images)
291 (let* ((url (caar images)) 291 (when (executable-find "curl")
292 (process (start-process 292 (let* ((url (caar images))
293 "images" nil "curl" 293 (process (start-process
294 "-s" "--create-dirs" 294 "images" nil "curl"
295 "--location" 295 "-s" "--create-dirs"
296 "--max-time" "60" 296 "--location"
297 "-o" (gnus-html-image-id url) 297 "--max-time" "60"
298 (mm-url-decode-entities-string url)))) 298 "-o" (gnus-html-image-id url)
299 (process-kill-without-query process) 299 (mm-url-decode-entities-string url))))
300 (set-process-sentinel process 'gnus-html-curl-sentinel) 300 (process-kill-without-query process)
301 (gnus-set-process-plist process (list 'images images 301 (set-process-sentinel process 'gnus-html-curl-sentinel)
302 'buffer buffer)))) 302 (gnus-set-process-plist process (list 'images images
303 'buffer buffer)))))
303 304
304(defun gnus-html-image-id (url) 305(defun gnus-html-image-id (url)
305 (expand-file-name (sha1 url) gnus-html-cache-directory)) 306 (expand-file-name (sha1 url) gnus-html-cache-directory))
@@ -441,7 +442,8 @@ This only works if the article in question is HTML."
441;;;###autoload 442;;;###autoload
442(defun gnus-html-prefetch-images (summary) 443(defun gnus-html-prefetch-images (summary)
443 (let (blocked-images urls) 444 (let (blocked-images urls)
444 (when (buffer-live-p summary) 445 (when (and (buffer-live-p summary)
446 (executable-find "curl"))
445 (with-current-buffer summary 447 (with-current-buffer summary
446 (setq blocked-images gnus-blocked-images)) 448 (setq blocked-images gnus-blocked-images))
447 (save-match-data 449 (save-match-data
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 725adcf559c..c4cbce4abaf 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -105,9 +105,7 @@
105 ,disposition ,description ,cache ,id)) 105 ,disposition ,description ,cache ,id))
106 106
107(defcustom mm-text-html-renderer 107(defcustom mm-text-html-renderer
108 (cond ((and (executable-find "w3m") 108 (cond ((executable-find "w3m") 'gnus-article-html)
109 (executable-find "curl"))
110 'gnus-article-html)
111 ((executable-find "links") 'links) 109 ((executable-find "links") 'links)
112 ((executable-find "lynx") 'lynx) 110 ((executable-find "lynx") 'lynx)
113 ((locate-library "w3") 'w3) 111 ((locate-library "w3") 'w3)
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index e286a14a0e4..ed72d7b9ce0 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -448,6 +448,18 @@ The actual value is really the text on the continuation line.")
448The function should take two arguments, the first the IMAP tag and the 448The function should take two arguments, the first the IMAP tag and the
449second the status (OK, NO, BAD etc) of the command.") 449second the status (OK, NO, BAD etc) of the command.")
450 450
451(defvar imap-enable-exchange-bug-workaround nil
452 "Send FETCH UID commands as *:* instead of *.
453
454When non-nil, use an alternative UIDS form. Enabling appears to
455be required for some servers (e.g., Microsoft Exchange 2007)
456which otherwise would trigger a response 'BAD The specified
457message set is invalid.'. We don't unconditionally use this
458form, since this is said to be significantly inefficient.
459
460This variable is set to t automatically per server if the
461canonical form fails.")
462
451 463
452;; Utility functions: 464;; Utility functions:
453 465
@@ -1303,38 +1315,40 @@ If BUFFER is nil, the current buffer is assumed."
1303 1315
1304;; Mailbox functions: 1316;; Mailbox functions:
1305 1317
1306(defun imap-mailbox-put (propname value &optional mailbox) 1318(defun imap-mailbox-put (propname value &optional mailbox buffer)
1307 (if imap-mailbox-data 1319 (with-current-buffer (or buffer (current-buffer))
1308 (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data) 1320 (if imap-mailbox-data
1309 propname value) 1321 (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
1310 (error "Imap-mailbox-data is nil, prop %s value %s mailbox %s buffer %s" 1322 propname value)
1311 propname value mailbox (current-buffer))) 1323 (error "Imap-mailbox-data is nil, prop %s value %s mailbox %s buffer %s"
1312 t) 1324 propname value mailbox (current-buffer)))
1325 t))
1313 1326
1314(defsubst imap-mailbox-get-1 (propname &optional mailbox) 1327(defsubst imap-mailbox-get-1 (propname &optional mailbox)
1315 (get (intern-soft (or mailbox imap-current-mailbox) imap-mailbox-data) 1328 (get (intern-soft (or mailbox imap-current-mailbox) imap-mailbox-data)
1316 propname)) 1329 propname))
1317 1330
1318(defun imap-mailbox-get (propname &optional mailbox buffer) 1331(defun imap-mailbox-get (propname &optional mailbox buffer)
1332 (let ((mailbox (imap-utf7-encode mailbox)))
1333 (with-current-buffer (or buffer (current-buffer))
1334 (imap-mailbox-get-1 propname (or mailbox imap-current-mailbox)))))
1335
1336(defun imap-mailbox-map-1 (func &optional mailbox-decoder buffer)
1319 (with-current-buffer (or buffer (current-buffer)) 1337 (with-current-buffer (or buffer (current-buffer))
1320 (imap-mailbox-get-1 propname (or (imap-utf7-encode mailbox) 1338 (let (result)
1321 imap-current-mailbox)))) 1339 (mapatoms
1322 1340 (lambda (s)
1323(defun imap-mailbox-map-1 (func &optional mailbox-decoder) 1341 (push (funcall func (if mailbox-decoder
1324 (let (result) 1342 (funcall mailbox-decoder (symbol-name s))
1325 (mapatoms 1343 (symbol-name s))) result))
1326 (lambda (s) 1344 imap-mailbox-data)
1327 (push (funcall func (if mailbox-decoder 1345 result)))
1328 (funcall mailbox-decoder (symbol-name s)) 1346
1329 (symbol-name s))) result)) 1347(defun imap-mailbox-map (func &optional buffer)
1330 imap-mailbox-data)
1331 result))
1332
1333(defun imap-mailbox-map (func)
1334 "Map a function across each mailbox in `imap-mailbox-data', returning a list. 1348 "Map a function across each mailbox in `imap-mailbox-data', returning a list.
1335Function should take a mailbox name (a string) as 1349Function should take a mailbox name (a string) as
1336the only argument." 1350the only argument."
1337 (imap-mailbox-map-1 func 'imap-utf7-decode)) 1351 (imap-mailbox-map-1 func 'imap-utf7-decode buffer))
1338 1352
1339(defun imap-current-mailbox (&optional buffer) 1353(defun imap-current-mailbox (&optional buffer)
1340 (with-current-buffer (or buffer (current-buffer)) 1354 (with-current-buffer (or buffer (current-buffer))
@@ -1648,26 +1662,29 @@ is non-nil return these properties."
1648 uids) 1662 uids)
1649 (imap-message-get uids receive)))))) 1663 (imap-message-get uids receive))))))
1650 1664
1651(defun imap-message-put (uid propname value) 1665(defun imap-message-put (uid propname value &optional buffer)
1652 (if imap-message-data 1666 (with-current-buffer (or buffer (current-buffer))
1653 (put (intern (number-to-string uid) imap-message-data) 1667 (if imap-message-data
1654 propname value) 1668 (put (intern (number-to-string uid) imap-message-data)
1655 (error "Imap-message-data is nil, uid %s prop %s value %s buffer %s" 1669 propname value)
1656 uid propname value (current-buffer))) 1670 (error "Imap-message-data is nil, uid %s prop %s value %s buffer %s"
1657 t) 1671 uid propname value (current-buffer)))
1672 t))
1658 1673
1659(defun imap-message-get (uid propname) 1674(defun imap-message-get (uid propname &optional buffer)
1660 (get (intern-soft (number-to-string uid) imap-message-data) 1675 (with-current-buffer (or buffer (current-buffer))
1661 propname)) 1676 (get (intern-soft (number-to-string uid) imap-message-data)
1677 propname)))
1662 1678
1663(defun imap-message-map (func propname) 1679(defun imap-message-map (func propname &optional buffer)
1664 "Map a function across each message in `imap-message-data', returning a list." 1680 "Map a function across each message in `imap-message-data', returning a list."
1665 (let (result) 1681 (with-current-buffer (or buffer (current-buffer))
1666 (mapatoms 1682 (let (result)
1667 (lambda (s) 1683 (mapatoms
1668 (push (funcall func (get s 'UID) (get s propname)) result)) 1684 (lambda (s)
1669 imap-message-data) 1685 (push (funcall func (get s 'UID) (get s propname)) result))
1670 result)) 1686 imap-message-data)
1687 result)))
1671 1688
1672(defmacro imap-message-envelope-date (uid &optional buffer) 1689(defmacro imap-message-envelope-date (uid &optional buffer)
1673 `(with-current-buffer (or ,buffer (current-buffer)) 1690 `(with-current-buffer (or ,buffer (current-buffer))
@@ -1763,6 +1780,48 @@ is non-nil return these properties."
1763 (format "String %s cannot be converted to a Lisp integer" number)) 1780 (format "String %s cannot be converted to a Lisp integer" number))
1764 number))) 1781 number)))
1765 1782
1783(defun imap-fetch-safe (uids props &optional receive nouidfetch buffer)
1784 "Like `imap-fetch', but DTRT with Exchange 2007 bug.
1785However, UIDS here is a cons, where the car is the canonical form
1786of the UIDS specification, and the cdr is the one which works with
1787Exchange 2007 or, potentially, other buggy servers.
1788See `imap-enable-exchange-bug-workaround'."
1789 ;; The first time we get here for a given, we'll try the canonical
1790 ;; form. If we get the known error from the buggy server, set the
1791 ;; flag buffer-locally (to account for connections to multiple
1792 ;; servers), then re-try with the alternative UIDS spec. We don't
1793 ;; unconditionally use the alternative form, since the
1794 ;; currently-used alternatives are seriously inefficient with some
1795 ;; servers (although they are valid).
1796 ;;
1797 ;; FIXME: Maybe it would be cleaner to have a flag to not signal
1798 ;; the error (which otherwise gives a message), and test
1799 ;; `imap-failed-tags'. Also, Other IMAP clients use other forms of
1800 ;; request which work with Exchange, e.g. Claws does "UID FETCH 1:*
1801 ;; (UID)" rather than "FETCH UID 1,*". Is there a good reason not
1802 ;; to do the same?
1803 (condition-case data
1804 ;; Binding `debug-on-error' allows us to get the error from
1805 ;; `imap-parse-response' -- it's normally caught by Emacs around
1806 ;; execution of a process filter.
1807 (let ((debug-on-error t))
1808 (imap-fetch (if imap-enable-exchange-bug-workaround
1809 (cdr uids)
1810 (car uids))
1811 props receive nouidfetch buffer))
1812 (error
1813 (if (and (not imap-enable-exchange-bug-workaround)
1814 ;; This is the Exchange 2007 response. It may be more
1815 ;; robust just to check for a BAD response to the
1816 ;; attempted fetch.
1817 (string-match "The specified message set is invalid"
1818 (cadr data)))
1819 (with-current-buffer (or buffer (current-buffer))
1820 (set (make-local-variable 'imap-enable-exchange-bug-workaround)
1821 t)
1822 (imap-fetch (cdr uids) props receive nouidfetch))
1823 (signal (car data) (cdr data))))))
1824
1766(defun imap-message-copyuid-1 (mailbox) 1825(defun imap-message-copyuid-1 (mailbox)
1767 (if (imap-capability 'UIDPLUS) 1826 (if (imap-capability 'UIDPLUS)
1768 (list (nth 0 (imap-mailbox-get-1 'copyuid mailbox)) 1827 (list (nth 0 (imap-mailbox-get-1 'copyuid mailbox))
@@ -1772,7 +1831,7 @@ is non-nil return these properties."
1772 (imap-message-data (make-vector 2 0))) 1831 (imap-message-data (make-vector 2 0)))
1773 (when (imap-mailbox-examine-1 mailbox) 1832 (when (imap-mailbox-examine-1 mailbox)
1774 (prog1 1833 (prog1
1775 (and (imap-fetch "*:*" "UID") 1834 (and (imap-fetch-safe '("*" . "*:*") "UID")
1776 (list (imap-mailbox-get-1 'uidvalidity mailbox) 1835 (list (imap-mailbox-get-1 'uidvalidity mailbox)
1777 (apply 'max (imap-message-map 1836 (apply 'max (imap-message-map
1778 (lambda (uid prop) uid) 'UID)))) 1837 (lambda (uid prop) uid) 'UID))))
@@ -1818,7 +1877,7 @@ first element. The rest of list contains the saved articles' UIDs."
1818 (imap-message-data (make-vector 2 0))) 1877 (imap-message-data (make-vector 2 0)))
1819 (when (imap-mailbox-examine-1 mailbox) 1878 (when (imap-mailbox-examine-1 mailbox)
1820 (prog1 1879 (prog1
1821 (and (imap-fetch "*:*" "UID") 1880 (and (imap-fetch-safe '("*" . "*:*") "UID")
1822 (list (imap-mailbox-get-1 'uidvalidity mailbox) 1881 (list (imap-mailbox-get-1 'uidvalidity mailbox)
1823 (apply 'max (imap-message-map 1882 (apply 'max (imap-message-map
1824 (lambda (uid prop) uid) 'UID)))) 1883 (lambda (uid prop) uid) 'UID))))
@@ -2892,6 +2951,105 @@ Return nil if no complete line has arrived."
2892 (imap-forward) 2951 (imap-forward)
2893 (nreverse body))))) 2952 (nreverse body)))))
2894 2953
2954(when imap-debug ; (untrace-all)
2955 (require 'trace)
2956 (buffer-disable-undo (get-buffer-create imap-debug-buffer))
2957 (mapc (lambda (f) (trace-function-background f imap-debug-buffer))
2958 '(
2959 imap-utf7-encode
2960 imap-utf7-decode
2961 imap-error-text
2962 imap-kerberos4s-p
2963 imap-kerberos4-open
2964 imap-ssl-p
2965 imap-ssl-open
2966 imap-network-p
2967 imap-network-open
2968 imap-interactive-login
2969 imap-kerberos4a-p
2970 imap-kerberos4-auth
2971 imap-cram-md5-p
2972 imap-cram-md5-auth
2973 imap-login-p
2974 imap-login-auth
2975 imap-anonymous-p
2976 imap-anonymous-auth
2977 imap-open-1
2978 imap-open
2979 imap-opened
2980 imap-ping-server
2981 imap-authenticate
2982 imap-close
2983 imap-capability
2984 imap-namespace
2985 imap-send-command-wait
2986 imap-mailbox-put
2987 imap-mailbox-get
2988 imap-mailbox-map-1
2989 imap-mailbox-map
2990 imap-current-mailbox
2991 imap-current-mailbox-p-1
2992 imap-current-mailbox-p
2993 imap-mailbox-select-1
2994 imap-mailbox-select
2995 imap-mailbox-examine-1
2996 imap-mailbox-examine
2997 imap-mailbox-unselect
2998 imap-mailbox-expunge
2999 imap-mailbox-close
3000 imap-mailbox-create-1
3001 imap-mailbox-create
3002 imap-mailbox-delete
3003 imap-mailbox-rename
3004 imap-mailbox-lsub
3005 imap-mailbox-list
3006 imap-mailbox-subscribe
3007 imap-mailbox-unsubscribe
3008 imap-mailbox-status
3009 imap-mailbox-acl-get
3010 imap-mailbox-acl-set
3011 imap-mailbox-acl-delete
3012 imap-current-message
3013 imap-list-to-message-set
3014 imap-fetch-asynch
3015 imap-fetch
3016 imap-fetch-safe
3017 imap-message-put
3018 imap-message-get
3019 imap-message-map
3020 imap-search
3021 imap-message-flag-permanent-p
3022 imap-message-flags-set
3023 imap-message-flags-del
3024 imap-message-flags-add
3025 imap-message-copyuid-1
3026 imap-message-copyuid
3027 imap-message-copy
3028 imap-message-appenduid-1
3029 imap-message-appenduid
3030 imap-message-append
3031 imap-body-lines
3032 imap-envelope-from
3033 imap-send-command-1
3034 imap-send-command
3035 imap-wait-for-tag
3036 imap-sentinel
3037 imap-find-next-line
3038 imap-arrival-filter
3039 imap-parse-greeting
3040 imap-parse-response
3041 imap-parse-resp-text
3042 imap-parse-resp-text-code
3043 imap-parse-data-list
3044 imap-parse-fetch
3045 imap-parse-status
3046 imap-parse-acl
3047 imap-parse-flag-list
3048 imap-parse-envelope
3049 imap-parse-body-extension
3050 imap-parse-body
3051 )))
3052
2895(provide 'imap) 3053(provide 'imap)
2896 3054
2897;;; imap.el ends here 3055;;; imap.el ends here