(gnus-ignored-headers): Added Face.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 10 Jan 2003 17:22:23 +0000 (17:22 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 10 Jan 2003 17:22:23 +0000 (17:22 +0000)
lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-fun.el

index 815893a..cf8a537 100644 (file)
@@ -1,3 +1,7 @@
+2003-01-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-art.el (gnus-ignored-headers): Added Face.
+
 2003-01-10  Simon Josefsson  <jas@extundo.com>
 
        * nndraft.el (nndraft-request-group): Avoid crash in
index ae96432..c11aa50 100644 (file)
      "^X-Request-PGP:" "^X-Fingerprint:" "^X-WRIEnvto:" "^X-WRIEnvfrom:"
      "^X-Virus-Scanned:" "^X-Delivery-Agent:" "^Posted-Date:" "^X-Gateway:"
      "^X-Local-Origin:" "^X-Local-Destination:" "^X-UserInfo1:"
-     "^X-Received-Date:" "^X-Hashcash:")
+     "^X-Received-Date:" "^X-Hashcash:" "^Face:")
   "*All headers that start with this regexp will be hidden.
 This variable can also be a list of regexps of headers to be ignored.
 If `gnus-visible-headers' is non-nil, this variable will be ignored."
index 190e3c4..bdab559 100644 (file)
   :group 'gnus-fun
   :type 'string)
 
+(defcustom gnus-convert-image-to-face-command "djpeg %s | ppmnorm | pnmscale -width 48 -height 48 | ppmquant %d | pnmtopng"
+  "Command for converting a GIF to an X-Face."
+  :group 'gnus-fun
+  :type 'string)
+
 (defun gnus-shell-command-to-string (command)
   "Like `shell-command-to-string' except not mingling ERROR."
   (with-output-to-string
@@ -74,6 +79,35 @@ Output to the current buffer, replace text, and don't mingle error."
      (format gnus-convert-image-to-x-face-command
             (shell-quote-argument file)))))
 
+(defun gnus-face-from-file (file)
+  "Return an Face header based on an image file."
+  (interactive "fImage file name:" )
+  (when (file-exists-p file)
+    (let ((done nil)
+         (attempt "")
+         (quant 4))
+      (while (and (not done)
+                 (> quant 1))
+       (setq attempt
+             (gnus-shell-command-to-string
+              (format gnus-convert-image-to-face-command
+                      (shell-quote-argument file)
+                      quant)))
+       (if (> (length attempt) 740)
+           (setq quant (/ quant 2))
+         (setq done t)))
+      (if done
+         (mm-with-unibyte-buffer       
+           (insert attempt)
+           (base64-encode-region (point-min) (point-max))
+           (goto-char (point-min))
+           (forward-line 1)
+           (while (not (eobp))
+             (insert " ")
+             (forward-line 1))
+           (buffer-string))
+       nil))))
+
 (defun gnus-convert-image-to-gray-x-face (file depth)
   (let* ((mapfile (mm-make-temp-file (expand-file-name "gnus." 
                                                       mm-tmp-directory)))