Commit 225ff230 authored by David Byers's avatar David Byers
Browse files

Fix bugs 528, 571

parent 1536f2c6
2002-05-25 David Byers <david.byers@swipnet.se>
Fix bug 528:
* lyskom-buttons.el (lyskom-button-copy-text-no): New function.
* vars.el.in (lyskom-button-actions): Added
lyskom-button-copy-text-no for texts.
Fix bug 571:
* utilities.el (lyskom-delete-duplicates): New function.
* edit-text.el (lyskom-edit-send-check-recipients): Misplaced
paren caused two loops to be nested when they shouldn't have been.
Use lyskom-delete-duplicates to eliminaate duplicate authors.
2002-05-25 Per Cederqvist <ceder@ceder.dyndns.org> 2002-05-25 Per Cederqvist <ceder@ceder.dyndns.org>
* vars.el.in (lyskom-maybe-setq): Added missing commas: we want to * vars.el.in (lyskom-maybe-setq): Added missing commas: we want to
......
...@@ -678,7 +678,6 @@ The element last pushed is first in the list." ...@@ -678,7 +678,6 @@ The element last pushed is first in the list."
"Push VALUE onto the front of COLLECTOR's value" "Push VALUE onto the front of COLLECTOR's value"
(setcdr collector (cons value (cdr collector)))) (setcdr collector (cons value (cdr collector))))
(eval-and-compile (provide 'lyskom-clienttypes)) (eval-and-compile (provide 'lyskom-clienttypes))
;;; clienttypes.el ends here ;;; clienttypes.el ends here
...@@ -894,7 +894,9 @@ Cannot be called from a callback." ...@@ -894,7 +894,9 @@ Cannot be called from a callback."
text-no text-no
raw-author-list)) raw-author-list))
(lyskom-wait-queue 'sending) (lyskom-wait-queue 'sending)
(setq raw-author-list (collector->value raw-author-list)) (setq raw-author-list (lyskom-delete-duplicates
(collector->value raw-author-list)
'conf-stat->conf-no))
;; ;;
;; Filter the list. Remote all authors that are direct recipients ;; Filter the list. Remote all authors that are direct recipients
...@@ -974,38 +976,38 @@ Cannot be called from a callback." ...@@ -974,38 +976,38 @@ Cannot be called from a callback."
(not (membership-type->passive (not (membership-type->passive
(membership->type membership)))) (membership->type membership))))
(lyskom-traverse-break t))) (lyskom-traverse-break t)))
(setq authors-to-ask-about (cons author authors-to-ask-about))) (setq authors-to-ask-about (cons author authors-to-ask-about)))))
;; ;;
;; Now authors-to-ask-about contains all authors that we ;; Now authors-to-ask-about contains all authors that we
;; want to ask about. So do that. ;; want to ask about. So do that.
;; ;;
(lyskom-traverse author authors-to-ask-about (lyskom-traverse author authors-to-ask-about
(let ((send-comments-to (let ((send-comments-to
(car (lyskom-get-aux-item (conf-stat->aux-items author) 33)))) (car (lyskom-get-aux-item (conf-stat->aux-items author) 33))))
(if (and send-comments-to (if (and send-comments-to
(string-match "^\\([0-9]+\\)" (string-match "^\\([0-9]+\\)"
(aux-item->data send-comments-to))) (aux-item->data send-comments-to)))
(setq send-comments-to (setq send-comments-to
(string-to-number (string-to-number
(match-string 1 (aux-item->data send-comments-to)))) (match-string 1 (aux-item->data send-comments-to))))
(setq send-comments-to nil)) (setq send-comments-to nil))
(when (lyskom-j-or-n-p (when (lyskom-j-or-n-p
(lyskom-format 'add-recipient-p (lyskom-format 'add-recipient-p
author author
send-comments-to)) send-comments-to))
(setq extra-headers (setq extra-headers
(nconc (list (if (lyskom-j-or-n-p (nconc (list (if (lyskom-j-or-n-p
(lyskom-format (lyskom-format
'really-add-as-recpt-q 'really-add-as-recpt-q
(or send-comments-to author))) (or send-comments-to author)))
'RECPT 'RECPT
'CC-RECPT) 'CC-RECPT)
(or send-comments-to (or send-comments-to
(conf-stat->conf-no author))) (conf-stat->conf-no author)))
extra-headers))))))))) extra-headers)))))))
extra-headers)) extra-headers))
......
...@@ -1643,6 +1643,7 @@ You must become an active member of the conference to enter it.\n") ...@@ -1643,6 +1643,7 @@ You must become an active member of the conference to enter it.\n")
;; Button actions ;; Button actions
(lyskom-button-view-text-action . "View text") (lyskom-button-view-text-action . "View text")
(lyskom-button-copy-text-no-action . "Copy text number")
(lyskom-button-review-noconversion-action . "Review unconverted") (lyskom-button-review-noconversion-action . "Review unconverted")
(lyskom-button-find-root-review-action . "Review tree") (lyskom-button-find-root-review-action . "Review tree")
(lyskom-button-find-root-action . "Review root text") (lyskom-button-find-root-action . "Review root text")
......
...@@ -591,6 +591,12 @@ This is a LysKOM button action." ...@@ -591,6 +591,12 @@ This is a LysKOM button action."
(goto-char (point-max)) (goto-char (point-max))
(kom-view arg)))) (kom-view arg))))
(defun lyskom-button-copy-text-no (but arg text)
"In the LysKOM buffer BUF, ignore ARG and copy TEXT to the kill ring.
This is a LysKOM button action."
(kill-new text))
(defun lyskom-button-review-noconversion (buf arg text) (defun lyskom-button-review-noconversion (buf arg text)
"In the LysKOM buffer BUF, view the text ARG without conversion. "In the LysKOM buffer BUF, view the text ARG without conversion.
Last argument TEXT is ignored. This is a LysKOM button action." Last argument TEXT is ignored. This is a LysKOM button action."
......
...@@ -438,81 +438,84 @@ shown to other users." ...@@ -438,81 +438,84 @@ shown to other users."
(interactive) (interactive)
(lyskom-start-of-command 'kom-start-anew) (lyskom-start-of-command 'kom-start-anew)
(lyskom-completing-clear-cache) (lyskom-completing-clear-cache)
(let ((old-me lyskom-pers-no) (let ((new-me nil)
(new-me nil)
(login-successful nil)) (login-successful nil))
(unwind-protect (unwind-protect
(progn (progn
(if lyskom-first-time-around (if lyskom-first-time-around
nil nil
(lyskom-tell-internat 'kom-tell-login)) (lyskom-tell-internat 'kom-tell-login))
;; We can't allow the prefetch to go on after the new user ;; We can't allow the prefetch to go on after the new user
;; is logged in, but to shut down the prefetch would be too ;; is logged in, but to shut down the prefetch would be too
;; brutal, since the new login might be cancelled. To ;; brutal, since the new login might be cancelled. To
;; prevent the blocking-do calls below from allowing ;; prevent the blocking-do calls below from allowing
;; prefetch we set lyskom-inhibit-prefetch locally. ;; prefetch we set lyskom-inhibit-prefetch locally.
(let ((lyskom-inhibit-prefetch t)) (let ((lyskom-inhibit-prefetch t))
(while (not new-me) (while (not new-me)
(if (and lyskom-first-time-around (if (and lyskom-first-time-around
lyskom-default-user-name) lyskom-default-user-name)
;; This is nil if we can't find a unique match. ;; This is nil if we can't find a unique match.
(setq new-me (setq new-me
(conf-z-info->conf-no (conf-z-info->conf-no
(lyskom-lookup-conf-by-name lyskom-default-user-name (lyskom-lookup-conf-by-name lyskom-default-user-name
'(pers))))) '(pers)))))
(if new-me (if new-me
nil nil
(let ((name (lyskom-read-conf-name (let ((name (lyskom-read-conf-name
(lyskom-get-string 'what-is-your-name) (lyskom-get-string 'what-is-your-name)
'(pers none) t "" t))) '(pers none) t "" t)))
(setq new-me (setq new-me
(or (conf-z-info->conf-no (or (conf-z-info->conf-no
(lyskom-lookup-conf-by-name name '(pers))) (lyskom-lookup-conf-by-name name '(pers)))
(lyskom-create-new-person name))))) (lyskom-create-new-person name)))))
;; Now new-me contains a number of a person. ;; Now new-me contains a number of a person.
;; Lets log him in. ;; Lets log him in.
(if new-me (if new-me
(let ((conf-stat (blocking-do 'get-conf-stat new-me)) (let ((conf-stat (blocking-do 'get-conf-stat new-me))
(lyskom-inhibit-minibuffer-messages t)) (lyskom-inhibit-minibuffer-messages t))
;; Previously this code used lyskom-pers-no ;; Previously this code used lyskom-pers-no
;; directly instead of new-me, but that caused ;; directly instead of new-me, but that caused
;; problem with asynchrounous code trying to ;; problem with asynchrounous code trying to
;; access it. ;; access it.
(setq lyskom-pers-no new-me) ;;
;; Setting lyskom-pers-no fscks up other things
;; DEBUG ;; if we do keyboard-quit in the middle, so don't.
(if (null conf-stat) ;;
(lyskom-insert "You don't exist. Go away.\n")) ;; (setq lyskom-pers-no new-me)
(lyskom-insert (concat (conf-stat->name conf-stat) "\n")) ;; DEBUG
(setq lyskom-first-time-around nil) (if (null conf-stat)
(if (blocking-do 'login new-me (lyskom-insert "You don't exist. Go away.\n"))
(if lyskom-default-password
(prog1 (lyskom-insert (concat (conf-stat->name conf-stat) "\n"))
lyskom-default-password (setq lyskom-first-time-around nil)
(setq lyskom-default-password nil) (if (blocking-do 'login new-me
(set-default 'lyskom-default-password (if lyskom-default-password
nil)) (prog1
;; Use password read when creating lyskom-default-password
;; the person when loggin in new (setq lyskom-default-password nil)
;; users (set-default 'lyskom-default-password
(or lyskom-is-new-user nil))
(silent-read ;; Use password read when creating
(lyskom-get-string 'password)))) ;; the person when loggin in new
;; users
(or lyskom-is-new-user
(silent-read
(lyskom-get-string 'password))))
(if invisiblep 1 0)) (if invisiblep 1 0))
(progn (progn
(if lyskom-is-new-user (if lyskom-is-new-user
(blocking-do 'add-member (blocking-do 'add-member
(server-info->conf-pres-conf lyskom-server-info) (server-info->conf-pres-conf lyskom-server-info)
new-me new-me
100 100
1 1
(lyskom-create-membership-type (lyskom-create-membership-type
nil nil nil nil nil nil nil nil))) nil nil nil nil nil nil nil nil)))
(setq login-successful t)) (setq login-successful t))
(lyskom-insert-string 'wrong-password) (lyskom-insert-string 'wrong-password)
(when (lyskom-get-aux-item (when (lyskom-get-aux-item
(server-info->aux-item-list lyskom-server-info) (server-info->aux-item-list lyskom-server-info)
13) ; e-mail 13) ; e-mail
...@@ -524,49 +527,49 @@ shown to other users." ...@@ -524,49 +527,49 @@ shown to other users."
(server-info->aux-item-list lyskom-server-info) (server-info->aux-item-list lyskom-server-info)
13) ; e-mail 13) ; e-mail
)) ))
(setq new-me nil)) (setq new-me nil))
(setq lyskom-is-new-user nil)))) (setq lyskom-is-new-user nil))))
;; Now we are logged in. ;; Now we are logged in.
(lyskom-insert-string 'are-logged-in) (setq lyskom-pers-no new-me)
(lyskom-insert-string 'are-logged-in)
(unless lyskom-is-running-compiled (unless lyskom-is-running-compiled
(lyskom-insert-string 'warning-about-uncompiled-client)) (lyskom-insert-string 'warning-about-uncompiled-client))
(if (not lyskom-dont-read-user-area) (if (not lyskom-dont-read-user-area)
(lyskom-read-options)) (lyskom-read-options))
(when (or session-priority kom-default-session-priority) (when (or session-priority kom-default-session-priority)
(setq lyskom-session-priority (setq lyskom-session-priority
(or session-priority kom-default-session-priority))) (or session-priority kom-default-session-priority)))
(lyskom-run-hook-with-args 'lyskom-change-conf-hook (lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf lyskom-current-conf
0) 0)
(lyskom-run-hook-with-args 'kom-change-conf-hook (lyskom-run-hook-with-args 'kom-change-conf-hook
lyskom-current-conf lyskom-current-conf
0) 0)
(setq lyskom-current-conf 0) (setq lyskom-current-conf 0)
;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on)) ;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on))
(cache-set-marked-texts (blocking-do 'get-marks)) (cache-set-marked-texts (blocking-do 'get-marks))
;; What is this variable? It is never used. It is ust to ;; What is this variable? It is never used. It is ust to
;; fill the cache? ;; fill the cache?
(let ((lyskom-who-am-i (blocking-do 'who-am-i))) (let ((lyskom-who-am-i (blocking-do 'who-am-i)))
(if lyskom-who-am-i (setq lyskom-session-no lyskom-who-am-i)))) (if lyskom-who-am-i (setq lyskom-session-no lyskom-who-am-i))))
;; If login succeeded, clear the caches and set the language ;; If login succeeded, clear the caches and set the language
(if login-successful (when login-successful
(progn (clear-all-caches) (progn (clear-all-caches)
(unless (eq lyskom-language kom-default-language) (unless (eq lyskom-language kom-default-language)
(when (lyskom-set-language kom-default-language 'local) (when (lyskom-set-language kom-default-language 'local)
(unless lyskom-have-one-login (unless lyskom-have-one-login
(lyskom-set-language kom-default-language 'global) (lyskom-set-language kom-default-language 'global)
(lyskom-maybe-setq-default kom-default-language kom-default-language) (lyskom-maybe-setq-default kom-default-language kom-default-language)
(setq-default lyskom-language kom-default-language)) (setq-default lyskom-language kom-default-language))
(lyskom-format-insert (lyskom-format-insert
'language-set-to 'language-set-to
(lyskom-language-name kom-default-language)))) (lyskom-language-name kom-default-language))))
(setq lyskom-have-one-login t)) (setq lyskom-have-one-login t)))
(setq lyskom-pers-no old-me))
;; Show motd and encourage writing a presentation ;; Show motd and encourage writing a presentation
...@@ -585,7 +588,6 @@ shown to other users." ...@@ -585,7 +588,6 @@ shown to other users."
;; Start the prefetch and update some basic caches ;; Start the prefetch and update some basic caches
(lyskom-refetch)) (lyskom-refetch))
(lyskom-end-of-command))) (lyskom-end-of-command)))
;; Run the hook kom-login-hook. We don't want to hang the ;; Run the hook kom-login-hook. We don't want to hang the
......
...@@ -1656,6 +1656,7 @@ Du m ...@@ -1656,6 +1656,7 @@ Du m
;; Button actions ;; Button actions
(lyskom-button-view-text-action . "terse texten") (lyskom-button-view-text-action . "terse texten")
(lyskom-button-copy-text-no-action . "Kopiera inlggsnumret")
(lyskom-button-review-noconversion-action . "terse omodifierat") (lyskom-button-review-noconversion-action . "terse omodifierat")
(lyskom-button-find-root-review-action . "terse trd") (lyskom-button-find-root-review-action . "terse trd")
(lyskom-button-find-root-action . "terse urinlgget") (lyskom-button-find-root-action . "terse urinlgget")
......
...@@ -682,6 +682,21 @@ destructive operations on the result may affect either operand." ...@@ -682,6 +682,21 @@ destructive operations on the result may affect either operand."
(unless (memq x b) (setq result (cons x result)))) (unless (memq x b) (setq result (cons x result))))
(nconc (nreverse result) b))) (nconc (nreverse result) b)))
(defun lyskom-delete-duplicates (list &optional key)
"Removes all but one instance of each element in LIST.
If optional argument KEY is non-nil, apply KEY to each element before
comparison. Comparison is done with eq."
(let ((clist (mapcar (lambda (el)
(if key
(cons (funcall key el) el)
(cons el el)))
list))
(result nil))
(lyskom-traverse el clist
(unless (assq (car el) result)
(setq result (cons el result))))
(nreverse (mapcar 'cdr result))))
;;; ====================================================================== ;;; ======================================================================
......
...@@ -968,7 +968,7 @@ to some URL viewers." ...@@ -968,7 +968,7 @@ to some URL viewers."
"List of URL managers. Each element is a list consisting of "List of URL managers. Each element is a list consisting of
(MANAGER-REGEXP PROTOCOLS NAME VIEW-FUNCTION). When LysKOM attempts to (MANAGER-REGEXP PROTOCOLS NAME VIEW-FUNCTION). When LysKOM attempts to
view a URL, kom-url-viewer-preferences is scanned, and the URL view a URL, kom-url-viewer-preferences is scanned, and the URL
manager whose MANAGER-REGEXP first matches an element in -manager whose MANAGER-REGEXP first matches an element in
kom-url-viewer-preferences and whose PROTOCOLS matches the protocol of kom-url-viewer-preferences and whose PROTOCOLS matches the protocol of
the selected URL is used to view the URL by calling its VIEW-FUNCTION the selected URL is used to view the URL by calling its VIEW-FUNCTION
with the URL and the manager entry as arguments.") with the URL and the manager entry as arguments.")
...@@ -1313,6 +1313,7 @@ appear more than once" ...@@ -1313,6 +1313,7 @@ appear more than once"
text-popup-title text-popup-title
lyskom-button-view-text lyskom-button-view-text
((lyskom-button-view-text-action . lyskom-button-view-text) ((lyskom-button-view-text-action . lyskom-button-view-text)
(lyskom-button-copy-text-no-action . lyskom-button-copy-text-no)
(lyskom-button-review-noconversion-action . lyskom-button-review-noconversion) (lyskom-button-review-noconversion-action . lyskom-button-review-noconversion)
(lyskom-button-find-root-review-action . lyskom-button-find-root-review) (lyskom-button-find-root-review-action . lyskom-button-find-root-review)
(lyskom-button-find-root-action . lyskom-button-find-root) (lyskom-button-find-root-action . lyskom-button-find-root)
......
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