Commit b4bfa57a authored by David Byers's avatar David Byers
Browse files

Use modern calls for get-membership. Fix bug 1259. Make review state buffer-local.

Detailed changes:
> 2004-01-26  David Byers  <byers@lysator.liu.se>
>
> 	* vars.el.in (lyskom-format-special): Explicitly format plaintext
> 	types.
>
> 	* lyskom-rest.el (smiley-region): New function.
> 	(smiley-region): Use it. Clean up some of the code.
>
> 2004-01-13  David Byers  <byers@lysator.liu.se>
>
> 	* review.el: Made all state variables (for kom-review-more)
> 	buffer-local.
>
> 2004-01-12  David Byers  <byers@lysator.liu.se>
>
> 	* services.el (initiate-get-membership): Use call 108 when
> 	possible.
> 	(initiate-get-part-of-membership): Same here.
>
> 	* parse.el (lyskom-parse-membership-list-11): New function.
>
parent deebac2d
2004-01-26 David Byers <byers@lysator.liu.se>
* vars.el.in (lyskom-format-special): Explicitly format plaintext
types.
* lyskom-rest.el (smiley-region): New function.
(smiley-region): Use it. Clean up some of the code.
2004-01-13 David Byers <byers@lysator.liu.se>
* review.el: Made all state variables (for kom-review-more)
buffer-local.
2004-01-12 David Byers <byers@lysator.liu.se>
* services.el (initiate-get-membership): Use call 108 when
possible.
(initiate-get-part-of-membership): Same here.
* parse.el (lyskom-parse-membership-list-11): New function.
2004-01-01 David Byers <byers@lysator.liu.se>
Fix bug 1236:
......
......@@ -1214,9 +1214,9 @@ You should set it to a better value.\n")
(text-buffer-missing . "The text buffer no longer exists.\n")
(re-edit-text-prompt . "Edit the text that couldn't be created")
(go-to-pri-conf-prompt . "Go to next prioritized conference")
(go-to-pri-mailbox-prompt . "G to prioritized mailbox")
(go-to-pri-mailbox-prompt . "G to your mailbox (prioritized)")
(read-pri-text-conf . "Read next prioritized text")
(read-pri-letter-prompt . "Read next prioritized letter")
(read-pri-letter-prompt . "Read next letter (prioritized)")
(review-next-text-prompt . "Review next text")
(review-next-comment-prompt . "Review next comment")
(review-next-marked-prompt . "Review next marked text")
......@@ -1654,6 +1654,7 @@ You must become an active member of the conference to enter it.\n")
(Secret-mt-type . "Secret")
(Message-flag-mt-type . "Group messages")
(not-author . "You are not the author of text %#1n.")
(not-author-try-anyway-p . "You are not the author of the text. Try anyway? ")
(what-no-comments-no . "Which text do you want to prevent comments to: ")
(adding-no-comments . "Preventing comments to text %#1n...")
......
......@@ -2153,52 +2153,38 @@ Deferred insertions are not supported."
(defun lyskom-format-text-body (text &optional text-stat)
"Format a text for insertion. Does parsing of special markers in the text."
(let* ((ct-item (and text-stat (car (text-stat-find-aux text-stat 1))))
(content-type (cond (ct-item (aux-item->data ct-item))
((and (string-match "\\`\\(\\S-+\\):\\s-*$" text)
(match-beginning 1))
(match-string 1 text))
(t nil)))
(content-type (or (cond (ct-item (aux-item->data ct-item))
((and (string-match "\\`\\(\\S-+\\):\\s-*$" text)
(match-beginning 1))
(match-string 1 text))
(t nil))
"text/x-kom-basic"))
(fn (and content-type
(cdr
(let ((tmp lyskom-format-special)
(result nil)
(case-fold-search t))
(while tmp
(when (eq 0 (string-match
(if (stringp (car (car tmp)))
(car (car tmp))
(symbol-name (car (car tmp))))
content-type))
(setq result (car tmp))
(setq tmp nil))
(setq tmp (cdr tmp)))
result))))
(cdr (let ((case-fold-search t))
(lyskom-traverse el lyskom-format-special
(when (eq 0 (string-match
(if (stringp (car el))
(car el)
(symbol-name (car el)))
content-type))
(lyskom-traverse-break el)))))))
(plaintext (eq fn t))
(formatted (and fn (funcall fn text text-stat))))
;; (when (eq t lyskom-last-text-format-flags)
;; (lyskom-signal-reformatted-text
;; (if content-type
;; (lyskom-format 'reformat-generic content-type)
;; nil)))
(cond (formatted formatted)
(t (let ((tmp (if kom-text-properties
(lyskom-button-transform-text
(lyskom-fill-message text)
text-stat)
(lyskom-fill-message text))))
(when (and kom-smileys
(fboundp 'smiley-region))
(add-text-properties 0
(length tmp)
'(special-insert lyskom-postprocess-text)
tmp))
(when (fboundp 'latin-unity-remap-region)
(add-text-properties 0
(length tmp)
'(special-insert lyskom-unity-text)
tmp))
tmp)))))
(or formatted text)))
(defun lyskom-format-plaintext (text text-stat)
(let ((tmp (if kom-text-properties
(lyskom-button-transform-text
(lyskom-fill-message text)
text-stat)
(lyskom-fill-message text))))
(when (and kom-smileys (fboundp 'smiley-region))
(add-text-properties 0 (length tmp)
'(special-insert lyskom-postprocess-text) tmp))
(when (fboundp 'latin-unity-remap-region)
(add-text-properties 0 (length tmp)
'(special-insert lyskom-unity-text) tmp))
tmp))
(defun lyskom-postprocess-text (start end &rest args)
(condition-case nil
......
......@@ -1132,6 +1132,10 @@ Args: TEXT-NO. Value: text-stat."
;;; Parsing of complex datatypes without cache.
(defun lyskom-parse-membership-list-11 ()
"Parse a membership-list. Returns a vector."
(lyskom-parse-vector (lyskom-parse-num) 'lyskom-parse-membership-11))
(defun lyskom-parse-membership-list ()
"Parse a membership-list. Returns a vector."
(lyskom-parse-vector (lyskom-parse-num) 'lyskom-parse-membership))
......
......@@ -52,32 +52,33 @@
;;; ======================================================================
;;; State-saving variables
;;;
(defvar lyskom-last-review-by nil)
(defvar lyskom-last-review-to nil)
(defvar lyskom-last-review-num nil)
(defvar lyskom-last-review-pmark nil)
(defvar lyskom-last-review-cmark nil)
(defvar lyskom-last-review-saved-result-list nil)
(defvar lyskom-last-review-saved-by-list nil)
(defvar lyskom-last-review-saved-to-list nil)
(defvar lyskom-last-review-saved-result-size 0)
(defvar lyskom-last-review-saved-smallest nil)
(defvar lyskom-last-review-saved-largest nil)
(defvar lyskom-have-review nil)
(defvar lyskom-last-unread-by nil)
(defvar lyskom-last-unread-to nil)
(defvar lyskom-last-unread-num nil)
(defvar lyskom-last-unread-pmark nil)
(defvar lyskom-last-unread-cmark nil)
(defvar lyskom-last-unread-saved-result-list nil)
(defvar lyskom-last-unread-saved-by-list nil)
(defvar lyskom-last-unread-saved-to-list nil)
(defvar lyskom-last-unread-saved-result-size 0)
(defvar lyskom-last-unread-saved-smallest nil)
(defvar lyskom-last-unread-saved-largest nil)
(defvar lyskom-have-unread nil)
;;; All these need to be buffer-local
(def-kom-var lyskom-last-review-by nil local)
(def-kom-var lyskom-last-review-to nil local)
(def-kom-var lyskom-last-review-num nil local)
(def-kom-var lyskom-last-review-pmark nil local)
(def-kom-var lyskom-last-review-cmark nil local)
(def-kom-var lyskom-last-review-saved-result-list nil local)
(def-kom-var lyskom-last-review-saved-by-list nil local)
(def-kom-var lyskom-last-review-saved-to-list nil local)
(def-kom-var lyskom-last-review-saved-result-size 0 local)
(def-kom-var lyskom-last-review-saved-smallest nil local)
(def-kom-var lyskom-last-review-saved-largest nil local)
(def-kom-var lyskom-have-review nil local)
(def-kom-var lyskom-last-unread-by nil local)
(def-kom-var lyskom-last-unread-to nil local)
(def-kom-var lyskom-last-unread-num nil local)
(def-kom-var lyskom-last-unread-pmark nil local)
(def-kom-var lyskom-last-unread-cmark nil local)
(def-kom-var lyskom-last-unread-saved-result-list nil local)
(def-kom-var lyskom-last-unread-saved-by-list nil local)
(def-kom-var lyskom-last-unread-saved-to-list nil local)
(def-kom-var lyskom-last-unread-saved-result-size 0 local)
(def-kom-var lyskom-last-unread-saved-smallest nil local)
(def-kom-var lyskom-last-unread-saved-largest nil local)
(def-kom-var lyskom-have-unread nil local)
(defun lyskom-remove-zeroes (a)
......
......@@ -685,15 +685,24 @@ Args: KOM-QUEUE HANDLER MESSAGE &rest DATA."
"Get membership-list for PERS-NO from server.
Args: KOM-QUEUE HANDLER PERS-NO &rest DATA."
(lyskom-server-call
(lyskom-call kom-queue lyskom-ref-no handler data
(if (lyskom-have-call 99)
'lyskom-parse-membership-list
'lyskom-parse-membership-list-old))
(lyskom-send-packet kom-queue (lyskom-format-objects
(if (lyskom-have-call 99) 99 46)
pers-no
0 lyskom-max-int ;all confs.
1)))) ;want read texts.
(cond ((lyskom-have-call 108)
(lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-membership-list-11)
(lyskom-send-packet
kom-queue
(lyskom-format-objects 108 pers-no 0 lyskom-max-int
1 lyskom-max-int)))
((lyskom-have-call 99)
(lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-membership-list-old)
(lyskom-send-packet
kom-queue
(lyskom-format-objects 99 pers-no 0 lyskom-max-int 1)))
(t (lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-membership-list)
(lyskom-send-packet
kom-queue
(lyskom-format-objects 46 pers-no 0 lyskom-max-int 1))))))
(defun initiate-get-part-of-membership (kom-queue handler pers-no first length
......@@ -701,15 +710,24 @@ Args: KOM-QUEUE HANDLER PERS-NO &rest DATA."
"Get membership-list for PERS-NO from server.
Args: KOM-QUEUE HANDLER PERS-NO FIRST-IN-LIST LENGHT &rest DATA."
(lyskom-server-call
(lyskom-call kom-queue lyskom-ref-no handler data
(if (lyskom-have-call 99)
'lyskom-parse-membership-list
'lyskom-parse-membership-list-old))
(lyskom-send-packet kom-queue (lyskom-format-objects
(if (lyskom-have-call 99) 99 46)
pers-no
first length ;all confs.
1))))
(cond ((lyskom-have-call 108)
(lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-membership-list-11)
(lyskom-send-packet
kom-queue
(lyskom-format-objects 108 pers-no first length
1 lyskom-max-int)))
((lyskom-have-call 99)
(lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-membership-list)
(lyskom-send-packet
kom-queue
(lyskom-format-objects 99 pers-no first length 1)))
(t (lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-membership-list-old)
(lyskom-send-packet
kom-queue
(lyskom-format-objects 46 pers-no first length 1))))))
(defun initiate-get-created-texts (kom-queue handler pers-no first-local
......
......@@ -1247,9 +1247,9 @@ Du b
(re-edit-text-prompt . "Redigera texten som inte kunde skapas")
(go-to-pri-conf-prompt . "G till nsta prioriterade mte")
(go-to-pri-mailbox-prompt . "G till prioriterad brevlda")
(go-to-pri-mailbox-prompt . "G till din brevlda (prioriterad)")
(read-pri-text-conf . "Lsa nsta prioriterade text")
(read-pri-letter-prompt . "Lsa nsta prioriterade brev")
(read-pri-letter-prompt . "Lsa nsta brev (prioriterat)")
(review-next-text-prompt . "terse nsta text")
(review-next-comment-prompt . "terse nsta kommentar")
(review-next-marked-prompt . "terse nsta markerade")
......@@ -1688,6 +1688,7 @@ Du m
(Secret-mt-type . "Hemlig")
(Message-flag-mt-type . "Gruppmeddelanden")
(not-author . "Du r inte frfattare till text %#1n.")
(not-author-try-anyway-p . "Du r inte frfattare till inlgget. Vill du frska nd? ")
(what-no-comments-no . "Vilken text vill du inte ha kommentarer till: ")
(adding-no-comments . "Begr att inte f kommentarer till inlgg %#1n...")
......
......@@ -664,6 +664,7 @@ non-negative integer and 0 means the given text-no."
(let ((check (assq command kom-text-no-prompts)))
(if check (cdr check) (memq command lyskom-text-no-prompts-defaults))))
(defun lyskom-read-text-no-prefix-arg (prompt &optional always-prompt
default constraint)
"Call in interactive list to read text-no for lyskom-commands using
......
......@@ -520,7 +520,9 @@ The format of this variable may change in the future.
(nil . lyskom-maybe-get-commented-text)))
(kom-sub-footnote . ((t . lyskom-maybe-get-footnoted-text)
(nil . lyskom-maybe-get-footnoted-text)))
(kom-write-footnote . ((t . lyskom-get-last-written-or-read-by-me)
(kom-write-footnote . ((t . lyskom-get-text-at-point)
(t . lyskom-get-last-written-or-read-by-me)
(nil . lyskom-get-text-at-point)
(nil . lyskom-get-last-written-or-read-by-me)))
(kom-add-no-comments . ((t . lyskom-get-last-written-or-read-by-me)
(nil . lyskom-get-last-written-or-read-by-me)))
......@@ -2069,6 +2071,7 @@ This will disable all font usage and clickable stuff.
Values other than `t' and `nil' are reserved for future use.")
(def-kom-var kom-use-button-hints t
"**Controls use of context sensitive actions on clickable areas.
......@@ -4149,11 +4152,10 @@ Values other than those listed are reserved for future use."
("enriched" . lyskom-format-enriched)
("text/html" . lyskom-format-html)
("text/enriched" . lyskom-format-enriched)
("text/plain" . nil)
("text/x-kom-basic" . nil)
("x-kom/text" . nil) ;Archaic alias for text/x-kom-basic.
("x-kom/basic" . nil) ;Archaic alias for text/x-kom-basic.
("x-kom/user-area" . lyskom-format-x-kom/user-area)
("^text/" . lyskom-format-plaintext)
("x-kom/text" . lyskom-format-plaintext) ;Archaic alias for text/x-kom-basic.
("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
......
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