Commit 9a917ffe authored by David Byers's avatar David Byers
Browse files

Format komimportmail imported e-mail properly.

Commands to insert info node references.
parent b79dde16
1999-10-09 David Byers <davby@ida.liu.se>
* view-text.el: Updated all functions to format imported e-mail
properly
1999-09-29 David Byers <davby@ida.liu.se>
* edit-text.el (kom-insert-last-info-nodename): New command.
(kom-yank-info-nodename): New command.
1999-08-28 David Byers <davby@ida.liu.se>
* completing-read.el (lyskom-read-session-resolve-ambiguity): Bug
fix in printing session list.
Tue Sep 28 14:56:43 1999 David Byers <davby@sen2.ida.liu.se>
* Released 0.46-BETA-7
......
......@@ -3,9 +3,18 @@
Att göra i elisp-klienten
=========================
Någon form at reply till importerade brev som använder mx-reply-to
eller mx-to, mx-cc om de finns.
Om du fixar någonting som står med på den här
listan, glöm inte att ta bort det från listan!
Testa vad som händer om man har en ogiltig misc-item eller aux-item i
headersarna när man adderar en mottagare eller flyttar ett inlägg
eller adderar en aux-item eller tar bord en aux-item.
initiate-get-membership skulle kunna fylla i positionen för
medlemskapet automatiskt. Tyvärr går det inte att göra så i
query-read-texts.
......
......@@ -278,10 +278,7 @@ this function shall be with current-buffer the BUFFER."
(lyskom-format-insert-before-prompt 'no-longer-member-n conf-no))
(lyskom-remove-membership conf-no lyskom-membership)
(when (eq conf-no lyskom-current-conf)
(set-read-list-empty lyskom-reading-list)
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf 0)
(setq lyskom-current-conf 0))
(lyskom-leave-current-conf))
(read-list-delete-read-info conf-no lyskom-to-do-list)
(lyskom-update-prompt))
......@@ -303,10 +300,7 @@ this function shall be with current-buffer the BUFFER."
(cond ((membership-type->passive (membership->type membership))
(lyskom-replace-membership membership lyskom-membership)
(when (eq conf-no lyskom-current-conf)
(set-read-list-empty lyskom-reading-list)
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf 0)
(setq lyskom-current-conf 0))
(lyskom-leave-current-conf))
(read-list-delete-read-info conf-no lyskom-to-do-list)
(lyskom-update-prompt))
......
......@@ -107,6 +107,13 @@ return non-nil if the item is to be included in the list."
(setq item-list (cdr item-list)))
(nreverse result)))
(defun lyskom-get-aux-item (item-list tag)
"Return all aux-items in ITEM-LIST with tag TAG."
(lyskom-match-aux-items item-list
(lambda (el) (eq (aux-item->tag el) tag))))
(defun lyskom-aux-item-terminating-button (item obj)
(if obj
(lyskom-format " %#1@%[[*]%]"
......
......@@ -2248,3 +2248,17 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil) 0 ""))))
(cache-del-text-stat text-no)))))))
(def-kom-command kom-review-mail-headers (&optional text-no)
"Review the mail headers of an imported message"
(interactive (list (lyskom-read-text-no-prefix-arg
'review-mail-headers-to-what t)))
(let* ((text-stat (blocking-do 'get-text-stat text-no))
(headers (and text-stat (lyskom-get-aux-item (text-stat->aux-items text-stat) 24))))
(cond ((null text-stat) (lyskom-format-insert 'no-such-text-no text-no))
((null headers) (lyskom-format-insert 'no-mail-headers text-no))
(t (lyskom-format-insert 'mail-headers-for text-no)
(mapcar (lambda (el)
(lyskom-insert (aux-item->data el))
(lyskom-insert "\n"))
headers)))))
......@@ -953,8 +953,7 @@ the LysKOM rules of string matching."
lyskom-session-no)
"*" " "))
(session-info->pers-no info)
(if (uconf-stat->name confconfstat)
confconfstat
(or confconfstat
(lyskom-get-string 'not-present-anywhere)))
(lyskom-format-insert
format-string-p
......
......@@ -1033,6 +1033,31 @@ text is a member of some recipient of this text."
(sit-for 0)))
;;; ============================================================
;;; Info node stuff
(defun kom-yank-info-nodename ()
"Put the current Info-node on the kill-ring."
(interactive)
(kill-new (format "*Note %s: (%s)%s,"
Info-current-node
(file-name-nondirectory Info-current-file)
Info-current-node)))
(defun kom-insert-last-info-nodename ()
"Insert a reference to the most recently visited info node."
(interactive)
(condition-case nil
(let ((link nil))
(save-excursion
(set-buffer (get-buffer "*info*"))
(setq link (format "*Note %s: (%s)%s,"
Info-current-node
(file-name-nondirectory Info-current-file)
Info-current-node)))
(insert link))
(error (lyskom-message (lyskom-get-string 'cant-find-info-node)))))
;;; ================================================================
;;; Add recipient, copy-recipient - Addera mottagare
;;;
......
......@@ -760,6 +760,7 @@ Help: \\[describe-mode] ---")
(no-get-text . "You were not allowed to retrieve the text.")
(unknown-header . "Unknown header")
(transform-error . "Skicka in oformatterat (%#1s)? ")
(cant-find-info-node . "Can't find the info buffer")
; From view-text.el:
(line . " /1 line/ ")
......
......@@ -768,6 +768,7 @@ Annat se \\[describe-mode] ---")
(no-get-text . "Du fick inte hmta texten.")
(unknown-header . "Oknd information p raden")
(transform-error . "Skicka in oformatterat (%#1s)? ")
(cant-find-info-node . "Hittar inte info-bufferten")
;; From view-text.el:
(line . " /1 rad/ ")
......@@ -791,11 +792,17 @@ Annat se \\[describe-mode] ---")
(yesterday . "igr")
(no-such-text-no . "Det finns inget sdant inlgg. (%#1:n)\n")
(time-yyyy-mm-dd . "%4#1d-%02#2d-%02#3d")
(text-created-at . "Skapad: %#1s\n")
(text-imported-at . "Importerad: %#1s\n")
(text-imported-at-by . "Importerad: %#1s av %#2P\n")
(head-Subject . "rende: ")
(Recipient . "Mottagare")
(Extra-recipient . "Extra kopia")
(Hidden-recipient . "Fr knnedom")
(mx-Recipient . "Extern mottagare")
(mx-Extra-recipient . "Extern kopiemottagare")
(mx-Extern-reply-to . "Externa svar till")
(Strange-recipient . "Underlig mottagare")
(send-at . " Snt: %#1s\n")
(sent-by . " Snt av %#1P\n")
......@@ -811,6 +818,12 @@ Annat se \\[describe-mode] ---")
(comment-in-text-by . "Kommentar i text %#1n av %#2P")
(footnote-in-text-by . "Fotnot i text %#1n av %#2P")
(attachment-to-text . "Bilaga till text %#1n")
(attachment-in-text . "Bilaga i text %#1n")
(envelope-sender . "Snt av: %#1s\n")
(attachment-filename . "Bilagans filnamn: \"%#1s\"\n")
(written-by . " av %#1P\n")
;; From async.el:
......@@ -1338,6 +1351,12 @@ Du m
(what-request-confirm-no . "Vilken text vill du ha lsbekrftelse till: ")
(adding-request-confirm . "Begr lsbekrftelse till inlgg %#1n...")
(already-request-confirm . "Inlgg %#1n har redan begran om lsbekrftelse.\n")
(review-mail-headers-to-what . "Vilken texts mailhuvuden vill du se? ")
(no-mail-headers . "Inlgg %#1n har inga mailhuvuden\n")
(mail-headers-for . "Mailheaders fr inlgg %#1n:\n")
(email-name-prefix . "")
(email-name-suffix . "")
))
......@@ -1493,6 +1512,8 @@ Du m
(kom-add-no-comments . "Frhindra kommentarer")
(kom-add-private-answer . "Begr personligt svar")
(kom-add-request-confirm . "Begr lsbekrftelse")
(kom-review-mail-headers . "terse mailhuvuden")
))
(lyskom-language-var lyskom-language-codes sv
......
......@@ -92,6 +92,15 @@ If BEFORE is not in the list, then insert EL at the end of the list."
(cons el (memq before list)))
list)))
(defun lyskom-move-in-list (el list pos)
"Destructively move EL within LIST so it appears at position POS."
(when (memq el list)
(setq list (delq el list))
(cond ((eq 0 pos) (setq list (cons el list)))
(t (setcdr (nthcdr (1- pos) list)
(cons el (nthcdr pos list))))))
list)
;;;
;;; +++ FIXME: If cl.el can be guaranteed, this is pointless.
;;;
......
......@@ -1176,6 +1176,8 @@ Users are encouraged to use their best sense of humor."
kom-add-private-answer
kom-add-no-comments
kom-add-request-confirm
kom-review-mail-headers
))
;;; ================================================================
......
......@@ -85,18 +85,58 @@ Note that this function must not be called asynchronously."
(setq todo 'next-text))
(blocking-do-multiple ((text-stat (get-text-stat text-no))
(text (get-text text-no)))
(if (and text-stat
text)
(if (and text-stat text)
(progn
(run-hooks 'lyskom-view-text-hook)
;; Use a marker, because the buffer may lose data
;; at the top if kom-max-buffer-size is set.
(setq start (point-max-marker))
(lyskom-format-insert "%#1n "
text-stat)
(lyskom-format-insert "%#1n " text-stat)
(let ((mx-date (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 21)))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
(mx-to (lyskom-get-aux-item (text-stat->aux-items text-stat) 19))
(mx-cc (lyskom-get-aux-item (text-stat->aux-items text-stat) 20))
(mx-filename (lyskom-get-aux-item (text-stat->aux-items text-stat) 10104))
(mx-sender (lyskom-get-aux-item (text-stat->aux-items text-stat) 10103))
(mx-reply-to (lyskom-get-aux-item (text-stat->aux-items text-stat) 28)))
;; Insert date
(if mx-date
(if (and
(condition-case nil
(progn (require 'calendar)
(require 'cal-iso)
t)
nil)
(string-match "\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-\\([0-9][0-9]\\) \\([0-9][0-9]\\):\\([0-9][0-9]\\):\\([0-9][0-9]\\) \\([-+][0-9][0-9]\\)?\\([0-9][0-9]\\)?"
(aux-item->data mx-date)))
(let* ((secs (string-to-number (match-string 6 (aux-item->data mx-date))))
(mins (string-to-number (match-string 5 (aux-item->data mx-date))))
(hour (string-to-number (match-string 4 (aux-item->data mx-date))))
(mday (string-to-number (match-string 3 (aux-item->data mx-date))))
(mon (string-to-number (match-string 2 (aux-item->data mx-date))))
(year (string-to-number (match-string 1 (aux-item->data mx-date))))
(tzhr (match-string 7 (aux-item->data mx-date)))
(tzmin (or (match-string 8 (aux-item->data mx-date)) ""))
(wday (elt
(calendar-iso-from-absolute
(calendar-absolute-from-gregorian
(list mon mday year)))
1)))
(lyskom-print-date-and-time
(lyskom-create-time secs mins hour mday mon (- year 1900) wday 0 nil))
(when tzhr
(lyskom-format-insert " %#1s%#2s " tzhr tzmin)))
(lyskom-format-insert (aux-item->data mx-date)))
(lyskom-print-date-and-time (text-stat->creation-time
text-stat)
'time-y-m-d-h-m)
'time-y-m-d-h-m))
;; Insert number of lines
(lyskom-insert
(if (= 1 (text-stat->no-of-lines text-stat))
(lyskom-get-string 'line)
......@@ -107,12 +147,61 @@ Note that this function must not be called asynchronously."
2 ; compatibility with old KOM. /lw
n)))))
(if (eq filter 'dontshow)
(lyskom-format-insert "%#1P %#2s\n"
(text-stat->author text-stat)
(lyskom-get-string 'filtered))
(lyskom-format-insert "%#1P\n"
;; Insert the author
(lyskom-insert (or (lyskom-format-mx-author mx-from mx-author) ""))
(unless (or mx-from mx-author)
(lyskom-format-insert "%#1P" (text-stat->author text-stat)))
;; Insert filtration prompt
(when (eq filter 'dontshow)
(lyskom-insert " ")
(lyskom-insert (lyskom-get-string 'filtered)))
(lyskom-insert "\n")
;; Insert sender
(when mx-sender
(lyskom-format-insert 'envelope-sender
(aux-item->data (car mx-sender))))
(when mx-filename
(lyskom-format-insert 'attachment-filename
(aux-item->data (car mx-filename))))
;; Insert imported at
(cond ((and mx-from (text-stat->author text-stat))
(lyskom-format-insert 'text-imported-at-by
(lyskom-return-date-and-time (text-stat->creation-time
text-stat)
'time-y-m-d-h-m)
(text-stat->author text-stat)))
(mx-from
(lyskom-format-insert 'text-imported-at
(lyskom-return-date-and-time (text-stat->creation-time
text-stat)
'time-y-m-d-h-m)))
(mx-date (lyskom-format-insert 'text-created-at
(lyskom-return-date-and-time (text-stat->creation-time
text-stat)
'time-y-m-d-h-m))))
(mapcar (lambda (el)
(lyskom-format-insert "%#1s: %#2s\n"
(lyskom-get-string 'mx-Recipient)
(aux-item->data el)))
mx-to)
(mapcar (lambda (el)
(lyskom-format-insert "%#1s: %#2s\n"
(lyskom-get-string 'mx-Extra-recipient)
(aux-item->data el)))
mx-cc)
(mapcar (lambda (el)
(lyskom-format-insert "%#1s: %#2s\n"
(lyskom-get-string 'mx-Reply-to)
(aux-item->data el)))
mx-reply-to)
(setq end (point-max))
......@@ -144,19 +233,23 @@ Note that this function must not be called asynchronously."
(if lyskom-show-comments ; +++SOJGE
(lyskom-print-header-comm
(misc-info->comm-in misc)
misc))))
misc
text-stat))))
((eq type 'FOOTN-IN)
(if kom-reading-puts-comments-in-pointers-last
nil
(lyskom-print-header-comm
(misc-info->footn-in misc)
misc)))
misc
text-stat)))
((eq type 'COMM-TO)
(lyskom-print-header-comm (misc-info->comm-to misc)
misc))
misc
text-stat))
((eq type 'FOOTN-TO)
(lyskom-print-header-comm (misc-info->footn-to misc)
misc))
misc
text-stat))
)))
;;
......@@ -238,7 +331,7 @@ Note that this function must not be called asynchronously."
(lyskom-follow-comments text-stat
conf-stat mark-as-read
priority build-review-tree)))
)
))
(lyskom-format-insert 'no-such-text-no text-no))
(let ((aux-items (text-stat->aux-items text-stat)))
(while aux-items
......@@ -530,7 +623,7 @@ blocking-do."
(t
"(%#1n)"))
text
(or author author-name)
(or author-name author)
end-dash
format-flag-string))
......@@ -596,11 +689,16 @@ blocking-do."
"Insert the name of a conference at a previously reserved place."
(let* ((text-stat (elt (defer-info->data defer-info) 0))
(format-flags (elt (defer-info->data defer-info) 1))
(name (cond (conf-stat (conf-stat->name conf-stat))
(name (cond (conf-stat nil)
((= (defer-info->call-par defer-info) 0)
(lyskom-get-string 'person-is-anonymous))
(t (lyskom-format 'person-does-not-exist
(defer-info->call-par defer-info))))))
(defer-info->call-par defer-info)))))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16))))
(setq name (or (lyskom-format-mx-author mx-from mx-author) name))
(lyskom-replace-deferred defer-info
(lyskom-format-text-footer text-stat
conf-stat
......@@ -775,13 +873,13 @@ Args: TEXT-STAT of the text being read."
(cond
((eq type 'COMM-IN)
(if lyskom-show-comments ;+++SOJGE
(lyskom-print-header-comm (misc-info->comm-in misc) misc)))
(lyskom-print-header-comm (misc-info->comm-in misc) misc text-stat)))
((eq type 'FOOTN-IN)
(lyskom-print-header-comm (misc-info->footn-in misc) misc))))))
(lyskom-print-header-comm (misc-info->footn-in misc) misc text-stat))))))
(defun lyskom-print-header-comm (text misc)
(defun lyskom-print-header-comm (text misc read-text-stat)
"Get author of TEXT-NO and print a header line."
(let ((text-stat (if kom-deferred-printing
(cache-get-text-stat text)
......@@ -789,9 +887,9 @@ Args: TEXT-STAT of the text being read."
;; Print information about the link
(cond (text-stat
(lyskom-insert-header-comm text-stat misc))
(lyskom-insert-header-comm text-stat misc read-text-stat))
((not kom-deferred-printing)
(lyskom-insert-header-comm text-stat misc))
(lyskom-insert-header-comm text-stat misc read-text-stat))
(t
(let ((defer-info (lyskom-create-defer-info
'get-text-stat
......@@ -800,7 +898,7 @@ Args: TEXT-STAT of the text being read."
(point-max-marker)
(length lyskom-defer-indicator)
nil ; Filled in later
misc)))
(list misc read-text-stat))))
(lyskom-format-insert "%#1s\n" lyskom-defer-indicator)
(lyskom-defer-insertion defer-info))))
......@@ -814,21 +912,43 @@ Args: TEXT-STAT of the text being read."
(defun lyskom-insert-deferred-header-comm (text-stat defer-info)
(let* ((author (if text-stat (text-stat->author text-stat) nil))
(misc (defer-info->data defer-info))
(misc (elt (defer-info->data defer-info) 0))
(read-text-stat (elt (defer-info->data defer-info) 1))
(type (misc-info->type misc))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
(mx-attachments-in (mapcar
(lambda (el)
(string-to-number (aux-item->data el)))
(lyskom-get-aux-item (text-stat->aux-items read-text-stat) 10101)))
(mx-belongs-to (mapcar
(lambda (el)
(string-to-number (aux-item->data el)))
(lyskom-get-aux-item (text-stat->aux-items read-text-stat) 10100)))
fmt data)
(setq author (or (lyskom-format-mx-author mx-from mx-author) author))
(cond
((eq type 'COMM-TO)
(setq fmt (if author 'comment-to-text-by 'comment-to-text)
(setq fmt (cond ((memq (misc-info->comm-to misc) mx-belongs-to) 'attachment-to-text)
(author 'comment-to-text-by)
(t 'comment-to-text))
data (misc-info->comm-to misc)))
((eq type 'FOOTN-TO)
(setq fmt (if author 'footnote-to-text-by 'footnote-to-text)
(setq fmt (cond ((memq (misc-info->footn-to misc) mx-belongs-to) 'attachment-to-text)
(author 'footnote-to-text-by)
(t 'footnote-to-text))
data (misc-info->footn-to misc)))
((eq type 'COMM-IN)
(setq fmt (if author 'comment-in-text-by 'comment-in-text)
(setq fmt (cond ((memq (misc-info->comm-in misc) mx-attachments-in) 'attachment-in-text)
(author 'comment-in-text-by)
(t 'comment-in-text))
data (misc-info->comm-in misc)))
((eq type 'FOOTN-IN)
(setq fmt (if author 'footnote-in-text-by 'footnote-in-text)
(setq fmt (cond ((memq (misc-info->footn-in misc) mx-attachments-in) 'attachment-in-text)
(author 'footnote-in-text-by)
(t 'footnote-in-text))
data(misc-info->footn-in misc))))
(set-defer-info->format defer-info fmt)
; Note: author is ignored if fmt is not *-by
......@@ -836,26 +956,62 @@ Args: TEXT-STAT of the text being read."
(defun lyskom-insert-header-comm (text-stat misc)
(defun lyskom-insert-header-comm (text-stat misc read-text-stat)
"Get author of TEXT-NO and print a header line."
;;+++ error kommer att se annorlunda ut.
(let ((author (if text-stat
(text-stat->author text-stat)
nil))
(mx-from (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 17)))
(mx-author (car (lyskom-get-aux-item (text-stat->aux-items text-stat) 16)))
(mx-attachments-in (mapcar
(lambda (el)
(string-to-number (aux-item->data el)))
(lyskom-get-aux-item (text-stat->aux-items read-text-stat) 10101)))
(mx-belongs-to (mapcar
(lambda (el)
(string-to-number (aux-item->data el)))
(lyskom-get-aux-item (text-stat->aux-items read-text-stat) 10100)))
(type (misc-info->type misc)))
(setq author (or (lyskom-format-mx-author mx-from mx-author) author))
(cond
((eq type 'COMM-TO)
(lyskom-format-insert 'comment-to-text (misc-info->comm-to misc)))
(lyskom-format-insert (if (memq (misc-info->comm-to misc) mx-belongs-to)
'attachment-to-text
'comment-to-text)
(misc-info->comm-to misc)))
((eq type 'FOOTN-TO)
(lyskom-format-insert 'footnote-to-text (misc-info->footn-to misc)))
(lyskom-format-insert (if (memq (misc-info->footn-to misc) mx-belongs-to)
'attachment-to-text
'footnote-to-text)
(misc-info->footn-to misc)))
((eq type 'COMM-IN)
(lyskom-format-insert 'comment-in-text (misc-info->comm-in misc)))
(lyskom-format-insert (if (memq (misc-info->comm-in misc) mx-attachments-in)
'attachment-in-text
'comment-in-text)
(misc-info->comm-in misc)))
((eq type 'FOOTN-IN)
(lyskom-format-insert 'footnote-in-text (misc-info->footn-in misc))))
(lyskom-format-insert (if (memq (misc-info->footn-in misc) mx-attachments-in)
'attachment-in-text
'footnote-in-text)
(misc-info->footn-in misc))))
(if author
(lyskom-format-insert 'written-by author)
(lyskom-insert "\n"))))
(defun lyskom-format-mx-author (mx-from mx-author)
(let ((author nil))
(when (or mx-from mx-author)
(setq author (lyskom-get-string 'email-name-prefix))
(when mx-author (setq author (concat author (aux-item->data mx-author))))
(when (and mx-from mx-author) (setq author (concat author " ")))
(when mx-from (setq author (concat author "<" (aux-item->data mx-from) ">")))
(setq author (concat (lyskom-get-string 'email-name-suffix) author))
)
author))
;;; Local Variables:
......
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