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

Lots of bug fixes. See ChangeLog

parent 59359905
2000-01-03 David Byers <davby@ida.liu.se>
* commands1.el (lyskom-private-answer-soon): Fix buggy nesting.
How the *hell* does this happen?
1999-12-21 David Byers <davby@ida.liu.se>
* lyskom-rest.el (lyskom-fill-region): Never signal errors in
fill-region.
1999-12-20 David Byers <davby@ida.liu.se>
* services.el (initiate-create-anonymous-text): Work. Put STRING
in front of message string so lyskom-format-objects recognizes
what it is.
1999-12-18 David Byers <davby@ida.liu.se>
* lyskom-rest.el (lyskom-next-command): Use unwind-protect to
reset lyskom-doing-default-command because Gnu Emacs loses when
you let a buffer-local variable and change buffers inside the let
body (it resets the value in buffer current when leaving the let)
1999-12-13 David Byers <davby@ida.liu.se>
* reading.el: Set buffer to lyskom-buffer in several
membership-related functions.
* lyskom-rest.el (lyskom-try-get-membership): Set buffer to
lyskom-buffer.
(lyskom-get-membership): Same here.
1999-12-11 David Byers <davby@ida.liu.se>
* option-edit.el: Honor properties specified in
lyskom-custom-variables by using lyskom-build-simple-widget-spec
to build all widgets.
(lyskom-build-simple-widget-spec): New function.
* reading.el (lyskom-do-insert-membership): New function.
(lyskom-replace-membership): Use lyskom-do-insert-membership and
lyskom-do-remove-membership.
(lyskom-do-remove-membership): New function.
(lyskom-remove-membership): Use it.
* commands1.el (lyskom-sub-member): Don't call
lyskom-remove-membership with membership-list arg.
* async.el (lyskom-async-forced-leave-conf): Don't call
lyskom-remove-membership with membership-list arg.
* mship-edit.el (lyskom-prioritize-flag-toggle): Don't call
lyskom-replace-members with membership-list arg.
* commands2.el (kom-set-unread): Don't call lyskom-replace-members
with membership-list arg.
* async.el (lyskom-async-new-membership): Don't call
lyskom-replace-members with membership-list arg.
* reading.el (lyskom-insert-membership): Insert the membership at
the correct position in the membership list.
* commands1.el (lyskom-add-membership): Call without
membership-list argument.
* startup.el (lyskom-set-membership): Use lyskom-sort-membership.
* lyskom-rest.el (lyskom-membership-<): Consider positions as well
as priorities.
* commands1.el (lyskom-try-add-member): Added
need-extra-information parameter.
(kom-add-member): Call lyskom-try-add-member with
need-extra-information.
(kom-add-self): Same here.
(kom-change-priority): Same here.
(lyskom-add-member-by-no): Same here.
(lyskom-add-member-answer): Accept answer containing position
parameter. Set position of new membership using position parameter
if it is not supplied by the server.
1999-12-10 David Byers <davby@ida.liu.se>
* commands1.el (lyskom-sub-member): Don't try to passivate unless
we have passive memberships in the server.
* option-edit.el (lyskom-customize-apply): Set the default value
of a variable when the user says not to save it in the server.
(lyskom-customize-send): Set variables in the Emacs buffer using
setq-default. Don't quote nil or t in the output.
2000-01-10 David Byers <davby@ida.liu.se>
* flags.el (lyskom-read-options-eval): Add format argument to
......
......@@ -47,7 +47,7 @@ LANGUAGES = swedish english
SHELL = /bin/sh
RM = /bin/rm -f
EMACS=emacs
EMACS=xemacs
EMACS-BATCH = $(EMACS) -batch
GENERIC-CLEAN = *~ *.o core
GENERIC-DIST-CLEAN = TAGS
......
......@@ -5,13 +5,33 @@ Att g
* SHOWSTOPPERS
** Om man går ur ett möte i en server som inte har set-membership-type
så försöker klienten ändå att göra set-membership-type
(commands1.el, lyskom-sub-member.)
** Man får illegal consp nil i processfiltret när man går med i eller
ändrar prioritet på ett möte ibland. Sällan. Jag gick med i
programmering i TokKOM med kom-handle-membership uppe. När jag
tryckte + så blev det fel. Tror det är i callbacken. Det verkar
vara timingberoende och cacheberoende på något vis. Jag har fått
det på andra sätt också.
** Inställningsbufferten är buggig. Om man har en inställning i
servern och markerar att den skall sparas i .emacs så sparas
defaultvärdet och inte det aktuella värdet. Buggligt ju! Jag undrar
om det kan bli fel när man går åt andra hållet också.
Antagligen är det fixat nu.
** När man går med i ett möte så sorteras inte medlemskapet in korrekt
i medlemskapslistan.
Problemet uppstår framförallt med 1.9-servers som inte vet hur man
skall handskas med medlemskapspositioner. Hanteringen av
medlemskapen i lyskom-insert-membership med vänner är också
suspekt. Den måste sätta in på rätt position, om man kan
positionen, och därefter uppdatera de andra elementens position.
Antagligen fixat, men Stacken uppgraderade sin server så det är
svårare att testa nu.
* MULEification
These items have to be dealt with before the client can be used in a
......@@ -20,8 +40,6 @@ Att g
** Encode/decode appropriate aux-items.
** Binding of f ä.
** In edit-filter mode, check how subject åäö is handled.
** Write code to deal with the situation where you create a filter in
......@@ -64,7 +82,7 @@ Att g
asynchronous calls too.
** Look over all callbacks and see to it that they don't use
lyskom-wait-queue, lyskom-collet, lyskom-use, lyskom-list-use,
lyskom-wait-queue, lyskom-collect, lyskom-use, lyskom-list-use,
blocking-do or multiple-blocking do since this is detrimental to
performance and possibly incompatible with the current parser.
......@@ -306,6 +324,8 @@ j-or-n-p.
* FÖRBÄTTRINGAR
** Kopiera inställningar från en server till en annan.
** PRIORITERA MÖTEN
Skriv klart Hantera medlemskap (aka prioritera möten.) Se till att
......
......@@ -276,7 +276,7 @@ this function shall be with current-buffer the BUFFER."
(if conf-stat
(lyskom-format-insert-before-prompt 'no-longer-member conf-stat)
(lyskom-format-insert-before-prompt 'no-longer-member-n conf-no))
(lyskom-remove-membership conf-no lyskom-membership)
(lyskom-remove-membership conf-no)
(when (eq conf-no lyskom-current-conf)
(lyskom-leave-current-conf))
(read-list-delete-read-info conf-no lyskom-to-do-list)
......@@ -298,7 +298,7 @@ this function shall be with current-buffer the BUFFER."
conf-conf-stat))
(cond ((membership-type->passive (membership->type membership))
(lyskom-replace-membership membership lyskom-membership)
(lyskom-replace-membership membership)
(when (eq conf-no lyskom-current-conf)
(lyskom-leave-current-conf))
(read-list-delete-read-info conf-no lyskom-to-do-list)
......@@ -310,7 +310,7 @@ this function shall be with current-buffer the BUFFER."
;; FIXME: Maybe fix this.
(cur-mship
(lyskom-replace-membership membership lyskom-membership))
(lyskom-replace-membership membership))
;; Not a member. Completely new. Deal with it.
(t (lyskom-add-membership membership conf-no))))))
......
......@@ -328,7 +328,8 @@ Ask for the name of the person, the conference to add him/her to."
(whereto (lyskom-read-conf-stat (lyskom-get-string 'where-to-add)
'(all) nil nil t))
(pers-stat (blocking-do 'get-pers-stat (conf-stat->conf-no who))))
(lyskom-add-member-answer (lyskom-try-add-member whereto who pers-stat nil)
(lyskom-add-member-answer (lyskom-try-add-member whereto who
pers-stat nil nil t)
whereto who)))
......@@ -353,7 +354,7 @@ Ask for the name of the person, the conference to add him/her to."
(if (and mship (membership-type->passive (membership->type mship)))
(membership->priority mship)
kom-membership-default-priority)))
(lyskom-add-member-answer (lyskom-try-add-member whereto who pers-stat nil)
(lyskom-add-member-answer (lyskom-try-add-member whereto who pers-stat nil nil t)
whereto who))))
......@@ -372,7 +373,7 @@ Ask for the name of the person, the conference to add him/her to."
(lyskom-format-insert 'not-member-of-conf conf))
(t (lyskom-add-member-answer
(lyskom-try-add-member conf-stat who pers-stat nil
'change-priority-for)
'change-priority-for t)
conf-stat who))))))
......@@ -389,18 +390,19 @@ for person PERS-NO and send them into lyskom-try-add-member."
(blocking-do-multiple ((whereto (get-conf-stat conf-no))
(who (get-conf-stat pers-no))
(pers-stat (get-pers-stat pers-no)))
(let ((result (lyskom-try-add-member whereto who pers-stat nil)))
(let ((result (lyskom-try-add-member whereto who pers-stat nil nil t)))
(lyskom-add-member-answer result whereto who)
(if thendo
(apply thendo data))
result)))
(car result))))
(defun lyskom-try-add-member (conf-conf-stat
pers-conf-stat
pers-stat
membership-type
&optional message-string)
&optional message-string
need-extra-information)
"Add a member to a conference.
Args: CONF-CONF-STAT PERS-CONF-STAT PERS-STAT
CONF-CONF-STAT: the conf-stat of the conference the person is being added to
......@@ -408,7 +410,11 @@ PERS-CONF-STAT: the conf-stat of the person being added.
PERS-STAT: the pers-stat of the person being added.
Optional MESSAGE-STRING is the message to print before making server call.
Returns t if it was possible, otherwise nil."
Returns t if it was possible, otherwise nil.
If optional NEED-EXTRA-INFORMATION is non-nil, the return value will be
a list where the first element is the result of add-member and the second
is the position where the membership was placed."
(if (or (null conf-conf-stat)
(null pers-conf-stat))
nil ; We have some problem here.
......@@ -439,6 +445,33 @@ Returns t if it was possible, otherwise nil."
(lyskom-format 'where-on-list-q
(length lyskom-membership))))))))
;;
;; Adding ourselves. Adjust where so the membership
;; list remains sorted. Find the closest position to
;; where at which we can put the membership and keep
;; the membership lsit sorted.
;;
(when (eq lyskom-pers-no (conf-stat->conf-no pers-conf-stat))
(let ((mship-list lyskom-membership)
(mship nil)
(index 0)
(found nil))
(while mship-list
(setq mship (car mship-list)
mship-list (cdr mship-list))
(cond ((> (membership->priority mship) priority))
((< (membership->priority mship) priority)
(setq where index mship-list nil found t))
((and (= (membership->priority mship) priority)
(= index where))
(setq mship-list nil found t))
((and (= (membership->priority mship) priority)
(> index where))
(setq where index mship-list nil found t)))
(setq index (1+ index))
(unless found (setq where (1+ index))))))
(when (null membership-type)
(setq membership-type
(lyskom-create-membership-type nil nil nil nil
......@@ -457,59 +490,67 @@ Returns t if it was possible, otherwise nil."
conf-conf-stat)))
(lyskom-ignoring-async (18 lyskom-pers-no
(conf-stat->conf-no conf-conf-stat))
(blocking-do 'add-member
(conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)
priority where
membership-type)))))
(defun lyskom-add-member-answer (answer conf-conf-stat pers-conf-stat)
(let ((res (blocking-do 'add-member
(conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)
priority where
membership-type)))
(if need-extra-information
(list res where)
res))))))
(defun lyskom-add-member-answer (answer conf-conf-stat
pers-conf-stat)
"Handle the result from an attempt to add a member to a conference."
(if (null answer)
(progn
(lyskom-insert-string 'nope)
(let* ((errno lyskom-errno)
(is-supervisor (lyskom-is-supervisor (conf-stat->conf-no conf-conf-stat)
lyskom-pers-no))
(is-member (lyskom-is-member (conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)))
(rd-prot (conf-type->rd_prot (conf-stat->conf-type conf-conf-stat))))
(cond (is-member
(lyskom-format-insert 'add-already-member
pers-conf-stat
conf-conf-stat))
((and rd-prot is-supervisor)
(lyskom-format-insert 'error-code (lyskom-get-error-text errno)))
(rd-prot (let ((supervisorconf (blocking-do
'get-conf-stat
(conf-stat->supervisor conf-conf-stat))))
(if supervisorconf
(lyskom-format-insert 'is-read-protected-contact-supervisor
conf-conf-stat
supervisorconf)
(lyskom-format-insert 'cant-find-supervisor
conf-conf-stat))))
(t (lyskom-format-insert 'error-code
(lyskom-get-error-text lyskom-errno)
lyskom-errno)))))
(lyskom-insert-string 'done)
;;+++Borde {ndra i cachen i st{llet.
(cache-del-pers-stat (conf-stat->conf-no pers-conf-stat))
;;+++Borde {ndra i cachen i st{llet.
(cache-del-conf-stat (conf-stat->conf-no conf-conf-stat))
(if (= (conf-stat->conf-no pers-conf-stat)
lyskom-pers-no)
(progn ; Adding myself
(lyskom-add-membership
(blocking-do 'query-read-texts
lyskom-pers-no
(conf-stat->conf-no conf-conf-stat))
(conf-stat->conf-no conf-conf-stat))))))
(let ((pos (if (consp answer) (elt answer 1) nil))
(answer (if (consp answer) (elt answer 0) answer)))
(if (null answer)
(progn
(lyskom-insert-string 'nope)
(let* ((errno lyskom-errno)
(is-supervisor (lyskom-is-supervisor (conf-stat->conf-no conf-conf-stat)
lyskom-pers-no))
(is-member (lyskom-is-member (conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)))
(rd-prot (conf-type->rd_prot (conf-stat->conf-type conf-conf-stat))))
(cond (is-member
(lyskom-format-insert 'add-already-member
pers-conf-stat
conf-conf-stat))
((and rd-prot is-supervisor)
(lyskom-format-insert 'error-code (lyskom-get-error-text errno)))
(rd-prot (let ((supervisorconf (blocking-do
'get-conf-stat
(conf-stat->supervisor conf-conf-stat))))
(if supervisorconf
(lyskom-format-insert 'is-read-protected-contact-supervisor
conf-conf-stat
supervisorconf)
(lyskom-format-insert 'cant-find-supervisor
conf-conf-stat))))
(t (lyskom-format-insert 'error-code
(lyskom-get-error-text lyskom-errno)
lyskom-errno)))))
(lyskom-insert-string 'done)
;;+++Borde {ndra i cachen i st{llet.
(cache-del-pers-stat (conf-stat->conf-no pers-conf-stat))
;;+++Borde {ndra i cachen i st{llet.
(cache-del-conf-stat (conf-stat->conf-no conf-conf-stat))
(if (= (conf-stat->conf-no pers-conf-stat)
lyskom-pers-no)
(let ((mship (blocking-do 'query-read-texts
lyskom-pers-no
(conf-stat->conf-no conf-conf-stat))))
(unless (membership->position mship)
(set-membership->position mship pos))
(lyskom-add-membership mship
(conf-stat->conf-no conf-conf-stat)))))))
......@@ -519,7 +560,7 @@ Args: MEMBERSHIP CONF-STAT THENDO DATA
Also adds to lyskom-to-do-list."
(if membership
(progn
(lyskom-insert-membership membership lyskom-membership)
(lyskom-insert-membership membership)
(lyskom-prefetch-map conf-no membership)
(lyskom-run-hook-with-args 'lyskom-add-membership-hook
membership))
......@@ -574,6 +615,7 @@ of the person."
kom-unsubscribe-makes-passive
(lyskom-get-membership (conf-stat->conf-no conf))))
(passivate (and mship
(lyskom-have-call 102) ; set-membership-type
(not (membership-type->passive
(membership->type mship))))))
......@@ -610,8 +652,7 @@ of the person."
(conf-stat->conf-no conf)
(conf-stat->conf-no pers))))
(if self
(lyskom-remove-membership (conf-stat->conf-no conf)
lyskom-membership))
(lyskom-remove-membership (conf-stat->conf-no conf)))
(if (not reply)
(lyskom-format-insert 'unsubscribe-failed
(if self
......@@ -974,8 +1015,8 @@ that text instead."
(lyskom-private-answer text-stat
(substring str
0 (match-beginning 0)))
(lyskom-private-answer text-stat ""))
(lyskom-format-insert 'no-such-text-no text-no))))
(lyskom-private-answer text-stat "")))
(lyskom-format-insert 'no-such-text-no text-no)))
(defun lyskom-private-answer (text-stat subject)
......
......@@ -707,7 +707,7 @@ send. If DONTSHOW is non-nil, don't display the sent message."
lyskom-pers-no
conf-no)))
(lyskom-ignore result)
(lyskom-replace-membership membership lyskom-membership)
(lyskom-replace-membership membership)
(if (= conf-no lyskom-current-conf)
(set-read-list-empty lyskom-reading-list))
(read-list-delete-read-info conf-no lyskom-to-do-list)
......
......@@ -244,32 +244,40 @@ If the optional argument REFETCH is non-nil, all caches are cleared and
(defun lyskom-next-command ()
"Run next command."
(let ((lyskom-doing-default-command t))
(cond
((eq lyskom-command-to-do 'next-pri-text)
(lyskom-view-priority-text))
((eq lyskom-command-to-do 'next-text)
(kom-view-next-text))
((eq lyskom-command-to-do 'reedit-text)
(kom-re-edit-next-text))
((eq lyskom-command-to-do 'next-pri-session)
(kom-go-to-pri-session))
((eq lyskom-command-to-do 'next-conf)
(kom-go-to-next-conf))
((eq lyskom-command-to-do 'next-pri-conf)
(lyskom-go-to-pri-conf))
((eq lyskom-command-to-do 'when-done)
(let ((command (lyskom-what-to-do-when-done)))
(cond
((or (stringp command)
(vectorp command))
(execute-kbd-macro command))
((commandp command) (call-interactively command))
(t (lyskom-start-of-command nil) (lyskom-end-of-command)))))
((eq lyskom-command-to-do 'unknown)
(lyskom-insert
(lyskom-get-string 'wait-for-server)))
(t (signal 'lyskom-internal-error '(kom-next-command))))))
(let ((saved-buffer (current-buffer)))
(unwind-protect
(progn
(setq lyskom-doing-default-command t)
(cond
((eq lyskom-command-to-do 'next-pri-text)
(lyskom-view-priority-text))
((eq lyskom-command-to-do 'next-text)
(kom-view-next-text))
((eq lyskom-command-to-do 'reedit-text)
(kom-re-edit-next-text))
((eq lyskom-command-to-do 'next-pri-session)
(kom-go-to-pri-session))
((eq lyskom-command-to-do 'next-conf)
(kom-go-to-next-conf))
((eq lyskom-command-to-do 'next-pri-conf)
(lyskom-go-to-pri-conf))
((eq lyskom-command-to-do 'when-done)
(let ((command (lyskom-what-to-do-when-done)))
(cond
((or (stringp command)
(vectorp command))
(execute-kbd-macro command))
((commandp command) (call-interactively command))
(t (lyskom-start-of-command nil) (lyskom-end-of-command)))))
((eq lyskom-command-to-do 'unknown)
(lyskom-insert
(lyskom-get-string 'wait-for-server)))
(t (signal 'lyskom-internal-error '(kom-next-command)))))
(condition-case nil
(save-excursion
(set-buffer saved-buffer)
(setq lyskom-doing-default-command nil))
(error nil)))))
;;; ================================================================
......@@ -718,17 +726,19 @@ instead.
This function does not use blocking-do.
Optional argument mship-list is the membership list to look in."
(let ((list lyskom-membership)
(found nil))
(while (and (not found) (not (null list)))
(if (= conf-no (membership->conf-no (car list)))
(setq found (car list)))
(setq list (cdr list)))
(if (and found
(or want-passive
(not (membership-type->passive (membership->type found)))))
found
nil)))
(save-excursion
(set-buffer lyskom-buffer)
(let ((list lyskom-membership)
(found nil))
(while (and (not found) (not (null list)))
(if (= conf-no (membership->conf-no (car list)))
(setq found (car list)))
(setq list (cdr list)))
(if (and found
(or want-passive
(not (membership-type->passive (membership->type found)))))
found
nil))))
(defun lyskom-get-membership (conf-no &optional want-passive)
"Get the membership for CONF-NO, or nil if the user is not a member of
......@@ -736,18 +746,20 @@ CONF-NO.
If the membership list is not fully prefetched and the membership can't be
found in lyskom-membership, a blocking call to the server is made."
(or (lyskom-try-get-membership conf-no want-passive)
(and (not (lyskom-membership-is-read))
(let ((membership
(blocking-do 'query-read-texts lyskom-pers-no conf-no)))
(if (and membership (lyskom-visible-membership membership))
(lyskom-add-membership membership conf-no))
(if (and membership
(or want-passive
(not (membership-type->passive
(membership->type membership)))))
membership
nil)))))
(save-excursion
(set-buffer lyskom-buffer)
(or (lyskom-try-get-membership conf-no want-passive)
(and (not (lyskom-membership-is-read))
(let ((membership
(blocking-do 'query-read-texts lyskom-pers-no conf-no)))
(if (and membership (lyskom-visible-membership membership))
(lyskom-add-membership membership conf-no))
(if (and membership
(or want-passive
(not (membership-type->passive
(membership->type membership)))))
membership
nil))))))
;;;; ================================================================
......@@ -1835,7 +1847,9 @@ in lyskom-messages."
(backward-char 1)
(delete-horizontal-space))
(error nil)))
(fill-region start (min end (point-max)) justify nosqueeze to-eop))))
(condition-case nil
(fill-region start (min end (point-max)) justify nosqueeze to-eop)
(error nil)))))
(defun lyskom-fill-message (text)
"Try to reformat a message."
......@@ -3065,8 +3079,15 @@ lyskom-get-string to retrieve regexps for answer and string for repeated query."
(defun lyskom-membership-< (a b)
"Retuns t if A has a higher priority than B. A and B are memberships."
(> (membership->priority a)
(membership->priority b)))
(cond ((> (membership->priority a)
(membership->priority b)) t)
((and (= (membership->priority a)
(membership->priority b))
(numberp (membership->position a))
(numberp (membership->position b)))
(< (membership->position a)
(membership->position b)))
(t nil)))
(defun impl ()
......
......@@ -619,7 +619,7 @@ clicked on."
(blocking-do 'query-read-texts
lyskom-pers-no
(membership->conf-no (lp--entry->membership entry)))))
(lyskom-replace-membership mship lyskom-membership)
(lyskom-replace-membership mship)
(set-lp--entry->membership entry mship)
(when (eq flag 'passive)
(cond ((membership-type->passive (membership->type mship))
......@@ -1127,9 +1127,9 @@ Entry to this mode runs lyskom-prioritize-mode-hook."
(lp--update-mode-line)
(setq buffer-read-only t)
(lyskom-use-local-map lp--mode-map)
;; (lyskom-add-hook 'lyskom-add-membership-hook
;; 'lyskom-prioritize-add-membership