Commit 72780eeb authored by David Kågedal's avatar David Kågedal
Browse files

Fixade medlem, utträd, endast och lite till. Förhoppningsvis ska man

inte kunna villa bort listan över inlägg att läsa.
parent 8855d520
......@@ -16,8 +16,16 @@ trevligt med nyb
* Fitjurs och förbättringar
** En nygammal prefetch har börjat användas. Detta gör att allting går
mycket fortare, men har sidoeffekten att det kan se ut som om man
har läst ut LysKOM innan klienten har läst in alla information från
servern.
** Det går hjälpligt att köra elispklienten under XEmacs.
** Färgläggning av KOM-bufferten sker även under Windows-versionen av
Emacs.
** Kommandot "Återse fler inlägg", bunder till "åy" fortsätter ett
återsekommando från den plats det slutade, med samma kriterier. Det
innebär att Återse senaste 10 av XX till YY följt av Återse 10 fler
......@@ -29,6 +37,9 @@ trevligt med nyb
** kom-permissive-completion är satt till t per default.
** LysKOM-bufferten är skrivskyddad (igen), och har undo-information
avslagen.
** En experimentell Ändra Variabler har inkluderats. För att den skall
fungera krävs det att Emacs kan hitta Per Abrahamsens widget-paket
(kan hämtas på http://www.dina.kvl.dk/~abraham/custom), minst
......@@ -53,9 +64,15 @@ trevligt med nyb
Hanteringen är dock något primitiv eftersom man inte kan välja
vilket program som skall användas för att skicka mail.
** Kommandona Medlem, Utträd och Endast har blivit både snabbare och
mer robusta.
* Bugfixar
** Koden för att läsa in textmappar har optimerats rejält. Det,
tillsammans med den nya prefetchen gör att man kan läsa I]M, även
med flera utlästa trådar.
** Completion fungerar bättre. Numera borde completion avslutas med SPC
bara när det verkligen passar.
......@@ -64,6 +81,10 @@ trevligt med nyb
** De engelska strängarna är översedda och genomgågna och stämmer nu
väl överens med de svenska.
** Chanserna att man får klienten att tappa orineteringen när man
trycker C-g har minskat. Nackdelen med detta är att C-g kan ge lite
sämre responstid, men det borde inte inte bli så mycket längre.
* Välkända buggar som inte behöver rapporteras igen (och igen (och igen))
** Om man gör "Endast" kan klienten bete sig konstigt en kort stund,
......
Thu Oct 10 00:32:38 1996 David Kgedal <davidk@lysator.liu.se>
* Makefile (PARTS-EL,SRC-ELC): Flyttade upp prefetch.el.
* async.el (lyskom-add-new-text): Anvnd
lyskom-try-get-membership.
* prioritize.el (lyskom-get-membership-in-conf): Tog bort.
(lyskom-prioritize-handle-get-conf-stat): Anvnd
lyskom-get-membership istllet.
(lyskom-prioritize-tell-server): Dito.
* startup.el (lyskom-refetch): Stt lyskom-membership till nil.
* swedish-strings.el: (messages) La till waiting-for-membership.
* english-strings.el: (messages) Dito.
* lyskom-rest.el (lyskom-wait-for-membership): Ny funktion.
(lyskom-get-membership): Ny funktion.
(lyskom-is-read-handler): Anvnd den
(lyskom-try-get-membership): Bytte namn frn lyskom-member-p.
* services.el (blocking-do): Anvnd lyskom-accept-process-output.
* utilities.el (lyskom-accept-process-output): Ny funktion.
* commands2.el (kom-set-unread): Gr inte lyskom-refetch, utan
hmta bara den information som behvs.
* commands1.el (lyskom-add-membership): Anvnd
lyskom-insert-membership.
(lyskom-sub-member): ndra interna strukturer istllet fr att
hmta om medlemskapslistan.
(lyskom-comment-recipients): Anvnd lyskom-get-membership.
(lyskom-change-pres-or-motd-2): Dito.
(kom-unset-conf-motd): Dito.
(lyskom-go-to-conf): Dito.
(lyskom-list-conf-print): Dito.
(lyskom-add-membership): Ta conf-no som argument istllet fr
conf-stat.
(lyskom-do-go-to-conf): Skrev om s att den hanterar
icke-prefetchade mten bttre.
* reading.el (lyskom-add-memberships-to-membership): Bytte namn
frn lyskom-add-membership-to-membership.
(lyskom-insert-membership): Ny funktion.
(lyskom-remove-membership): Ny funtion.
* prefetch.el (lyskom-prefetch-map): Ny funktion.
(lyskom-prefetch-map-from): Gamla lyskom-prefetch-map.
(lyskom-prefetch-one-request): Anvnd den nya funktionen.
(lyskom-prefetch-map-handler): Nytt termineringsvillkor.
(lyskom-reset-prefetch): Anropa lyskom-setup-prefetch, helt
enkelt.
(lyskom-membership-is-read): Ny funktion.
Tue Oct 8 14:33:24 1996 Niels Mller <nisse@lysator.liu.se>
* vars.el.in (lyskom-inherited-variables): Lade till
......
......@@ -43,6 +43,7 @@ EMACS-BATCH = $(EMACS) -batch
# NOTE: lyskom-rest.el must be the last file in PARTS-EL and SRC-ELC.
PARTS-EL = komtypes.el clienttypes.el deferred-insert.el utilities.el \
prefetch.el \
startup.el \
reading.el \
internal.el parse.el services.el cache.el\
......@@ -51,7 +52,6 @@ PARTS-EL = komtypes.el clienttypes.el deferred-insert.el utilities.el \
view-text.el async.el completing-read.el \
prioritize.el flags.el messages.el ansaphone.el remote-control.el \
menus.el slow.el \
prefetch.el \
elib-string.el \
lyskom-rest.el
HEADER-EL = vars.el macros.el language.el
......@@ -61,6 +61,7 @@ SWEDISH-ELC = swedish-strings.elc
ENGLISH-EL = english-strings.el
ENGLISH-ELC = english-strings.elc
SRC-ELC = komtypes.elc clienttypes.elc deferred-insert.elc utilities.elc \
prefetch.elc \
startup.elc \
reading.elc \
internal.elc parse.elc services.elc cache.elc\
......@@ -68,7 +69,7 @@ SRC-ELC = komtypes.elc clienttypes.elc deferred-insert.elc utilities.elc \
filter.elc filter-edit.elc lyskom-buttons.elc \
view-text.elc async.elc completing-read.elc \
prioritize.elc flags.elc messages.elc ansaphone.elc \
remote-control.elc menus.elc slow.elc prefetch.elc elib-string.elc \
remote-control.elc menus.elc slow.elc elib-string.elc \
lyskom-rest.elc
PARTS-ELC = $(SRC-ELC)
......
......@@ -3,6 +3,9 @@ Att g
Buggar
Om man går till ett möte som inte prefetchats och inte har några
inlägg blir promten fel, och man får ett felmeddelande.
Lista nyheter visar fel innan prefetchen har hämtat alla mappar.
Efter återse senaste fick jag fel prompt. Jag vill ha återse
......@@ -67,6 +70,8 @@ n
Allmänna förbättringar
Modifiera interna datastrukturer vid utträd.
Strunta i hemliga texter vid åar.
Gör inte nästa kommando efter en filtrering. Kontrollera med
......
......@@ -483,10 +483,11 @@ In that case, just discard this call."
;; We need a way to check if a conferences is fetched.
;; davidk /960924
(let ((member (lyskom-member-p (conf-stat->conf-no recipient))))
(if (and member
(let ((membership (lyskom-try-get-membership
(conf-stat->conf-no recipient))))
(if (and membership
;; (lyskom-conf-fetched-p (conf-stat->conf-no recipient))
(lyskom-visible-membership member)
(lyskom-visible-membership membership)
(not (read-list-enter-text text-no recipient
lyskom-to-do-list)))
;; If we have already read all texts in the conference or the
......@@ -494,8 +495,7 @@ In that case, just discard this call."
(let ((info (lyskom-create-read-info
'CONF
recipient
(membership->priority
(lyskom-member-p (conf-stat->conf-no recipient)))
(membership->priority membership)
(lyskom-create-text-list (list text-no)))))
(read-list-enter-read-info info lyskom-to-do-list)
(if (= lyskom-current-conf (conf-stat->conf-no recipient))
......
......@@ -399,11 +399,11 @@ Returns t if it was possible, otherwise nil."
(blocking-do 'query-read-texts
lyskom-pers-no
(conf-stat->conf-no conf-conf-stat))
conf-conf-stat)))))
(conf-stat->conf-no conf-conf-stat))))))
(defun lyskom-add-membership (membership conf-stat)
(defun lyskom-add-membership (membership conf-no)
"Adds MEMBERSHIP to the sorted list of memberships.
Args: MEMBERSHIP CONF-STAT THENDO DATA
Also adds to lyskom-to-do-list."
......@@ -411,34 +411,10 @@ Also adds to lyskom-to-do-list."
;;; kom-session-priority?
(if membership
(progn
(setq lyskom-membership (sort (cons membership lyskom-membership)
'lyskom-membership-<))
;; (let ((map (blocking-do
;; 'get-map
;; (conf-stat->conf-no conf-stat)
;; (max (1+ (membership->last-text-read membership))
;; (conf-stat->first-local-no conf-stat))
;; (conf-stat->no-of-texts conf-stat))))
;; (if map
;; (let ((texts (skip-first-zeros
;; (sort (listify-vector (map->text-nos map))
;; '<))))
;; (if texts
;; (read-list-enter-read-info
;; (lyskom-create-read-info
;; 'CONF conf-stat
;; (membership->priority membership)
;; (lyskom-create-text-list
;; texts)
;; nil nil)
;; lyskom-to-do-list))))
;; )
(lyskom-prefetch-map-using-conf-stat
conf-stat
(1+ (membership->last-text-read membership))
membership))
(lyskom-insert-string 'conf-does-not-exist))
)
(lyskom-insert-membership membership lyskom-membership)
(lyskom-prefetch-map conf-no
membership))
(lyskom-insert-string 'conf-does-not-exist)))
......@@ -496,8 +472,8 @@ of the person."
(conf-stat->conf-no conf)
(conf-stat->conf-no pers)))
(if self
(lyskom-set-membership (blocking-do 'get-membership
lyskom-pers-no)))
(lyskom-remove-membership (conf-stat->conf-no conf)
lyskom-membership))
(if (not reply)
(lyskom-format-insert 'unsubscribe-failed
(if self
......@@ -769,7 +745,7 @@ CCREP is a list of all recipients that are going to be cc-recipients."
'cc-recpt
'recpt)
(conf-stat->comm-conf conf-stat)))))
(if (lyskom-member-p (conf-stat->conf-no conf-stat))
(if (lyskom-get-membership (conf-stat->conf-no conf-stat))
(setq member t))
(setq recpts (cons (conf-stat->comm-conf conf-stat) recpts))))
(setq data (cdr data)))
......@@ -947,7 +923,7 @@ TYPE is either 'pres or 'motd, depending on what should be changed."
((null conf-stat) ;+++ annan felhantering
(lyskom-insert-string 'cant-get-conf-stat))
((or lyskom-is-administrator
(lyskom-member-p (conf-stat->supervisor conf-stat))
(lyskom-get-membership (conf-stat->supervisor conf-stat))
(= lyskom-pers-no (conf-stat->conf-no conf-stat)))
(lyskom-dispatch-edit-text
lyskom-proc
......@@ -1004,7 +980,7 @@ TYPE is either 'pres or 'motd, depending on what should be changed."
((null conf-stat)
(lyskom-insert-string 'cant-get-conf-stat))
((or lyskom-is-administrator
(lyskom-member-p (conf-stat->supervisor conf-stat)))
(lyskom-get-membership (conf-stat->supervisor conf-stat)))
;; This works like a dispatch. No error handling.
(lyskom-set-conf-motd 0 (conf-stat->conf-no conf-stat)))
(t
......@@ -1036,28 +1012,36 @@ back on lyskom-to-do-list."
Allowed conferences are conferences and the mailboxes you are
member of."
(if (numberp conf) (setq conf (blocking-do 'get-conf-stat conf)))
(let ((membership (lyskom-member-p
(conf-stat->conf-no conf))))
(let ((membership (lyskom-get-membership (conf-stat->conf-no conf))))
(lyskom-format-insert 'go-to-conf
conf)
(cond
(membership
(lyskom-do-go-to-conf conf membership))
((conf-type->letterbox (conf-stat->conf-type conf))
(lyskom-format-insert 'cant-go-to-his-mailbox
conf))
(t
(progn
(lyskom-format-insert 'not-member-of-conf
conf)
(lyskom-scroll)
(if (lyskom-j-or-n-p (lyskom-get-string 'want-become-member))
(if (lyskom-add-member-by-no (conf-stat->conf-no conf)
lyskom-pers-no)
(lyskom-do-go-to-conf conf
(lyskom-member-p (conf-stat->conf-no conf)))
(lyskom-insert-string 'nope))
(lyskom-insert-string 'no-ok)))))))
;; DEBUG+++
(let ((lyskom-inhibit-prefetch t))
(cond
(membership
(lyskom-do-go-to-conf conf membership))
((conf-type->letterbox (conf-stat->conf-type conf))
(lyskom-format-insert 'cant-go-to-his-mailbox
conf))
(t
(progn
(lyskom-format-insert 'not-member-of-conf
conf)
(lyskom-scroll)
(if (lyskom-j-or-n-p (lyskom-get-string 'want-become-member))
(if (lyskom-add-member-by-no (conf-stat->conf-no conf)
lyskom-pers-no)
(lyskom-do-go-to-conf conf
(lyskom-get-membership
(conf-stat->conf-no conf)))
(lyskom-insert-string 'nope))
(lyskom-insert-string 'no-ok))))))
;; DEBUG+++
(lyskom-continue-prefetch)
))
;; Dead function /davidk 960217
......@@ -1075,32 +1059,48 @@ Args: CONF-STAT MEMBERSHIP"
(lyskom-maybe-move-unread nil)
(if conf-stat
(lyskom-set-mode-line conf-stat))
(cond
((let ((r 0)
(len (read-list-length lyskom-to-do-list))
(found nil))
(while (and (not found)
(< r len))
(if (and (read-info->conf-stat (read-list->nth lyskom-to-do-list r))
(= (conf-stat->conf-no conf-stat)
(conf-stat->conf-no
(read-info->conf-stat
(read-list->nth lyskom-to-do-list r)))))
(setq found t)
(++ r)))
(if found
(let ((list (read-list->nth lyskom-to-do-list r)))
(read-list-enter-first list lyskom-reading-list)
(read-list-delete-read-info (conf-stat->conf-no conf-stat)
lyskom-to-do-list)
(read-list-enter-first list lyskom-to-do-list)))
found)
(set-read-info->priority (read-list->first lyskom-reading-list)
priority)
(lyskom-enter-conf conf-stat (read-list->first lyskom-reading-list)))
(t
(lyskom-go-to-empty-conf conf-stat)))))
(let ((r 0)
(len (read-list-length lyskom-to-do-list))
(found nil))
(while (and (not found)
(< r len))
(if (and (read-info->conf-stat (read-list->nth lyskom-to-do-list r))
(= (conf-stat->conf-no conf-stat)
(conf-stat->conf-no
(read-info->conf-stat
(read-list->nth lyskom-to-do-list r)))))
(setq found t)
(++ r)))
;; If the membership list is prefetched there is no need to
;; insert empty read-infos, but if there is a chance that
;; there might be unknown texts that will be entered into the
;; read-info later we'll insert an empty read-info. This
;; enables the user to go to a conference before it is
;; prefetched.
(cond (found
(let ((read-info (read-list->nth lyskom-to-do-list r)))
(read-list-enter-first read-info lyskom-reading-list)
(read-list-delete-read-info (conf-stat->conf-no conf-stat)
lyskom-to-do-list)
(read-list-enter-first read-info lyskom-to-do-list)
(set-read-info->priority read-info priority)
(lyskom-enter-conf conf-stat read-info)))
((not (lyskom-membership-is-read))
(let ((read-info (lyskom-create-read-info
'CONF conf-stat
(membership->priority membership)
(lyskom-create-text-list nil))))
(read-list-enter-first read-info lyskom-reading-list)
(read-list-delete-read-info (conf-stat->conf-no conf-stat)
lyskom-to-do-list)
(read-list-enter-first read-info lyskom-to-do-list)
(lyskom-go-to-empty-conf conf-stat)))
(t
(lyskom-go-to-empty-conf conf-stat))))))
......@@ -1191,7 +1191,7 @@ If you are not member in the conference it will be flagged with an asterisk."
(lyskom-format-insert "%[%#1@%4#2:m %#3c %#4M%]\n"
(lyskom-default-button 'conf conf-no)
conf-no
(if (lyskom-member-p conf-no)
(if (lyskom-get-membership conf-no)
32 ?*)
conf-no))
......
......@@ -602,15 +602,16 @@ send. If DONTSHOW is non-nil, don't display the sent message."
;;; (Skip or re-read articles).
;;; Author: Linus Tolke
;;; Rehacked: David K}gedal
(def-kom-command kom-set-unread (&optional arg conf-no)
"Set number of unread articles in current conference."
(interactive "P")
(setq conf-no (or conf-no lyskom-current-conf))
(if (and (zerop lyskom-current-conf) (null conf-no))
(lyskom-insert-string 'not-present-anywhere)
(let ((conf-stat (blocking-do 'get-conf-stat (or conf-no
lyskom-current-conf))))
(let ((conf-stat (blocking-do 'get-conf-stat conf-no)))
(if (null conf-stat) ;+++ annan errorhantering
(lyskom-insert "Error!\n") ;+++ Hrrrmmmmffff????
(let* ((narg (prefix-numeric-value arg))
......@@ -623,11 +624,17 @@ send. If DONTSHOW is non-nil, don't display the sent message."
(lyskom-format 'only-last
(conf-stat->no-of-texts conf-stat)
(conf-stat->name conf-stat)))))
(result (blocking-do 'set-unread
(conf-stat->conf-no conf-stat) n)))
(if (null result)
(lyskom-insert-string 'only-error)
(lyskom-refetch)))))))
(result (blocking-do 'set-unread conf-no n))
(membership (blocking-do 'query-read-texts
lyskom-pers-no
conf-no))
)
(lyskom-replace-membership membership lyskom-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)
(lyskom-prefetch-map conf-no membership)
)))))
......
......@@ -972,6 +972,7 @@ On since %#8s%#9s")
(unknown-doing-what . "Exists")
(doing-where-conn . "in")
(doing-nowhere-conn . "but is")
(waiting-for-membership . "Waiting for the membership list to be fetched...%d")
;; From slow.el
(no-such-command . "There is no such command.\n")
......
......@@ -191,7 +191,7 @@ assoc list."
alternative
(, lyskom-is-administrator))))
t nil)))
(cdr (assq name alternatives))))
(cdr (assoc name alternatives))))
;;; Resume operation after a crash.
......@@ -428,7 +428,8 @@ lyskom-mark-as-read."
misc (text-stat->misc-info-list text-stat)
(if (or (eq 'RECPT (misc-info->type misc))
(eq 'CC-RECPT (misc-info->type misc)))
(let ((membership (lyskom-member-p (misc-info->recipient-no misc))))
(let ((membership (lyskom-try-get-membership
(misc-info->recipient-no misc))))
(if membership
(set-membership->read-texts
membership
......@@ -631,9 +632,14 @@ CONF can be a a conf-stat or a string."
;;; +++Where should this be moved???
(defun lyskom-member-p (conf-no)
(defun lyskom-try-get-membership (conf-no)
"Returns non-nil if conference CONF-NO is present on lyskom-membership.
The value is actually the membership for the conference."
The value is actually the membership for the conference.
For foreground functions, lyskom-get-membership should probably be used
instead.
This function does not use blocking-do."
(let ((list lyskom-membership)
(found nil))
(while (and (not found) (not (null list)))
......@@ -643,6 +649,21 @@ The value is actually the membership for the conference."
found))
(defun lyskom-get-membership (conf-no)
"Get the membership for CONF-NO, or nil if the user is not a member of
CONF-NO.
If the membership list is not fully prefetched and the membership can't be
found inlyskom-membership, a blocking call to the server is made."
(or (lyskom-try-get-membership conf-no)
(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))
membership))))
;;;; ================================================================
;;;; Scrolling and text insertion.
......@@ -1835,6 +1856,16 @@ If optional argument NOCHANGE is non-nil then the list wont be altered."
;; +++PREFETCH
(defun lyskom-wait-for-membership ()
"If the full membership hase been read do nothing. Else give a message and
wait for it to be prefetched."
(while (not (eq lyskom-membership-is-read t))
(lyskom-message (lyskom-get-string 'waiting-for-membership)
lyskom-membership-is-read)
(lyskom-accept-process-output)))
(defun lyskom-prefetch-all-confs ()
"Gets all conferences using prefetch."
;; (while (numberp lyskom-membership-is-read)
......
......@@ -23,11 +23,6 @@
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se.
;;;;;
;;;; ================================================================
;;; +++ lyskom-reset-prefetch to be called on client reset.
;;; must restart everything.
;;; +++ THIS DOES NOT WORK CURRENTLY
(defun lyskom-reset-prefetch () nil)
;;;; ================================================================
;;;;
;;;; File: prefetch.el
;;;;
......@@ -139,6 +134,19 @@ This is used to prevent the prefetch code to reenter itself.")
(setq lyskom-membership-is-read 0))
;;;; ================================================================
;;; +++ lyskom-reset-prefetch to be called on client reset.
;;; must restart everything.
;;; +++ THIS DOES NOT WORK CURRENTLY
(defun lyskom-reset-prefetch ()
"Reset the prefetch system."
(lyskom-setup-prefetch))
(defsubst lyskom-membership-is-read ()
"Return t if the while membership list has been fetched, and nil otherwise."
(eq lyskom-membership-is-read 't))
(defun lyskom-prefetch-conf (conf-no &optional queue)
"Prefetch the conf-stat for the conference with number CONF-NO.
If QUEUE is non-nil, put the request on it, otherwise put it on
......@@ -221,7 +229,16 @@ lyskom-prefetch-stack."
(lyskom-continue-prefetch))
(defun lyskom-prefetch-map (conf-no first-local membership &optional queue)
(defun lyskom-prefetch-map (conf-no membership &optional queue)
"Prefetches a map for conf CONFNO."
(lyskom-prefetch-map-from conf-no
(1+ (membership->last-text-read membership))
membership
queue))
(defun lyskom-prefetch-map-from (conf-no first-local membership
&optional queue)
"Prefetches a map for conf CONFNO starting att FIRST-LOCAL."
(if queue
(lyskom-queue-enter queue (list 'CONFSTATFORMAP
......@@ -561,13 +578,11 @@ Put the requests on QUEUE."
(lyskom-stop-prefetch)
(let ((size (length memberships))
(i 0))
(lyskom-add-membership-to-membership memberships)
(lyskom-add-memberships-to-membership memberships)
(while (< i size)
(let ((membership (aref memberships i)))
(if (lyskom-visible-membership membership)
(lyskom-prefetch-map (membership->conf-no membership)
(1+ (membership->last-text-read
membership))
membership
queue)))
(++ i))
......@@ -599,13 +614,18 @@ Put the requests on QUEUE."
"Handle the return of the membership prefetch call.
Maps are `cached' in lyskom-to-do-list."
(lyskom-stop-prefetch)
(when map
(if (not (zerop (length (map->text-nos map))))
(lyskom-prefetch-map-using-conf-stat
conf-stat (+ first-local lyskom-fetch-map-nos)
membership
queue))
(lyskom-enter-map-in-to-do-list map conf-stat membership))
(let ((next-start (+ first-local lyskom-fetch-map-nos))
(last-local (1- (+ (conf-stat->no-of-texts conf-stat)
(conf-stat->first-local-no conf-stat)))))
(when map
;; An old version of this function tester if the map contained no
;; texts. That is not a correct termination condition.
(when (< next-start last-local)
(lyskom-prefetch-map-using-conf-stat conf-stat
next-start
membership
queue))
(lyskom-enter-map-in-to-do-list map conf-stat membership)))
(lyskom-queue-enter queue 'FINISHED)
(-- lyskom-pending-prefetch)
(lyskom-start-prefetch)
......
......@@ -565,18 +565,6 @@ the same as the entry above it, but to not move it."
;;;
(defun lyskom-get-membership-in-conf (conf-no)