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

Refactored the code that controls adding memberships to eliminate

duplicated code in callers, to simplify callers and to make sure that
the appropriate questions were asked in the appropriate order at the
appropriate time regardless how one joins a conference.

Detailed changes:
> 	Fix new bug in kom-is-person-member-of-conference:
> 	* lyskom-rest.el (lyskom-get-read-texts-for-membership): Removed
> 	this function again. It isn't used anywhere any more.
>
> 	* commands2.el (kom-is-person-member-of-conference): Don't use
> 	lyskom-get-read-texts-for-membership. Don't need it.
>
> 	Refactoring of adding members to simplify all callers:
> 	* lyskom-rest.el (lyskom-check-go-to-conf): Use lyskom-add-member
> 	to add self when going to a conference we have been invited to or
> 	need to depassivate.
> 	(lyskom-startup-check-recommended-memberships): Use
> 	lyskom-add-member to accept recommendations.
>
> 	* commands1.el (lyskom-add-member): New function.
> 	(kom-add-self): Use lyskom-add-member.
> 	(kom-add-member): Use lyskom-add-member.
> 	(lyskom-add-member-by-no): Use lyskom-add-member.
> 	(lyskom-go-to-conf): Don't ask for number of unread here.
> 	(lyskom-add-member-answer): Removed this junk.
> 	(lyskom-try-add-member): Removed this junk too.
> 	(kom-change-priority): Use lyskom-add-member. Refuse to change
> 	priority of passive memberships.
>
parent 5d15ad0b
2004-02-22 David Byers <byers@lysator.liu.se>
Fix new bug in kom-is-person-member-of-conference:
* lyskom-rest.el (lyskom-get-read-texts-for-membership): Removed
this function again. It isn't used anywhere any more.
* commands2.el (kom-is-person-member-of-conference): Don't use
lyskom-get-read-texts-for-membership. Don't need it.
Refactoring of adding members to simplify all callers:
* lyskom-rest.el (lyskom-check-go-to-conf): Use lyskom-add-member
to add self when going to a conference we have been invited to or
need to depassivate.
(lyskom-startup-check-recommended-memberships): Use
lyskom-add-member to accept recommendations.
* commands1.el (lyskom-add-member): New function.
(kom-add-self): Use lyskom-add-member.
(kom-add-member): Use lyskom-add-member.
(lyskom-add-member-by-no): Use lyskom-add-member.
(lyskom-go-to-conf): Don't ask for number of unread here.
(lyskom-add-member-answer): Removed this junk.
(lyskom-try-add-member): Removed this junk too.
(kom-change-priority): Use lyskom-add-member. Refuse to change
priority of passive memberships.
Fix bug 1251:
* commands1.el (kom-move-text): Don't try to move footnotes and
attachments that we can't read.
......
This diff is collapsed.
......@@ -2689,7 +2689,6 @@ See `kom-keep-alive' for more information."
(lyskom-replace-deferred
defer-info (lyskom-get-string 'Unknown-number))
(let ((conf-stat (defer-info->data defer-info)))
(lyskom-get-read-texts-for-membership (or pers-no lyskom-pers-no) membership)
(lyskom-replace-deferred defer-info
(number-to-string
(- (+ (conf-stat->first-local-no conf-stat)
......
......@@ -446,12 +446,14 @@ and you have finished reading. Please come back later.
(cant-move-from-to-same . "Source and target conferences must be different.\n")
(where-on-list-q . "Placement in your list? (0-%#1d) ")
(member-in-conf . "Joining to %#1M%#2?b%[ %#2s%]%[%]...")
(accepting-invitation . "Accepting invitation to %#2M%#3?b%[ %#3s%]%[%]...")
(member-in-conf . "Joining %#2M%#3?b%[ %#3s%]%[%]...")
(member-in-conf-with-low-priority . "%#1M has lower priority than your session priority, and will not be shown.\n")
(member-in-conf-with-unread-date . "with unread from %#2s %#3d, %#1d")
(member-in-conf-with-unread . "unread %#1d unread")
(add-member-in . "Adding %#1P as a member of %#2M...")
(change-priority-for-q . "Change priority of conference: ")
(cant-change-priority-of-passive . "Can't change priority of passive memberships.\n")
(change-priority-for . "Changing priority of %#2M...")
(unsubscribe-to . "Leaving %#1M...")
(unsubscribe-to-2 . "Leaving %#1M%#2s...")
......@@ -477,6 +479,7 @@ and you have finished reading. Please come back later.
(exclude-from . "Removing %#1P from %#2M...")
(unsubscribe-failed . "\nDidn't work. Perhaps %#1P isn't a member of %#2M?\n")
(activate-mship . "Become active member of %#1M...")
(activate-mship-done . "Activated passive membership of %#1M.\n")
(passivate-done . "You are now a passive member of %#1M.
Leave the conference again to unsubscribe completely.\n")
......
......@@ -682,29 +682,12 @@ If CONF is nil, check the first conf on the to-do list."
conf-stat
(membership->created-by mship))
(if (lyskom-j-or-n-p (lyskom-get-string 'accept-invitation))
(progn
(set-membership-type->invitation type nil)
(initiate-set-membership-type 'main
nil
lyskom-pers-no
(conf-stat->conf-no conf-stat)
(membership->type mship))
(lyskom-add-member-answer
(lyskom-try-add-member conf-stat
(blocking-do 'get-conf-stat lyskom-pers-no)
(blocking-do 'get-pers-stat lyskom-pers-no)
nil
'change-priority-for
t)
conf-stat (blocking-do 'get-conf-stat lyskom-pers-no)
(setq continue t))
(lp--update-buffer (conf-stat->conf-no conf-stat)))
(progn
(let ((kom-unsubscribe-makes-passive nil))
(lyskom-sub-member (blocking-do 'get-conf-stat lyskom-pers-no)
conf-stat))
(setq continue nil)
)))
(setq continue (lyskom-add-member (blocking-do 'get-conf-stat lyskom-pers-no) conf-stat))
(let ((kom-unsubscribe-makes-passive nil))
(lyskom-sub-member (blocking-do 'get-conf-stat lyskom-pers-no)
conf-stat)
(setq continue nil))))
(when (and continue (membership-type->secret type))
(lyskom-format-insert-before-prompt 'bug-secret-mship conf-stat))
......@@ -715,21 +698,9 @@ If CONF is nil, check the first conf on the to-do list."
(lyskom-format-insert 'enter-passive conf-stat)
(setq continue nil)
(if (lyskom-j-or-n-p (lyskom-format 'convert-passive conf-stat))
(progn
(set-membership-type->passive type nil)
(set-membership-type->message-flag
type
(lyskom-j-or-n-p (lyskom-format 'set-message-flag-q
conf-stat)))
(blocking-do 'set-membership-type
lyskom-pers-no
(conf-stat->conf-no conf-stat)
(membership->type mship))
(lyskom-fetch-start-of-map conf-stat mship)
(lp--update-buffer (conf-stat->conf-no conf-stat))
(setq continue t))
(progn
(setq continue nil))))
(setq continue
(lyskom-add-member (blocking-do 'get-conf-stat lyskom-pers-no) conf-stat))
(setq continue nil)))
)
;;; Return the result
......@@ -817,21 +788,9 @@ by PERS-NO"
(lyskom-format-insert 'has-recommended-conf
(elt rec 3)
(elt rec 0))
(if (lyskom-j-or-n-p
(lyskom-format 'accept-recommendation (elt rec 0)))
(let ((kom-membership-default-priority
(if (elt rec 1) 'ask kom-membership-default-priority)))
(lyskom-add-member-answer
(lyskom-try-add-member conf-stat
pers-conf-stat
pers-stat
(lyskom-create-membership-type
nil nil nil nil nil nil nil nil)
'accepting-recommendation
t
(elt rec 1))
conf-stat
pers-conf-stat))
(if (lyskom-j-or-n-p (lyskom-format 'accept-recommendation (elt rec 0)))
(lyskom-add-member pers-conf-stat conf-stat nil nil
(and (elt rec 1) (list (elt rec 1))) nil)
(lyskom-reject-recommendation (elt rec 0)))))))))
(defun lyskom-clean-read-faqs (pers-no)
......@@ -1044,24 +1003,6 @@ found in lyskom-membership, a blocking call to the server is made."
nil))))))
(defun lyskom-get-read-texts-for-membership (pers-no mship)
"Get read-texts for membership MSHIP"
(when (and mship (null (membership->read-texts mship)))
(let ((result (make-collector)))
(initiate-query-read-texts 'read-texts
'collector-push
pers-no
(membership->conf-no mship)
t
lyskom-max-int
result)
(lyskom-wait-queue 'read-texts)
(when (car (collector->value result))
(set-membership->read-texts
mship
(or (membership->read-texts (car (collector->value result)))
(make-vector 0 nil)))))))
;;;; ================================================================
;;;; Scrolling and text insertion.
......
......@@ -286,7 +286,7 @@ f
(done . "klart.\n")
(cancelled . "avbrutet.\n")
(nope . "det gick inte.\n")
(add-already-member . "%#1P r redan medlem i %#2M.\n")
(add-already-member . "%#2P r redan medlem i %#1M.\n")
(you-already-member . "Du r redan medlem i %#1M.\n")
(cant-find-supervisor . "Hittar inte organisatren fr %#1M.\n")
......@@ -436,12 +436,14 @@ du har l
(cant-move-from-to-same . "Mtet du flyttar till kan inte vara samma som du flyttar frn.\n")
(where-on-list-q . "Placering p listan? (0-%#1d) ")
(member-in-conf . "Bli medlem i %#1M%#2?b%[ %#2s%]%[%]...")
(accepting-invitation . "Accepterar inbjudan till %#2M%#3?b%[ %#3s%]%[%]...")
(member-in-conf . "Bli medlem i %#2M%#3?b%[ %#3s%]%[%]...")
(member-in-conf-with-low-priority . "%#1M har lgre prioritet n din lsniv och kommer drfr inte att visas.\n")
(member-in-conf-with-unread-date . "med olsta frn %#3d %#2s %#1d")
(member-in-conf-with-unread . "med %#1d olsta")
(add-member-in . "Addera %#1P som medlem i %#2M...")
(change-priority-for-q . "ndra prioritet fr mte: ")
(cant-change-priority-of-passive . "Kan inte ndra prioritet p passiva medlemskap.\n")
(change-priority-for . "ndra prioritet p %#2M...")
(unsubscribe-to . "Uttrda ur %#1M...")
(unsubscribe-to-2 . "Uttrda ur %#1M%#2s...")
......@@ -467,6 +469,7 @@ du har l
(exclude-from . "Utesluta %#1P frn %#2M...")
(unsubscribe-failed . "\nDet gick inte. %#1P var kanske aldrig medlem i %#2M?\n")
(activate-mship . "Bli aktiv medlem i %#1M...")
(activate-mship-done . "Du r nu ter aktiv medlem i %#1M.\n")
(passivate-done . "Du r nu passiv medlem i %#1M.
Uttrd ur mtet en gng till fr g ur helt.\n")
......
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