Commit 7e7857db authored by David Byers's avatar David Byers
Browse files

Handle async-new-user-area message. Fixed parsing of text-mapping.

Detailed changes:
> 	Handle async-new-user-area message:
> 	* startup.el (lyskom-accept-async): Accept async 19.
>
> 	* async.el (lyskom-parse-async): Parse async type 19. Update
> 	pers-stat based on results.
> 	(lyskom-async-new-user-area): New function updates cache and
> 	re-reads options if necessary.
> 	(lyskom-parse-async): Call it.
>
> 	* flags.el (lyskom-read-options-eval): Set
> 	lyskom-current-user-area.
>
> 	* vars.el.in (lyskom-current-user-area): New variable.
>
> 	* flags.el (lyskom-save-options-3): Don't delete the person from
> 	the cache; just set the user-area. Set lyskom-current-user-area.
>
> 	* komtypes.el (pers-stat): user-area is no longre read-only.
>
> 	Fix parse of text-mapping (I thought I did this a year ago):
> 	* parse.el (lyskom-parse-list): Read the terminating brace in the
> 	list.
> 	(lyskom-parse-local-to-global-block): The array length is a
> 	number, not a string.
>
parent dbddd998
2003-01-06 David Byers <david.byers@swipnet.se>
Handle async-new-user-area message:
* startup.el (lyskom-accept-async): Accept async 19.
* async.el (lyskom-parse-async): Parse async type 19. Update
pers-stat based on results.
(lyskom-async-new-user-area): New function updates cache and
re-reads options if necessary.
(lyskom-parse-async): Call it.
* flags.el (lyskom-read-options-eval): Set
lyskom-current-user-area.
* vars.el.in (lyskom-current-user-area): New variable.
* flags.el (lyskom-save-options-3): Don't delete the person from
the cache; just set the user-area. Set lyskom-current-user-area.
* komtypes.el (pers-stat): user-area is no longre read-only.
Fix parse of text-mapping (I thought I did this a year ago):
* parse.el (lyskom-parse-list): Read the terminating brace in the
list.
(lyskom-parse-local-to-global-block): The array length is a
number, not a string.
Clean up :variable assignments:
* compatibility.el (lyskom-make-self-evaluating): New macro. Use
it to make several :symbols self-evalutaing in Emacs 19.
......
......@@ -269,9 +269,33 @@ this function shall be with current-buffer the BUFFER."
(lyskom-use 'follow 'lyskom-async-new-membership pers-no conf-no))
))))
((eq msg-no 19) ; async-new-user-area
(let* ((pers-no (lyskom-parse-num))
(old-user-area (lyskom-parse-num))
(new-user-area (lyskom-parse-num)))
(lyskom-save-excursion
(set-buffer buffer)
(when (eq pers-no lyskom-pers-no)
(initiate-get-pers-stat 'follow
'lyskom-async-new-user-area
pers-no
old-user-area
new-user-area)))))
(t
(lyskom-skip-tokens tokens)))))
(defun lyskom-async-new-user-area (pers-stat old-user-area new-user-area)
(when pers-stat
(let ((need-reread (and (eq lyskom-pers-no (pers-stat->pers-no pers-stat))
(not (eq lyskom-current-user-area new-user-area)))))
;; Update the cache
(set-pers-stat->user-area pers-stat new-user-area)
;; Re-read
(when (and need-reread
new-user-area
(not (zerop new-user-area)))
(initiate-get-text 'follow 'lyskom-read-options-eval new-user-area)))))
(defun lyskom-async-forced-leave-conf (conf-stat conf-no)
(if conf-stat
......
......@@ -90,6 +90,8 @@
'lyskom-update-membership-when-changed))))
;; This code uses get-map, but I don't think it's worth spending
;; time on fixing it. Go fix kom-handle-membership instead.
(defun lyskom-memb-received-1 (conf-stat membership buffer)
"Part of kom-membership.
......
......@@ -188,23 +188,25 @@
(if text-no
(initiate-set-user-area 'options 'lyskom-save-options-3
lyskom-pers-no text-no kombuf
done-message error-message)
done-message error-message text-no)
(save-excursion
(set-buffer kombuf)
(lyskom-insert-string 'could-not-save-options)
(lyskom-message "%s" (lyskom-get-string 'could-not-save-options)))))
(defun lyskom-save-options-3 (success kombuf done-message error-message)
(defun lyskom-save-options-3 (success kombuf done-message
error-message text-no)
(save-excursion
(set-buffer kombuf)
(if success
(progn
(cache-del-pers-stat lyskom-pers-no)
(let ((pers-stat (cache-get-pers-stat lyskom-pers-no)))
(when pers-stat
(set-pers-stat->user-area pers-stat text-no))
(setq lyskom-current-user-area text-no)
(lyskom-message "%s" done-message))
(lyskom-format-insert 'could-not-set-user-area lyskom-errno)
(lyskom-message "%s" error-message))))
(defun lyskom-read-options (&optional buffer)
"Reads the user-area and sets the variables according to the choises.
Returns a list of variables that were ignored. If optional BUFFER is
......@@ -215,7 +217,7 @@ non-nil, read settings in that buffer."
(save-excursion
(when buffer (set-buffer buffer))
(blocking-do 'get-pers-stat lyskom-pers-no))))
(if (not pers-stat) ;+++ Other error handler.
(if (not pers-stat) ;+++ Other error handler.
(progn (lyskom-insert-string 'you-dont-exist)
nil)
(setq lyskom-other-clients-user-areas nil)
......@@ -326,6 +328,7 @@ Returns a list of variables that were ignored."
(setcdr pos nil))))))
(error (lyskom-message "%s" (lyskom-get-string 'error-in-options-short))))
(setq lyskom-options-done t)
(setq lyskom-current-user-area (if text (text->text-no text) 0))
ignored-user-area-vars))
......
......@@ -239,7 +239,7 @@ Automatically created with def-komtype" type)
(privileges :read-only t)
(flags :read-only t)
(last-login :read-only t)
(user-area :read-only t)
user-area
(total-time-present :read-only t)
(sessions :read-only t)
(created-lines :read-only t)
......
......@@ -379,7 +379,9 @@ Each element is parsed by PARSER, a function that takes no arguments."
(while (> len 0)
(setq result (cons (funcall parser) result))
(setq len (1- len)))
(nreverse result)))))
(prog1
(nreverse result)
(lyskom-expect-char ?}))))))
(defun lyskom-fill-vector (vector parser)
......@@ -1021,7 +1023,7 @@ Args: TEXT-NO. Value: text-stat."
(defun lyskom-parse-local-to-global-block (block-type)
"Parse a Local-To-Global-Block"
(cond ((eq block-type 'sparse)
(let ((len (lyskom-parse-string)))
(let ((len (lyskom-parse-num)))
(lyskom-parse-list len 'lyskom-parse-text-number-pair)))
((eq block-type 'dense)
(lyskom-parse-map))))
......
......@@ -356,10 +356,10 @@ clients of the event. See lyskom-mode for details on lyskom."
(defun lyskom-accept-async ()
(blocking-do 'accept-async '(5 7 8 9 11 12 13 14 15 16 17 18))
(blocking-do 'accept-async '(5 7 8 9 11 12 13 14 15 16 17 18 19))
(let* ((ans (blocking-do 'query-async)))
(unless (memq 15 (listify-vector ans))
(blocking-do 'accept-async '(0 5 7 8 9 11 12 13 14 16 17 18)))))
(blocking-do 'accept-async '(0 5 7 8 9 11 12 13 14 16 17 18 19)))))
(defun lyskom-www-proxy-connect-filter (proc output)
......
......@@ -1955,6 +1955,10 @@ version, minor version and revision."
"The default coding system used by the server for all strings."
inherited)
(def-kom-var lyskom-current-user-area 0
"Text-no of the user area last saved or read for lyskom-pers-no."
local)
(def-kom-var lyskom-max-packet-size lyskom-max-int
"The largest possible packet size that can be transmitted to a
TCP/IP connection. This should be unlimited, but in practise there
......
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