Commit b1d8fc6b authored by Pontus Freyhult's avatar Pontus Freyhult

Support for showing texts with images graphically.

parent e2ecdddc
2004-10-19 Pontus Freyhult <pont@soua.net>
Handle texts with content-type image/something:
* english-strings.el, swedish-strings.el:
(lyskom-message): Added reformat-image and image-no-show.
(lyskom-custom-strings): Added kom-format-show-images-doc and
kom-format-show-images-tag.
* lyskom-rest.el (lyskom-format-image): New function.
* option-edit.el (lyskom-customize-buffer-format): Added
kom-format-show-images.
(lyskom-custom-variables): Dito.
* vars.el.in (kom-format-show-images): New variable.
(lyskom-format-special): Use lyskom-format-image for
texts with content-type starting with image.
2004-10-17 David Byers <byers@lysator.liu.se>
* mship-edit.el (lp--mode): Added mode documentation.
......
......@@ -1442,6 +1442,8 @@ On since %#8s%#9s")
(reformat-html . "HTML")
(reformat-enriched . "enriched")
(reformat-filled . "filled")
(reformat-image . "image")
(image-no-show . "< The image cannot be shown. >")
(reformat-truncated . "truncated")
......@@ -4106,6 +4108,9 @@ up menus.")
(kom-format-html-authors-doc . "\
This setting controls which authors' HTML messages that the client will
attempt to format.")
(kom-format-show-images-doc . "\
This setting controls if texts marked as images are treated
specially or handled as normal texts.")
(kom-keyboard-menu-immediate-selection-doc . "\
This setting controls whether keyboard shortcuts in text-based context
menus require confirmation with return or not. With this on you have
......@@ -4419,6 +4424,7 @@ up menus.")
(kom-async-highlight-text-body-tag . "Color message backgrounds:")
(kom-edit-hide-add-button-tag . "Show add button when writing texts:")
(kom-format-html-authors-tag . "Format HTML-messages per author:")
(kom-format-show-images-tag . "Show texts with images as images:")
(kom-keyboard-menu-immediate-selection-tag . "Shortcuts in text menus require confirmation:")
(kom-max-overlays-tag . "Maximum number of overlays:")
(kom-mark-read-texts-as-read-in-new-recipient-tag . "Mark read texts read when added to new recipients:")
......
......@@ -2233,7 +2233,33 @@ in lyskom-messages."
(defun lyskom-format-html-w3m (text text-stat)
(lyskom-format-html text text-stat 'w3m 'lyskom-w3m-region))
(defun lyskom-format-image (text text-stat)
(if kom-format-show-images
(let ((cti (lyskom-get-aux-item (text-stat->aux-items text-stat) 1))
(content-type (and cti (aux-item->data (car cti))))
(msg "")
(imagetype (intern
; FIXME: Can the media type contain more than letters and -?
(string-replace-match "^.*/\\([-a-zA-Z]*\\)\\(.\\|\n\\)*"
content-type "\\1")))
(imagedata text))
(condition-case nil
(lyskom-xemacs-or-gnu
(set-extent-end-glyph ; XEmacs
(make-extent (point) (point-max))
(make-glyph
(make-image-instance (vector imagetype :data imagedata))))
(if (not (and (fboundp 'display-images-p) ; GNU Emacs
(fboundp 'put-image)
(fboundp 'create-image)
(display-images-p)
(put-image (create-image imagedata imagetype t)
(point-max))))
(setq msg (lyskom-get-string 'image-no-show))))
; Errors just marks it as a no show
(error (setq msg (lyskom-get-string 'image-no-show))))
(lyskom-signal-reformatted-text 'reformat-image)
msg)))
(defun lyskom-format-enriched (text text-stat)
(if (not (fboundp 'format-decode-buffer))
......
......@@ -220,6 +220,7 @@
[kom-smileys]
[kom-w3-simplify-body]
[kom-format-html-authors]
[kom-format-show-images]
"\n"
[kom-max-overlays]
[kom-highlight-first-line]
......@@ -836,6 +837,7 @@ All key bindings:
(const (all-others t) :format "%t\n"))
:format "%[%v%]")
(toggle (yes no) :tag format-html)))))
(kom-format-show-images (toggle (on off)))
(kom-bury-buffers (toggle (on off)))
(kom-ansaphone-replies (ansaphone))
(kom-complete-numbers-before-names (toggle (on off)))
......
......@@ -1475,6 +1475,8 @@ Uppkopplad sedan %#8s%#9s")
(reformat-html . "HTML")
(reformat-enriched . "enriched")
(reformat-filled . "ombruten")
(reformat-image . "bild")
(image-no-show . "< Bilden kan inte visas. >")
(reformat-truncated . "nedkortad")
......@@ -4217,6 +4219,9 @@ ta fram menyer.")
(kom-format-html-authors-doc . "\
Den hr instllningen styr vilka frfattares HTML-meddelanden som
elispklienten kommer att frska formattera.")
(kom-format-show-images-doc . "\
Den hr instllningen styr om inlgg uppmrkta som bilder specialhanteras
eller visas som traditionella inlgg.")
(kom-keyboard-menu-immediate-selection-doc . "\
Den hr instllningen styr huruvida snabbtangenter automatiskt bekrftar
val i textbaserade menyer eller inte. Om detta r pslaget s mste man
......@@ -4530,6 +4535,7 @@ ta fram menyer.")
(kom-async-highlight-text-body-tag . "Annorlunda bakgrundsfrg p meddelanden:")
(kom-edit-hide-add-button-tag . "Visa Addera-knappen nr man skriver inlgg:")
(kom-format-html-authors-tag . "Formattera HTML-meddelanden per frfattare:")
(kom-format-show-images-tag . "Visa bildinlgg som bilder:")
(kom-keyboard-menu-immediate-selection-tag . "Snabbval i textmenyer krver bekrftelse:")
(kom-max-overlays-tag . "Hgsta antal frgmarkeringar:")
(kom-mark-read-texts-as-read-in-new-recipient-tag . "Markera lsta inlgg lsta ven i nya mottagare:")
......
......@@ -4209,6 +4209,10 @@ idea.
Values other than `t' and `nil' are reserved for future use."
server)
(def-kom-var kom-format-show-images t "**Control image display
nil means inhibit special image handling." server)
(def-kom-var kom-format-html-authors '((t . t))
"**Determines from which authors we accept HTML.
......@@ -4223,6 +4227,7 @@ Values other than those listed are reserved for future use."
(def-kom-var lyskom-format-special
'(("html" . (lyskom-format-html-w3m lyskom-format-html-w3 lyskom-format-html-plaintext))
("enriched" . lyskom-format-enriched)
("^image/" . lyskom-format-image)
("^text/html" . (lyskom-format-html-w3m lyskom-format-html-w3 lyskom-format-html-plaintext))
("^text/enriched" . lyskom-format-enriched)
("^text/" . lyskom-format-plaintext)
......@@ -4230,6 +4235,7 @@ Values other than those listed are reserved for future use."
("^x-kom/basic" . lyskom-format-plaintext) ;Archaic alias for text/x-kom-basic.
("^x-kom/user-area" . lyskom-format-x-kom/user-area)
("^x-kom/ö\\." . lyskom-format-ö))
"AList of (FORMAT . FUNCTION) specifying functions that format texts
of that type. FORMAT is a symbol and FUNCTION is a function taking one
argument and returning a formatted string.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment