diff --git a/src/ChangeLog b/src/ChangeLog index a26594d47d9cb9394a38549f2fffac2358103fb8..89a796400a7e0bd68e310ff1d7d6ff7d52712347 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,24 @@ 2003-08-13 David Byers <byers@lysator.liu.se> + Work on bug 1075: + * parse.el (lyskom-parse-static-server-info): New function. + + * services.el (initiate-get-boottime-info): New function. + + * vars.el.in (lyskom-static-server-info): New variable. + + * komtypes.el (static-server-info): New type. + + Fix bug 1078: + * vars.el.in (lyskom-global-variable-types): Change read of + integer. + (kom-default-mark): Put this both in the common area and the elisp + area. This is a good thing when we set it to values that are not + legal according to the protocol specification. + + * flags.el (lyskom-flag-read-integer): When reading integers, + accept nil too. + Delete initial value on change: * completing-read.el (lyskom-read-from-minibuffer-clear-initial): New function. diff --git a/src/flags.el b/src/flags.el index ba45c3320b2daf73cf98226899af71a449e697b7..a23dae754e78c5f1439462fdf5743b377ed84c31 100644 --- a/src/flags.el +++ b/src/flags.el @@ -39,6 +39,8 @@ (eval-when-compile (require 'lyskom-command "command")) +(put 'lyskom-invalid-flag-type 'error-conditions + '(error lyskom-error lyskom-invalid-flag-type)) (defvar lyskom-options-text nil "Text mass when reading options.") @@ -118,16 +120,18 @@ settings and save them to your emacs init file." (common-block (concat (mapconcat (lambda (var) - (let ((common-name (elt var 0)) - (elisp-name (elt var 1)) - (type (elt var 2))) - (lyskom-format-objects - (symbol-name common-name) - (funcall - (cdr (assq 'write - (cdr (assq (or type t) - lyskom-global-variable-types)))) - (symbol-value elisp-name))))) + (condition-case nil + (let ((common-name (elt var 0)) + (elisp-name (elt var 1)) + (type (elt var 2))) + (lyskom-format-objects + (symbol-name common-name) + (funcall + (cdr (assq 'write + (cdr (assq (or type t) + lyskom-global-variable-types)))) + (symbol-value elisp-name)))) + (lyskom-invalid-flag-type ""))) lyskom-global-variables "\n") )) @@ -469,3 +473,11 @@ elisp variable VAR." (defun lyskom-flag-read-from-string (str) (car (read-from-string str))) + +(defun lyskom-flag-read-integer (str) + (cond ((equal str "nil") nil) + (t (string-to-int str)))) + +(defun lyskom-flag-write-integer (val) + (cond ((integerp val) (prin1-to-string val)) + (t (signal 'lyskom-invalid-flag-type nil)))) diff --git a/src/komtypes.el b/src/komtypes.el index 06a8b8770cbe77b8bbbf4a8f55e90a268a37f0e6..0b2b85453b24a80e7024cda964ee6188cf17eef2 100644 --- a/src/komtypes.el +++ b/src/komtypes.el @@ -841,6 +841,17 @@ Do nothing if the TLIST is less than N elements long." (values :default nil)) :nil-safe) +(def-komtype static-server-info + ((boot-time :read-only t) + (save-time :read-only t) + (db-status :read-only t) + (existing-texts :read-only t) + (highest-text-no :read-only t) + (existing-confs :read-only t) + (existing-persons :read-only t) + (highest-conf-no :read-only t)) + :nil-safe) + ;;; ================================================================ diff --git a/src/parse.el b/src/parse.el index f40a3bcc4546e3a72d4148366a1e9d6158035bb9..3e35a54f97235340ee0f10077cfd3189957dd0bd 100644 --- a/src/parse.el +++ b/src/parse.el @@ -1107,6 +1107,17 @@ Args: TEXT-NO. Value: text-stat." "Parse an array of Stats" (lyskom-parse-vector (lyskom-parse-num) 'lyskom-parse-stats)) +(defun lyskom-parse-static-server-info () + "Parse a static-server-info" + (lyskom-create-static-server-info (lyskom-parse-time) + (lyskom-parse-time) + (lyskom-parse-string) + (lyskom-parse-num) + (lyskom-parse-num) + (lyskom-parse-num) + (lyskom-parse-num) + (lyskom-parse-num))) + ;;; ================================================================ ;;; Parsing of complex datatypes without cache. diff --git a/src/services.el b/src/services.el index edbabf81d55f5564b4d54dd6d66011dd915934a4..471bd1efaa4c97a72d0547873f76c24ebaa8bb91 100644 --- a/src/services.el +++ b/src/services.el @@ -1313,6 +1313,11 @@ Args: KOM-QUEUE HANDLER SESSION-NO &rest DATA" (lyskom-call kom-queue lyskom-ref-no handler data 'lyskom-parse-stats-array) (lyskom-send-packet kom-queue (lyskom-format-objects 112 what)))) +(defun initiate-get-boottime-info (kom-queue handler &rest data) + (lyskom-server-call + (lyskom-call kom-queue lyskom-ref-no handler data 'lyskom-parse-static-server-info) + (lyskom-send-packet kom-queue (lyskom-format-objects 113)))) + ;;; ================================================================ diff --git a/src/startup.el b/src/startup.el index c285aaeb1232b4cc956192355261cc4a05993fac..f3d1297002c29b1954f0e754de626b32f3b2dc97 100644 --- a/src/startup.el +++ b/src/startup.el @@ -356,10 +356,11 @@ 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 19)) + (blocking-do 'accept-async '(5 7 8 9 11 12 13 14 15 16 17 18 19 20 21)) (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 19))))) + ;; async-new-text is not implemented, so use async-new-text-old + (blocking-do 'accept-async '(0 5 7 8 9 11 12 13 14 16 17 18 19 20 21))))) (defun lyskom-www-proxy-connect-filter (proc output) diff --git a/src/vars.el.in b/src/vars.el.in index a510de71d0cc2cb3f8a79963b79d929551a0fcef..dd1a40b61aabea5dca951c7681501445164e9fc7 100644 --- a/src/vars.el.in +++ b/src/vars.el.in @@ -52,8 +52,8 @@ (defconst lyskom-global-variable-types '((boolean (read . lyskom-flag-read-boolean) (write . lyskom-flag-write-boolean)) - (integer (read . string-to-int) - (write . prin1-to-string)) + (integer (read . lyskom-flag-read-integer) + (write . lyskom-flag-write-integer)) (symbol-list (read . lyskom-flag-read-symbol-list) (write . lyskom-flag-write-symbol-list)) (t (read . lyskom-flag-read-from-string) @@ -673,7 +673,8 @@ simply mark with that number. When set to `nil', `kom-mark-text' will ask for a mark. Values other than integers and `nil' are reserved for future use." - common default-mark integer) + common default-mark integer + server) (def-kom-var kom-symbolic-marks-alist '(("Standard" . 100)) "**Association list that maps symbolic marks to mark numbers. @@ -3272,6 +3273,10 @@ will be shown." "Cache of conference statuses." local) +(def-kom-var lyskom-static-server-info nil + "Cache of static-server-info" + local) + (def-kom-var lyskom-uconf-cache nil "Cache of small conference statuses." local)