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>
* 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."
"Push VALUE onto the front of COLLECTOR's value"
(setcdr collector (cons value (cdr collector))))
(eval-and-compile (provide 'lyskom-clienttypes))
;;; clienttypes.el ends here
......@@ -894,7 +894,9 @@ Cannot be called from a callback."
text-no
raw-author-list))
(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
......@@ -974,38 +976,38 @@ Cannot be called from a callback."
(not (membership-type->passive
(membership->type membership))))
(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
;; want to ask about. So do that.
;;
;;
;; Now authors-to-ask-about contains all authors that we
;; want to ask about. So do that.
;;
(lyskom-traverse author authors-to-ask-about
(let ((send-comments-to
(car (lyskom-get-aux-item (conf-stat->aux-items author) 33))))
(if (and send-comments-to
(string-match "^\\([0-9]+\\)"
(aux-item->data send-comments-to)))
(setq send-comments-to
(string-to-number
(match-string 1 (aux-item->data send-comments-to))))
(setq send-comments-to nil))
(when (lyskom-j-or-n-p
(lyskom-format 'add-recipient-p
author
send-comments-to))
(setq extra-headers
(nconc (list (if (lyskom-j-or-n-p
(lyskom-format
'really-add-as-recpt-q
(or send-comments-to author)))
'RECPT
'CC-RECPT)
(or send-comments-to
(conf-stat->conf-no author)))
extra-headers)))))))))
(lyskom-traverse author authors-to-ask-about
(let ((send-comments-to
(car (lyskom-get-aux-item (conf-stat->aux-items author) 33))))
(if (and send-comments-to
(string-match "^\\([0-9]+\\)"
(aux-item->data send-comments-to)))
(setq send-comments-to
(string-to-number
(match-string 1 (aux-item->data send-comments-to))))
(setq send-comments-to nil))
(when (lyskom-j-or-n-p
(lyskom-format 'add-recipient-p
author
send-comments-to))
(setq extra-headers
(nconc (list (if (lyskom-j-or-n-p
(lyskom-format
'really-add-as-recpt-q
(or send-comments-to author)))
'RECPT
'CC-RECPT)
(or send-comments-to
(conf-stat->conf-no author)))
extra-headers)))))))
extra-headers))
......
......@@ -1643,6 +1643,7 @@ You must become an active member of the conference to enter it.\n")
;; Button actions
(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-find-root-review-action . "Review tree")
(lyskom-button-find-root-action . "Review root text")
......
......@@ -591,6 +591,12 @@ This is a LysKOM button action."
(goto-char (point-max))
(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)
"In the LysKOM buffer BUF, view the text ARG without conversion.
Last argument TEXT is ignored. This is a LysKOM button action."
......
......@@ -438,81 +438,84 @@ shown to other users."
(interactive)
(lyskom-start-of-command 'kom-start-anew)
(lyskom-completing-clear-cache)
(let ((old-me lyskom-pers-no)
(new-me nil)
(let ((new-me nil)
(login-successful nil))
(unwind-protect
(progn
(if lyskom-first-time-around
nil
(lyskom-tell-internat 'kom-tell-login))
;; 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
;; brutal, since the new login might be cancelled. To
;; prevent the blocking-do calls below from allowing
;; prefetch we set lyskom-inhibit-prefetch locally.
(let ((lyskom-inhibit-prefetch t))
(while (not new-me)
(if (and lyskom-first-time-around
lyskom-default-user-name)
;; This is nil if we can't find a unique match.
(setq new-me
(conf-z-info->conf-no
(lyskom-lookup-conf-by-name lyskom-default-user-name
'(pers)))))
(if new-me
nil
(let ((name (lyskom-read-conf-name
(lyskom-get-string 'what-is-your-name)
'(pers none) t "" t)))
(setq new-me
(or (conf-z-info->conf-no
(lyskom-lookup-conf-by-name name '(pers)))
(lyskom-create-new-person name)))))
;; Now new-me contains a number of a person.
;; Lets log him in.
(if new-me
(let ((conf-stat (blocking-do 'get-conf-stat new-me))
(lyskom-inhibit-minibuffer-messages t))
;; Previously this code used lyskom-pers-no
;; directly instead of new-me, but that caused
;; problem with asynchrounous code trying to
;; access it.
(setq lyskom-pers-no new-me)
;; DEBUG
(if (null conf-stat)
(lyskom-insert "You don't exist. Go away.\n"))
(lyskom-insert (concat (conf-stat->name conf-stat) "\n"))
(setq lyskom-first-time-around nil)
(if (blocking-do 'login new-me
(if lyskom-default-password
(prog1
lyskom-default-password
(setq lyskom-default-password nil)
(set-default 'lyskom-default-password
nil))
;; Use password read when creating
;; the person when loggin in new
;; users
(or lyskom-is-new-user
(silent-read
(lyskom-get-string 'password))))
;; 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
;; brutal, since the new login might be cancelled. To
;; prevent the blocking-do calls below from allowing
;; prefetch we set lyskom-inhibit-prefetch locally.
(let ((lyskom-inhibit-prefetch t))
(while (not new-me)
(if (and lyskom-first-time-around
lyskom-default-user-name)
;; This is nil if we can't find a unique match.
(setq new-me
(conf-z-info->conf-no
(lyskom-lookup-conf-by-name lyskom-default-user-name
'(pers)))))
(if new-me
nil
(let ((name (lyskom-read-conf-name
(lyskom-get-string 'what-is-your-name)
'(pers none) t "" t)))
(setq new-me
(or (conf-z-info->conf-no
(lyskom-lookup-conf-by-name name '(pers)))
(lyskom-create-new-person name)))))
;; Now new-me contains a number of a person.
;; Lets log him in.
(if new-me
(let ((conf-stat (blocking-do 'get-conf-stat new-me))
(lyskom-inhibit-minibuffer-messages t))
;; Previously this code used lyskom-pers-no
;; directly instead of new-me, but that caused
;; problem with asynchrounous code trying to
;; access it.
;;
;; Setting lyskom-pers-no fscks up other things
;; if we do keyboard-quit in the middle, so don't.
;;
;; (setq lyskom-pers-no new-me)
;; DEBUG
(if (null conf-stat)
(lyskom-insert "You don't exist. Go away.\n"))
(lyskom-insert (concat (conf-stat->name conf-stat) "\n"))
(setq lyskom-first-time-around nil)
(if (blocking-do 'login new-me
(if lyskom-default-password
(prog1
lyskom-default-password
(setq lyskom-default-password nil)
(set-default 'lyskom-default-password
nil))
;; Use password read when creating
;; the person when loggin in new
;; users
(or lyskom-is-new-user
(silent-read
(lyskom-get-string 'password))))
(if invisiblep 1 0))
(progn
(if lyskom-is-new-user
(blocking-do 'add-member
(server-info->conf-pres-conf lyskom-server-info)
new-me
(progn
(if lyskom-is-new-user
(blocking-do 'add-member
(server-info->conf-pres-conf lyskom-server-info)
new-me
100
1
(lyskom-create-membership-type
nil nil nil nil nil nil nil nil)))
(setq login-successful t))
(lyskom-insert-string 'wrong-password)
(setq login-successful t))
(lyskom-insert-string 'wrong-password)
(when (lyskom-get-aux-item
(server-info->aux-item-list lyskom-server-info)
13) ; e-mail
......@@ -524,49 +527,49 @@ shown to other users."
(server-info->aux-item-list lyskom-server-info)
13) ; e-mail
))
(setq new-me nil))
(setq lyskom-is-new-user nil))))
(setq new-me nil))
(setq lyskom-is-new-user nil))))
;; Now we are logged in.
(lyskom-insert-string 'are-logged-in)
;; Now we are logged in.
(setq lyskom-pers-no new-me)
(lyskom-insert-string 'are-logged-in)
(unless lyskom-is-running-compiled
(lyskom-insert-string 'warning-about-uncompiled-client))
(if (not lyskom-dont-read-user-area)
(lyskom-read-options))
(if (not lyskom-dont-read-user-area)
(lyskom-read-options))
(when (or session-priority kom-default-session-priority)
(setq lyskom-session-priority
(or session-priority kom-default-session-priority)))
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf
0)
(lyskom-run-hook-with-args 'kom-change-conf-hook
lyskom-current-conf
0)
(setq lyskom-current-conf 0)
;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on))
(cache-set-marked-texts (blocking-do 'get-marks))
;; What is this variable? It is never used. It is ust to
;; fill the cache?
(let ((lyskom-who-am-i (blocking-do 'who-am-i)))
(if lyskom-who-am-i (setq lyskom-session-no lyskom-who-am-i))))
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf
0)
(lyskom-run-hook-with-args 'kom-change-conf-hook
lyskom-current-conf
0)
(setq lyskom-current-conf 0)
;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on))
(cache-set-marked-texts (blocking-do 'get-marks))
;; What is this variable? It is never used. It is ust to
;; fill the cache?
(let ((lyskom-who-am-i (blocking-do '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-successful
(progn (clear-all-caches)
(unless (eq lyskom-language kom-default-language)
(when (lyskom-set-language kom-default-language 'local)
(unless lyskom-have-one-login
(lyskom-set-language kom-default-language 'global)
(lyskom-maybe-setq-default kom-default-language kom-default-language)
(setq-default lyskom-language kom-default-language))
(lyskom-format-insert
'language-set-to
(lyskom-language-name kom-default-language))))
(setq lyskom-have-one-login t))
(setq lyskom-pers-no old-me))
(when login-successful
(progn (clear-all-caches)
(unless (eq lyskom-language kom-default-language)
(when (lyskom-set-language kom-default-language 'local)
(unless lyskom-have-one-login
(lyskom-set-language kom-default-language 'global)
(lyskom-maybe-setq-default kom-default-language kom-default-language)
(setq-default lyskom-language kom-default-language))
(lyskom-format-insert
'language-set-to
(lyskom-language-name kom-default-language))))
(setq lyskom-have-one-login t)))
;; Show motd and encourage writing a presentation
......@@ -585,7 +588,6 @@ shown to other users."
;; Start the prefetch and update some basic caches
(lyskom-refetch))
(lyskom-end-of-command)))
;; Run the hook kom-login-hook. We don't want to hang the
......
......@@ -1656,6 +1656,7 @@ Du m
;; Button actions
(lyskom-button-view-text-action . "terse texten")
(lyskom-button-copy-text-no-action . "Kopiera inlggsnumret")
(lyskom-button-review-noconversion-action . "terse omodifierat")
(lyskom-button-find-root-review-action . "terse trd")
(lyskom-button-find-root-action . "terse urinlgget")
......
......@@ -682,6 +682,21 @@ destructive operations on the result may affect either operand."
(unless (memq x b) (setq result (cons x result))))
(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."
"List of URL managers. Each element is a list consisting of
(MANAGER-REGEXP PROTOCOLS NAME VIEW-FUNCTION). When LysKOM attempts to
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
the selected URL is used to view the URL by calling its VIEW-FUNCTION
with the URL and the manager entry as arguments.")
......@@ -1313,6 +1313,7 @@ appear more than once"
text-popup-title
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-find-root-review-action . lyskom-button-find-root-review)
(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