Commit a0b638ec authored by David Byers's avatar David Byers

Lade till visst support av aux-items

parent ad2295fd
Sun Oct 12 00:39:47 1997 David Byers <davby@litefix.ida.liu.se>
* view-text.el (lyskom-print-text): Hantera
lyskom-last-text-format-flags som strng.
(lyskom-deferred-insert-footer): Dito.
* parse.el (lyskom-skip-one-token): Skip arrays correctly, please.
Sat Oct 11 20:32:09 1997 David Byers <davby@sen2.ida.liu.se>
* Release av 0.45.1
......@@ -20,6 +28,10 @@ Tue Oct 7 12:30:30 1997 David Byers <davby@ida.liu.se>
* parse.el (lyskom-parse-vector): Klara att parsea 0 { }.
Mon Oct 6 21:19:41 1997 David Byers <davby@litefix.ida.liu.se>
* view-text.el (lyskom-view-text): Handle aux-items. Sort of.
Wed Oct 1 14:30:39 1997 David Byers <davby@ida.liu.se>
* vars.el.in (kom-server-aliases): Lade till TokKOM
......@@ -146,6 +158,89 @@ Wed Sep 17 13:56:29 1997 David Byers <davby@ida.liu.se>
verrajda det som stts som default.
(lyskom-sv-edit-mode-map): Lade tillbaks C-c } k
Wed Sep 17 22:25:50 1997 David Byers <davby@litefix.ida.liu.se>
* edit-text.el (lyskom-edit-add-aux-item-flag): Ny funktion.
(lyskom-edit-on-aux-item): Dito.
(lyskom-edit-extract-aux-item-flags): Dito.
(lyskom-edit-parse-headers): Hantera aux-items p ett nytt stt.
Tue Sep 16 20:21:42 1997 David Byers <davby@litefix.ida.liu.se>
* swedish-strings.el (lyskom-message): Lade till aux-item
headertexter.
* lyskom-rest.el (lyskom-format-object): Std aux-items.
(lyskom-format-aux-item-flags): Ny funktion.
(lyskom-format-aux-item): Ny funktion.
* services.el (initiate-modify-system-info): Ny funktion.
(initiate-query-predefined-aux-items): Ny funktion.
(initiate-set-expire): Ny funktion.
* parse.el (lyskom-parse-server-info-old): Bytte namn frn
lyskom-parse-server-info.
* services.el (initiate-get-conf-stat): Hantera aux-items.
(initiate-get-text-stat): Dito.
(initiate-modify-conf-info): Ny funktion.
(initiate-modify-text-info): Dito.
(initiate-get-server-info): Hantera aux-items.
* startup.el (lyskom-create-new-person): Skicka aux-items till
create-pers.
* commands1.el (kom-create-conf): Skicka aux-items till
create-conf.
* services.el (initiate-create-conf): Hantera aux-items.
(initiate-create-text): Dito.
(initiate-create-anonymous-text): Dito.
(initiate-create-person): Dito.
* edit-text.el (lyskom-edit-send): Skicka med aux-items till
send-function.
* flags.el (kom-edit-options-send): Skicka med aux-items till
initiate-create-text.
(lyskom-save-options): Dito.
* commands2.el (kom-sync-database): Hindra kommandot baserat p
protokollversion. Inte lika bra, men det r bara ett hack i alla
fall.
* startup.el (lyskom): Tog bort lyskom-server-versioon.
* vars.el.in (lyskom-server-features): Nytt format baserat p
protokollversion.
* startup.el (lyskom-setup-client-for-server-version): Hantera
nytt format p lyskom-server-supports.
* swedish-strings.el (lyskom-message): Lade till tooo-old-server
* vars.el.in (lyskom-server-version-info): Ny variabel.
* commands2.el (kom-who-am-i): Anvnd version-info.
* startup.el (lyskom): Hmta versionsinfo frn servern.
* async.el (lyskom-parse-async): Anvnd lyskom-parse-test-stat-old
* services.el (initiate-get-text-stat): Anvnd
lyskom-parse-text-stat-old.
(initiate-get-conf-stat): Anvnd lyskom-parse-conf-stat-old
* parse.el (lyskom-parse-aux-item-flags): Ny funktion.
(lyskom-parse-aux-item): Ny funktion.
(lyskom-parse-aux-item-list): Ny funktion.
(lyskom-parse-conf-stat-old): Bytte frn lyskom-parse-conf-stat
(lyskom-parse-text-stat-old): Bytte frn lyskom-parse-text-stat
* komtypes.el (aux-item): Ny typ.
(aux-item-flags): Ny typ.
(conf-stat): Lade till expire och aux-items.
Tue Sep 16 11:24:24 1997 David Byers <davby@ida.liu.se>
* commands2.el (kom-previous-kom): Anvnd def-kom-command.
......
......@@ -36,8 +36,8 @@
# makefile too!
#
CLIENTVERSION = 0.45.1
DOCFILES=NEWS-0.45.1 MIGRATION-0.44-0.45
CLIENTVERSION = 0.46-beta
DOCFILES=NEWS-0.46
FTPDIR=/home/davby/www-pub
#FTPDIR = /usr/ftp/pub/lyskom/elisp-client
......@@ -58,13 +58,14 @@ SOURCES = $(LANGUAGE-EL) \
clienttypes.el \
deferred-insert.el \
utilities.el \
command.el \
buffers.el \
aux-items.el \
prefetch.el \
startup.el \
reading.el \
internal.el \
services.el \
command.el \
parse.el \
cache.el \
view-mode.el \
......@@ -113,6 +114,15 @@ vars.el: vars.el.in Makefile
sed 's/@@CLIENTVERSION@@/$(CLIENTVERSION)/' < vars.el.in > vars.el
chmod 444 vars.el
%.elc: %.el header.el
$(EMACS-BATCH) -l ./header.el -l ./lpath.el -f batch-byte-compile $<
header.el: $(HEADER)
cat $(HEADER) > header.el
fast: $(HEADER-ELC) $(SOURCES-ELC)
cat $(HEADER-ELC) $(SOURCES-ELC) > lyskom.elc
lyskom.el: $(HEADER) $(SOURCES)
cat $(HEADER) $(SOURCES) > lyskom.el
......
......@@ -57,7 +57,7 @@ this function shall be with current-buffer the BUFFER."
(cond
((eq msg-no 0) ; New text
(let* ((text-no (lyskom-parse-num))
(text-stat (lyskom-parse-text-stat text-no)))
(text-stat (lyskom-parse-text-stat-old text-no)))
(lyskom-save-excursion
(set-buffer buffer)
(lyskom-async-new-text text-stat)))) ;
......
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991, 1996 Lysator Academic Computer Association.
;;;;;
;;;;; This file is part of the LysKOM server.
;;;;;
;;;;; LysKOM is free software; you can redistribute it and/or modify it
;;;;; under the terms of the GNU General Public License as published by
;;;;; the Free Software Foundation; either version 2, or (at your option)
;;;;; any later version.
;;;;;
;;;;; LysKOM is distributed in the hope that it will be useful, but WITHOUT
;;;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;;;;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
;;;;; for more details.
;;;;;
;;;;; You should have received a copy of the GNU General Public License
;;;;; along with LysKOM; see the file COPYING. If not, write to
;;;;; Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
;;;;; or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
;;;;; MA 02139, USA.
;;;;;
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se.
;;;;;
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: aux-items.el
;;;;
;;;; Implementation of aux-item specific stuff.
;;;; Hopefulle more of this will be made more general in the future.
;;;;
(setq lyskom-clientversion-long
(concat lyskom-clientversion-long
"$Id$\n"))
(eval-when-compile
(require 'lyskom-defvar "defvar.el")
(require 'lyskom-vars "vars.el")
(require 'lyskom-types "komtypes.el"))
(def-kom-var lyskom-aux-item-definitions nil
"List of aux item definitions.")
(defmacro def-aux-item (name number &rest data)
(` (setq lyskom-aux-item-definitions
(add-to-list 'lyskom-aux-item-definitions
(cons (, number)
(cons (cons 'name (quote (, name)))
(quote (, data))))))))
(defun lyskom-aux-item-definition->name (def)
(cdr (assq 'name def)))
(defun lyskom-aux-item-definition->number (def)
(car def))
(defun lyskom-map-aux-items (fn text-stat)
"Apply FN to every aux item in TEXT-STAT."
(let ((items (text-stat->aux-items text-stat)))
(while items
(when (and (car items)
(not (aux-item-flag->deleted (aux-item->flags items))))
(funcall fn (car items)))
(setq items (cdr items)))))
(defun lyskom-aux-item-definition-call (def method &rest args)
(when (aux-item-p def)
(setq def (lyskom-find-aux-item-definition def)))
(cond ((listp method)
(let ((result nil))
(while method
(when (lyskom-aux-item-definition-field def (car method))
(setq result
(apply (lyskom-aux-item-definition-field def
(car method))
args))
(setq method nil))
(setq method (cdr method)))
result))
(t (when (lyskom-aux-item-definition-field def method)
(apply (lyskom-aux-item-definition-field def method) args)))))
(defun lyskom-aux-item-definition-field (def method)
(when (aux-item-p def)
(setq def (lyskom-find-aux-item-definition def)))
(cdr (assq method def)))
(defun lyskom-find-aux-item-definition (aux)
(assq (aux-item->tag aux) lyskom-aux-item-definitions))
(defun lyskom-aux-item-terminating-button (item obj)
(if obj
(lyskom-format " %#1@%[[*]%]"
(lyskom-default-button 'aux
(cond ((lyskom-text-stat-p obj)
(list 'text
(text-stat->text-no
obj)
(aux-item->aux-no
item)))
((lyskom-conf-stat-p obj)
(list 'conf
(conf-stat->conf-no
obj)
(aux-item->aux-no
item)))
(t item))))
""))
;;; ======================================================================
(def-aux-item content-type 1
(print-when . never)
(parse . lyskom-parse-content-type)
(print . lyskom-print-content-type)
(info . lyskom-aux-item-info))
(def-aux-item fast-reply 2
(print-when . footer)
(parse . nil)
(print . lyskom-print-fast-reply)
(info . lyskom-aux-item-info))
(def-aux-item cross-reference 3
(print-when . comment)
(parse . lyskom-parse-cross-reference)
(print . lyskom-print-cross-reference)
(edit-insert . lyskom-edit-insert-cross-reference)
(info . lyskom-aux-item-info))
(def-aux-item no-comments 4
(print-when . footer)
(parse . lyskom-parse-no-comments)
(print . lyskom-print-no-comments)
(edit-insert . lyskom-edit-insert-no-comments)
(info . lyskom-aux-item-info))
(def-aux-item personal-comment 5
(print-when . footer)
(parse . lyskom-parse-personal-comments)
(print . lyskom-print-personal-comments)
(edit-insert . lyskom-edit-insert-personal-comments)
(info . lyskom-aux-item-info))
(def-aux-item request-confirmation 6
(print-when . header)
(parse . lyskom-parse-request-confirmation)
(print . lyskom-print-request-confirmation)
(edit-insert . lyskom-edit-insert-request-confirmation)
(info . lyskom-aux-item-info)
(read-action . lyskom-request-confirmation-action))
(def-aux-item read-confirm 7
(print-when . header)
(print . lyskom-print-read-confirm)
(info . lyskom-aux-item-info))
(def-aux-item redirect 8
(print . lyskom-print-redirect)
(info . lyskom-aux-item-info))
(def-aux-item x-face 9
(print . lyskom-print-xface)
(info . lyskom-aux-item-info))
(def-aux-item alternate-name 10
(print-when . header)
(print . lyskom-print-alternate-name)
(info . lyskom-aux-item-info))
(def-aux-item pgp-signature 11
(info . lyskom-aux-item-info))
(def-aux-item pgp-public-key 12
(info . lyskom-aux-item-info))
(def-aux-item e-mail-address 13
(info . lyskom-aux-item-info))
;;; ================================================================
(defun lyskom-aux-item-info (item header)
(let ((def (lyskom-find-aux-item-definition item)))
(concat
(lyskom-get-string 'aux-item-for)
header
"\n"
(lyskom-format
'aux-item-info
(aux-item->tag item)
(aux-item->aux-no item)
(if def
(lyskom-aux-item-definition->name def)
"unknown")
(aux-item->creator item)
(lyskom-return-date-and-time (aux-item->sent-at item))
(if (aux-item-flags->deleted (aux-item->flags item))
(format "(%s)" (lyskom-get-string 'deleted))
"")
(mapconcat 'identity
(delq nil
(list
(and (aux-item-flags->secret (aux-item->flags item))
(lyskom-get-string 'secret))
(and (aux-item-flags->anonymous (aux-item->flags item))
(lyskom-get-string 'hide-creator))
(and (aux-item-flags->inherit (aux-item->flags item))
(lyskom-get-string 'inherit))))
", ")
(cond ((not (aux-item-flags->inherit (aux-item->flags item)))
(lyskom-get-string 'no-inheritance))
((zerop (aux-item->inherit-limit item))
(lyskom-get-string 'unlimited-inherit))
((eq 1 (aux-item->inherit-limit item))
(lyskom-get-string 'no-more-inherit))
(t (lyskom-format 'inherit-steps
(1- (aux-item->inherit-limit item)))))
(aux-item->data item)))))
(defun lyskom-print-content-type (item &optional obj)
(concat (lyskom-format 'content-type-aux (aux-item->data item))
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-parse-content-type ()
(and (looking-at (lyskom-get-string 'content-type-regexp))
(match-string 1)))
(defun lyskom-print-fast-reply (item &optional obj)
(concat (lyskom-format 'fast-reply
(aux-item->data item)
(aux-item->creator item))
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-parse-cross-reference ()
(or (and (looking-at (lyskom-get-string 'cross-reference-text-regexp))
(concat "T" (match-string 1)))
(and (looking-at (lyskom-get-string 'cross-reference-conf-regexp))
(concat "C" (match-string 1)))
(and (looking-at (lyskom-get-string 'cross-reference-pers-regexp))
(concat "P" (match-string 1)))))
(defun lyskom-edit-insert-cross-reference (item)
(lyskom-print-cross-reference item nil lyskom-pers-no))
(defun lyskom-print-cross-reference (item &optional obj pers)
(let ((pers (if (and (zerop (aux-item->creator item))
pers)
pers
(aux-item->creator item))))
(concat
(cond ((string-match "^P\\([0-9]+\\)" (aux-item->data item))
(lyskom-format 'cross-reference-pers-aux
(string-to-int
(match-string 1 (aux-item->data item)))
pers
))
((string-match "^C\\([0-9]+\\)" (aux-item->data item))
(lyskom-format 'cross-reference-conf-aux
(string-to-int
(match-string 1 (aux-item->data item)))
pers
))
((string-match "^T\\([0-9]+\\)" (aux-item->data item))
(lyskom-format 'cross-reference-text-aux
(string-to-int
(match-string 1 (aux-item->data item)))
pers
))
(t (lyskom-format 'strange-cross-reference
(aux-item->data item)
pers
)))
(lyskom-aux-item-terminating-button item obj)
)))
(defun lyskom-parse-no-comments ()
(and (looking-at (lyskom-get-string 'no-comments-regexp))
""))
(defun lyskom-print-no-comments (item &optional obj)
(concat (lyskom-format 'no-comments-aux)
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-edit-insert-no-comments (item &optional obj)
(lyskom-format 'no-comments-edit-aux))
(defun lyskom-parse-personal-comments ()
(and (looking-at (lyskom-get-string 'personal-comment-regexp))
""))
(defun lyskom-print-personal-comments (item &optional obj)
(concat (lyskom-format 'personal-comment-aux)
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-edit-insert-personal-comments (item &optional obj)
(lyskom-format 'personal-comment-edit-aux))
(defun lyskom-parse-request-confirmation ()
(and (looking-at (lyskom-get-string 'request-confirmation-regexp))
""))
(defun lyskom-print-request-confirmation (item &optional obj)
(concat (lyskom-format 'request-confirmation-aux)
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-edit-insert-request-confirmation (item &optional obj)
(lyskom-format 'request-confirmation-edit-aux))
(defun lyskom-request-confirmation-action (text-stat)
(let ((confirmations (text-stat-find-aux text-stat 7))
(have-confirmation nil))
(while confirmations
(when (eq lyskom-pers-no (aux-item->creator (car confirmations)))
(setq have-confirmation t)
(setq confirmations nil))
(setq confirmations (cdr confirmations)))
(when (and (not have-confirmation)
(lyskom-j-or-n-p
(lyskom-format (lyskom-get-string 'confirm-read-q)
text-stat)))
(let ((item (lyskom-create-aux-item 0 7 lyskom-pers-no
nil
(lyskom-create-aux-item-flags
nil nil nil nil nil nil nil nil)
0 "")))
(initiate-modify-text-info 'background
nil
(text-stat->text-no text-stat)
nil
(list item))
(cache-del-text-stat (text-stat->text-no text-stat))))))
(defun lyskom-print-read-confirm (item &optional obj)
(concat
(lyskom-format 'read-confirm-aux
(aux-item->creator item)
(lyskom-return-date-and-time (aux-item->sent-at item)))
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-print-redirect (item &optional obj)
(concat
(cond ((string-match "^E-mail:\\(.*\\)$" (aux-item->data item))
(lyskom-format 'redirect-email-aux
(match-string 1 (aux-item->data item))))
((string-match "^LysKOM:\\(.*\\)$" (aux-item->data item))
(lyskom-format 'redirect-lyskom-aux
(string-to-int
(match-string 1 (aux-item->data item))))))
(lyskom-aux-item-terminating-button item obj)))
(defun lyskom-print-xface (item &optional obj)
(lyskom-xemacs-or-gnu
nil ;;; +++ FIXME: Do the right thing
nil))
(defun lyskom-print-alternate-name (item &optional obj)
(concat "Alternate: " (aux-item->data item) " "
(lyskom-aux-item-terminating-button item obj)))
(provide 'lyskom-aux-items)
......@@ -496,3 +496,5 @@ CACHE is the name of the variable that points to the cache."
(t
(setq lyskom-what-i-am-doing string)
(initiate-change-what-i-am-doing 'background nil string)))))
(provide 'lyskom-cache)
......@@ -34,6 +34,9 @@
(concat lyskom-clientversion-long
"$Id$\n"))
(eval-when-compile
(require 'lyskom-command "command"))
;;; ================================================================
;;; F} uppmuntran - Get appreciation
......@@ -533,7 +536,8 @@ of the person."
anarchy
nil
nil
nil))))
nil)
nil)))
(if (null conf-no)
(progn
(lyskom-format-insert 'could-not-create-conf
......@@ -601,14 +605,11 @@ This does lyskom-end-of-command"
If optional arg TEXT-NO is present write a comment to that text instead."
(interactive (list
(cond
((null current-prefix-arg)
lyskom-current-text)
((integerp current-prefix-arg)
current-prefix-arg)
((null current-prefix-arg) lyskom-current-text)
((integerp current-prefix-arg) current-prefix-arg)
((listp current-prefix-arg)
(lyskom-read-number (lyskom-get-string 'what-comment-no)))
(t
(signal 'lyskom-internal-error '(kom-write-comment))))))
(t (signal 'lyskom-internal-error '(kom-write-comment))))))
(lyskom-start-of-command (concat
(lyskom-command-name 'kom-write-comment)
(if text-no
......@@ -616,11 +617,23 @@ If optional arg TEXT-NO is present write a comment to that text instead."
"")))
(unwind-protect
(if text-no
(lyskom-write-comment-soon
(blocking-do 'get-text-stat text-no)
(blocking-do 'get-text text-no)
text-no
'comment)
(blocking-do-multiple ((text (get-text text-no))
(text-stat (get-text-stat text-no)))
(when (or (null (text-stat-find-aux text-stat 4))
(lyskom-j-or-n-p
(lyskom-get-string 'no-comments-q)))
(if (and (text-stat-find-aux text-stat 5)
(lyskom-j-or-n-p
(lyskom-get-string 'private-answer-q)))
(lyskom-private-answer-soon
text-stat
text
text-no)
(lyskom-write-comment-soon
text-stat
text
text-no
'comment))))
(lyskom-insert-string 'confusion-what-to-comment))
(lyskom-end-of-command)))
......@@ -665,10 +678,25 @@ If optional arg TEXT-NO is present write a footnote to that text instead."
"Write a comment to previously viewed text."
(interactive)
(if lyskom-previous-text
(lyskom-write-comment-soon
(blocking-do 'get-text-stat lyskom-previous-text)
(blocking-do 'get-text lyskom-previous-text)
lyskom-previous-text 'comment)
(blocking-do-multiple ((text-stat (get-text-stat lyskom-previous-text))
(text (get-text lyskom-previous-text)))
(when (or (null text-stat)
(null text)
(null (text-stat-find-aux text-stat 4))
(lyskom-j-or-n-p
(lyskom-get-string 'no-comments-q)))