comparison lisp/gnus/nnimap.el @ 100124:d0077257129f

(nnimap-retrieve-headers-progress): Don't use nnimap-demule since the result is inserted in a unibyte buffer anyway. (nnimap-demule-use-string-to-multibyte): Remove. (nnimap-demule): Alias it to mm-string-to-multibyte.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 02 Dec 2008 22:29:13 +0000
parents d13d583ff5cc
children 1d5b4a08955f
comparison
equal deleted inserted replaced
100123:4077e9ff754f 100124:d0077257129f
606 (with-current-buffer nntp-server-buffer 606 (with-current-buffer nntp-server-buffer
607 (let (headers lines chars uid mbx) 607 (let (headers lines chars uid mbx)
608 (with-current-buffer nnimap-server-buffer 608 (with-current-buffer nnimap-server-buffer
609 (setq uid imap-current-message 609 (setq uid imap-current-message
610 mbx imap-current-mailbox 610 mbx imap-current-mailbox
611 headers (nnimap-demule 611 headers (if (imap-capability 'IMAP4rev1)
612 (if (imap-capability 'IMAP4rev1) 612 ;; xxx don't just use car? alist doesn't contain
613 ;; xxx don't just use car? alist doesn't contain 613 ;; anything else now, but it might...
614 ;; anything else now, but it might... 614 (nth 2 (car (imap-message-get uid 'BODYDETAIL)))
615 (nth 2 (car (imap-message-get uid 'BODYDETAIL))) 615 (imap-message-get uid 'RFC822.HEADER))
616 (imap-message-get uid 'RFC822.HEADER)))
617 lines (imap-body-lines (imap-message-body imap-current-message)) 616 lines (imap-body-lines (imap-message-body imap-current-message))
618 chars (imap-message-get imap-current-message 'RFC822.SIZE))) 617 chars (imap-message-get imap-current-message 'RFC822.SIZE)))
619 (nnheader-insert-nov 618 (nnheader-insert-nov
620 ;; At this stage, we only have bytes, so let's use unibyte buffers 619 ;; At this stage, we only have bytes, so let's use unibyte buffers
621 ;; to make it more clear. 620 ;; to make it more clear.
899 (deffoo nnimap-status-message (&optional server) 898 (deffoo nnimap-status-message (&optional server)
900 "This function returns the last error message from server." 899 "This function returns the last error message from server."
901 (when (nnimap-possibly-change-server server) 900 (when (nnimap-possibly-change-server server)
902 (nnoo-status-message 'nnimap server))) 901 (nnoo-status-message 'nnimap server)))
903 902
904 (defvar nnimap-demule-use-string-to-multibyte (fboundp 'string-to-multibyte) 903 ;; We used to use a string-as-multibyte here, but it is really incorrect.
905 "Temporary internal debug variable. 904 ;; This function is used when we're about to insert a unibyte string
906 If you have problems (UTF-8 not decoded correctly on IMAP) with 905 ;; into a potentially multibyte buffer. The string is either an article
907 the default value, please report it as a bug!") 906 ;; header or body (or both?), undecoded. When Emacs is asked to convert
908 ;; FIXME: Clarify if we need to make this variable conditional on the Emacs 907 ;; a unibyte string to multibyte, it may either use the equivalent of
909 ;; version (Emacs 22 vs. Emacs 23;Emacs 21 doesn't have `string-to-multibyte' 908 ;; nothing (e.g. non-Mule XEmacs), string-make-unibyte (i.e. decode using
910 ;; anyhow). --rsteib 909 ;; locale), string-as-multibyte (decode using emacs-internal coding system)
911 ;; 910 ;; or string-to-multibyte (keep the data undecoded as a sequence of bytes).
912 ;; http://thread.gmane.org/gmane.emacs.gnus.general/67112 911 ;; Only the last one preserves the data such that we can reliably later on
913 ;; (bug#464, reported by James Cloos) 912 ;; decode the text using the mime info.
914 ;; http://thread.gmane.org/gmane.emacs.bugs/21524 913 (defalias 'nnimap-demule 'mm-string-to-multibyte)
915 ;; (bug#1174, reported by Frank Schmitt)
916
917 (defun nnimap-demule (string)
918 ;; BEWARE: we used to use string-as-multibyte here which is braindead
919 ;; because it will turn accidental emacs-mule-valid byte sequences
920 ;; into multibyte chars. --Stef
921 ;; Reverted, braindead got 7.5 out of 10 on imdb, so it can't be
922 ;; that bad. --Simon
923 (gnus-message 9 "nnimap-demule-use-string-to-multibyte: %s"
924 nnimap-demule-use-string-to-multibyte)
925 (if nnimap-demule-use-string-to-multibyte
926 ;; Stefan
927 (funcall (if (and (fboundp 'string-to-multibyte)
928 (subrp (symbol-function 'string-to-multibyte)))
929 'string-to-multibyte
930 'identity)
931 (or string "")))
932 ;; Simon
933 (funcall (if (and (fboundp 'string-as-multibyte)
934 (subrp (symbol-function 'string-as-multibyte)))
935 'string-as-multibyte
936 'identity)
937 (or string "")))
938 914
939 (defun nnimap-make-callback (article gnus-callback buffer) 915 (defun nnimap-make-callback (article gnus-callback buffer)
940 "Return a callback function." 916 "Return a callback function."
941 `(lambda () 917 `(lambda ()
942 (nnimap-callback ,article ,gnus-callback ,buffer))) 918 (nnimap-callback ,article ,gnus-callback ,buffer)))