Commit 4329c2e2 authored by David Byers's avatar David Byers
Browse files

Läst-möte-från-minibufferten-funktionerna använder nu conf-z-info internt.

Completion på mötesnamn expanderar mer korrekt och är snabbare.
Anropen lookup-z-name och get-version-info implementerade.
Kommunikationsdebugbufferten kan slippa asynkront meddelande nummer 5.
Bättre hantering av C-g.
Andra mindre fixar.
parent d82ae57c
Fri Jul 26 12:27:37 1996 David Byers <davby@sen2.ida.liu.se>
* startup.el (kom-start-anew): Hantera att
lyskom-lookup-conf-by-name returnerar conf-z-info.
* english-strings.el,swedish-strings.el (lyskom-strings): Lade
till unknown-doing-what.
* commands1.el (lyskom-status-session-2): Snyggare utskrift om
doing-what r tom strng.
* completing-read.el (lyskom-read-conf-internal-verify-type): Ny
semantik fr x-list parametern. Den skall vara en lista, inte en
conf-info-list.
(lyskom-completing-cache-completion): Ny funktion.
(lyskom-read-conf-no): Hantera conf-z-info istf conf-stat internt.
(lyskom-read-conf-stat): Dito.
(lyskom-read-conf-name): Dito.
(lyskom-read-conf-name): Dito, samt returnera conf-z-info.
(lyskom-lookup-conf-by-name): Returnera conf-z-info.
(lyskom-read-conf-internal): Anvnd conf-z-info istf conf-stat
internt. Cacha expansionen av strngar fr att undvika extra
uppslagningar.
(lyskom-completing-lookup-z-name): Erstter
lyskom-completing-lookup-name.
(lyskom-read-session-internal): Hantera conf-z-info frn
lyskom-read-conf-internal.
* lyskom-rest.el (lyskom-format-object): Lade in std fr
formattering av t och nil som boolean.
* komtypes.el (lyskom-create-version-info): Ny funktion
(version-info->protocol-version): Ny funktion.
(version-info->server-software): Ny funktion.
(version-info->software-version): Ny funktion.
* parse.el (lyskom-parse-version-info): Ny funktion.
* services.el (initiate-lookup-z-name): Ny funktion.
(initiate-get-version-info): Ny funktion.
* vars.el.in (lyskom-dont-debug-what-i-am-doing): Ny variabel.
* lyskom-rest.el (lyskom-filter): Option att inte logga
what-i-am-doing-meddelanden.
Thu Jul 25 11:35:36 1996 David Byers <davby@sen2.ida.liu.se> Thu Jul 25 11:35:36 1996 David Byers <davby@sen2.ida.liu.se>
* completing-read.el (lyskom-read-conf-internal): Skrare * completing-read.el (lyskom-read-conf-internal): Skrare
......
...@@ -1715,10 +1715,14 @@ WHO-INFOS that are potential sessions." ...@@ -1715,10 +1715,14 @@ WHO-INFOS that are potential sessions."
(if (not (eq (who-info->working-conf info) 0)) (if (not (eq (who-info->working-conf info) 0))
(who-info->working-conf info) (who-info->working-conf info)
(lyskom-get-string 'not-present-anywhere)) (lyskom-get-string 'not-present-anywhere))
(if (string-match "^\\(.*[^.]\\)\\.*$" (let ((string
(who-info->doing-what info)) (if (string-match "^\\(.*[^.]\\)\\.*$"
(match-string 1 (who-info->doing-what info)) (who-info->doing-what info))
(who-info->doing-what info)) (match-string 1 (who-info->doing-what info))
(who-info->doing-what info))))
(if (string= string "")
(lyskom-get-string 'unknown-doing-what)
string))
client client
(if (not (eq (who-info->working-conf info) 0)) (if (not (eq (who-info->working-conf info) 0))
(lyskom-get-string 'doing-where-conn) (lyskom-get-string 'doing-where-conn)
......
...@@ -65,16 +65,25 @@ ...@@ -65,16 +65,25 @@
(setq lyskom-completing-who-info-cache (setq lyskom-completing-who-info-cache
(listify-vector (blocking-do 'who-is-on))))) (listify-vector (blocking-do 'who-is-on)))))
(defun lyskom-completing-lookup-name (string) (defun lyskom-completing-cache-completion (string data)
"Look up STRING as a name. Same as \(blocking-do 'lookup-name ...\) (let* ((downs (downcase string))
(tmp (assoc downs lyskom-completing-lookup-name-cache)))
(if (null tmp)
(setq lyskom-completing-lookup-name-cache
(cons (cons downs data) lyskom-completing-lookup-name-cache)))
string))
(defun lyskom-completing-lookup-z-name (string want-conf want-pers)
"Look up STRING as a name. Same as \(blocking-do 'lookup-z-name ...\)
but first checks a cache." but first checks a cache."
(let ((tmp (assoc string lyskom-completing-lookup-name-cache))) (let* ((downs (downcase string))
(tmp (assoc downs lyskom-completing-lookup-name-cache)))
(if tmp (if tmp
(cdr tmp) (cdr tmp)
(progn (progn
(setq tmp (blocking-do 'lookup-name string)) (setq tmp (blocking-do 'lookup-z-name string want-conf want-pers))
(setq lyskom-completing-lookup-name-cache (setq lyskom-completing-lookup-name-cache
(cons (cons string tmp) (cons (cons downs tmp)
lyskom-completing-lookup-name-cache)) lyskom-completing-lookup-name-cache))
tmp)))) tmp))))
...@@ -105,30 +114,31 @@ but first checks a cache." ...@@ -105,30 +114,31 @@ but first checks a cache."
return its number or zero if nothing was matched. return its number or zero if nothing was matched.
See lyskom-read-conf for a description of the parameters." See lyskom-read-conf for a description of the parameters."
(let ((conf-stat (lyskom-read-conf prompt type empty initial mustmatch))) (let ((conf-z-info (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-stat) 0) (cond ((null conf-z-info) 0)
((stringp conf-stat) 0) ((stringp conf-z-info) 0)
(t (conf-stat->conf-no conf-stat))))) (t (conf-z-info->conf-no conf-z-info)))))
(defun lyskom-read-conf-stat (prompt type &optional empty initial mustmatch) (defun lyskom-read-conf-stat (prompt type &optional empty initial mustmatch)
"Read a conference name from the minibuffer with completion and "Read a conference name from the minibuffer with completion and
return its conf-stat or nil if nothing was matched. return its conf-stat or nil if nothing was matched.
See lyskom-read-conf for a description of the parameters." See lyskom-read-conf for a description of the parameters."
(let ((conf-stat (lyskom-read-conf prompt type empty initial mustmatch))) (let ((conf-z-info (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-stat) nil) (cond ((null conf-z-info) nil)
((stringp conf-stat) nil) ((stringp conf-z-info) nil)
(t conf-stat)))) (t (blocking-do 'get-conf-stat
(conf-z-info->conf-no conf-z-info))))))
(defun lyskom-read-conf-name (prompt type &optional empty initial mustmatch) (defun lyskom-read-conf-name (prompt type &optional empty initial mustmatch)
"Read a conference name from the minibuffer with completion and "Read a conference name from the minibuffer with completion and
return its name. return its name.
See lyskom-read-conf for a description of the parameters." See lyskom-read-conf for a description of the parameters."
(let ((conf-stat (lyskom-read-conf prompt type empty initial mustmatch))) (let ((conf-z-info (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-stat) "") (cond ((null conf-z-info) "")
((stringp conf-stat) conf-stat) ((stringp conf-z-info) conf-z-info)
(t (conf-stat->name conf-stat))))) (t (conf-z-info->name conf-z-info)))))
(defun lyskom-read-conf (prompt type &optional empty initial mustmatch) (defun lyskom-read-conf (prompt type &optional empty initial mustmatch)
"Completing read a conference or person from the minibuffer. "Completing read a conference or person from the minibuffer.
...@@ -147,7 +157,7 @@ INITIAL initial contents of the minibuffer ...@@ -147,7 +157,7 @@ INITIAL initial contents of the minibuffer
MUSTMATCH if non-nil, the user must enter a valid name. MUSTMATCH if non-nil, the user must enter a valid name.
The return value may be one of The return value may be one of
A conf-stat: The conf-stat associated with the name entered, A conf-z-info: The conf-z-info associated with the name entered,
nil: Nothing was entered, or nil: Nothing was entered, or
A string: A name that matched nothing in the database." A string: A name that matched nothing in the database."
...@@ -218,7 +228,7 @@ from person and conference number specifications." ...@@ -218,7 +228,7 @@ from person and conference number specifications."
cs))))) cs)))))
(defun lyskom-lookup-conf-by-name (string predicate) (defun lyskom-lookup-conf-by-name (string predicate)
"Return the conf-stat associated with STRING that also satisfies "Return the conf-z-info associated with STRING that also satisfies
PREDICATE or nil if no name matches. See lyskom-read-conf-internal for PREDICATE or nil if no name matches. See lyskom-read-conf-internal for
a documentation of PREDICATE." a documentation of PREDICATE."
(let ((lyskom-blocking-process (or lyskom-blocking-process (let ((lyskom-blocking-process (or lyskom-blocking-process
...@@ -259,11 +269,11 @@ function work as a name-to-conf-stat translator." ...@@ -259,11 +269,11 @@ function work as a name-to-conf-stat translator."
(let* ((login-list (and (memq 'login predicate) (let* ((login-list (and (memq 'login predicate)
(lyskom-read-conf-get-logins))) (lyskom-read-conf-get-logins)))
(x-list (lyskom-completing-lookup-name string)) (x-list (lyskom-completing-lookup-z-name string
(candidate-list (and x-list 1 1))
(listify-vector (conf-list->conf-nos x-list)))) (candidate-list
(candidate-type-list (and x-list
(and x-list (listify-vector (conf-list->conf-types x-list)))) (listify-vector (conf-z-info-list->conf-z-infos x-list))))
(lyskom-read-conf-internal-result-list nil) (lyskom-read-conf-internal-result-list nil)
(result-list nil)) (result-list nil))
...@@ -274,49 +284,31 @@ function work as a name-to-conf-stat translator." ...@@ -274,49 +284,31 @@ function work as a name-to-conf-stat translator."
;; candidate-list contains a list of conf-nos, with the ;; candidate-list contains a list of conf-nos, with the
;; corresponding conf-types in candidate-type-list. ;; corresponding conf-types in candidate-type-list.
;; ;;
;; Now set result-list to the conf-stats that fulfill the ;; Now set result-list to the conf-z-infos that fulfill the
;; predicate, fetching the conf-stats asynchronously. ;; predicate, fetching the conf-stats asynchronously.
;; ;;
(save-excursion (lyskom-traverse el candidate-list
(set-buffer (process-buffer lyskom-blocking-process)) (if (lyskom-read-conf-internal-verify-type (conf-z-info->conf-no el)
(while candidate-list (conf-z-info->conf-type el)
(if (lyskom-read-conf-internal-verify-type (car candidate-list) predicate
(car candidate-type-list) login-list
predicate candidate-list)
login-list (setq result-list (cons el result-list))))
x-list)
(initiate-get-conf-stat
'complete
(function (lambda (x)
(if (boundp 'lyskom-read-conf-internal-result-list)
(setq lyskom-read-conf-internal-result-list
(cons
x
lyskom-read-conf-internal-result-list)))))
(car candidate-list)))
(setq candidate-list (cdr candidate-list)
candidate-type-list (cdr candidate-type-list)))
;;
;; Wait for the conf-stats to arrive
;;
(lyskom-wait-queue 'complete))
(setq result-list lyskom-read-conf-internal-result-list)
;; ;;
;; Now the matching conf-stats are in result-list ;; Now the matching conf-z-infos are in result-list
;; ;;
(cond (cond
((eq all 'lyskom-lookup) ((eq all 'lyskom-lookup)
(let ((names (mapcar 'conf-stat->name (let ((names (mapcar 'conf-z-info->name
result-list)) result-list))
(specials (lyskom-read-conf-expand-specials string (specials (lyskom-read-conf-expand-specials string
predicate predicate
login-list login-list
x-list))) candidate-list)))
(cond ((= (length result-list) 1) (cond ((= (length result-list) 1)
(car result-list)) (car result-list))
...@@ -329,14 +321,14 @@ function work as a name-to-conf-stat translator." ...@@ -329,14 +321,14 @@ function work as a name-to-conf-stat translator."
(specials (lyskom-read-conf-lookup-specials string (specials (lyskom-read-conf-lookup-specials string
predicate predicate
login-list login-list
x-list)) candidate-list))
((string-match (lyskom-get-string 'person-or-conf-no-regexp) ((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil) string) nil)
((lyskom-read-conf-internal-verify-type nil ((lyskom-read-conf-internal-verify-type nil
nil nil
predicate predicate
login-list login-list
x-list) candidate-list)
string)))) string))))
;; ;;
...@@ -349,7 +341,7 @@ function work as a name-to-conf-stat translator." ...@@ -349,7 +341,7 @@ function work as a name-to-conf-stat translator."
(let ((specials (lyskom-read-conf-expand-specials string (let ((specials (lyskom-read-conf-expand-specials string
predicate predicate
login-list login-list
x-list))) candidate-list)))
(cond ((= (length result-list) 1) t) (cond ((= (length result-list) 1) t)
(result-list nil) (result-list nil)
((= (length specials) 1) t) ((= (length specials) 1) t)
...@@ -360,7 +352,7 @@ function work as a name-to-conf-stat translator." ...@@ -360,7 +352,7 @@ function work as a name-to-conf-stat translator."
nil nil
predicate predicate
login-list login-list
x-list))))) candidate-list)))))
;; ;;
...@@ -373,11 +365,11 @@ function work as a name-to-conf-stat translator." ...@@ -373,11 +365,11 @@ function work as a name-to-conf-stat translator."
;; ;;
(all (all
(let ((names (mapcar 'conf-stat->name result-list)) (let ((names (mapcar 'conf-z-info->name result-list))
(specials (lyskom-read-conf-expand-specials string (specials (lyskom-read-conf-expand-specials string
predicate predicate
login-list login-list
x-list))) candidate-list)))
(cond (specials (append specials names)) (cond (specials (append specials names))
(names names) (names names)
((string-match (lyskom-get-string 'person-or-conf-no-regexp) ((string-match (lyskom-get-string 'person-or-conf-no-regexp)
...@@ -386,7 +378,7 @@ function work as a name-to-conf-stat translator." ...@@ -386,7 +378,7 @@ function work as a name-to-conf-stat translator."
nil nil
predicate predicate
login-list login-list
x-list) candidate-list)
(list string)) (list string))
(t nil)))) (t nil))))
...@@ -401,7 +393,7 @@ function work as a name-to-conf-stat translator." ...@@ -401,7 +393,7 @@ function work as a name-to-conf-stat translator."
(let ((specials (lyskom-read-conf-expand-specials string (let ((specials (lyskom-read-conf-expand-specials string
predicate predicate
login-list login-list
x-list))) candidate-list)))
(cond (specials specials) (cond (specials specials)
((string-match (lyskom-get-string 'person-or-conf-no-regexp) ((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil) string) nil)
...@@ -409,7 +401,7 @@ function work as a name-to-conf-stat translator." ...@@ -409,7 +401,7 @@ function work as a name-to-conf-stat translator."
nil nil
predicate predicate
login-list login-list
x-list) candidate-list)
(list string)) (list string))
(t nil)))) (t nil))))
...@@ -421,11 +413,11 @@ function work as a name-to-conf-stat translator." ...@@ -421,11 +413,11 @@ function work as a name-to-conf-stat translator."
;; ;;
(t (t
(let ((name-list (mapcar 'conf-stat->name result-list)) (let ((name-list (mapcar 'conf-z-info->name result-list))
(specials (lyskom-read-conf-expand-specials string (specials (lyskom-read-conf-expand-specials string
predicate predicate
login-list login-list
x-list)) candidate-list))
(found nil)) (found nil))
(if specials (setq name-list (nconc specials name-list))) (if specials (setq name-list (nconc specials name-list)))
...@@ -433,12 +425,15 @@ function work as a name-to-conf-stat translator." ...@@ -433,12 +425,15 @@ function work as a name-to-conf-stat translator."
((= (length name-list) 1) (car name-list)) ((= (length name-list) 1) (car name-list))
((string-match (lyskom-get-string 'person-or-conf-no-regexp) ((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil) string) nil)
(t (or (lyskom-complete-string name-list) (t (or (lyskom-completing-cache-completion
(and (lyskom-read-conf-internal-verify-type nil (lyskom-complete-string name-list)
nil x-list)
predicate (and (lyskom-read-conf-internal-verify-type
login-list nil
x-list) nil
predicate
login-list
candidate-list)
(list string)))))))))))) (list string))))))))))))
...@@ -471,7 +466,7 @@ function work as a name-to-conf-stat translator." ...@@ -471,7 +466,7 @@ function work as a name-to-conf-stat translator."
(memq conf-no logins)) (memq conf-no logins))
(and (memq 'none predicate) (and (memq 'none predicate)
(and (null conf-no) (and (null conf-no)
(null (conf-list->conf-nos x-list)))))) (null x-list)))))
(defun lyskom-complete-string (string-list) (defun lyskom-complete-string (string-list)
...@@ -918,10 +913,7 @@ Returns the name." ...@@ -918,10 +913,7 @@ Returns the name."
(num (string-to-number string)) (num (string-to-number string))
(conf-no (conf-no
(if (= 0 num) ; Dont lookup unless necessary (if (= 0 num) ; Dont lookup unless necessary
(conf-stat->conf-no (conf-z-info->conf-no partial))))
(lyskom-read-conf-internal string
predicate
'lyskom-lookup)))))
(while list (while list
(if (or (eq conf-no (who-info->pers-no (cdr (car list)))) (if (or (eq conf-no (who-info->pers-no (cdr (car list))))
(eq num (who-info->connection (cdr (car list))))) (eq num (who-info->connection (cdr (car list)))))
......
...@@ -915,6 +915,7 @@ Text: ...@@ -915,6 +915,7 @@ Text:
%#5s %#7s %#4M %#5s %#7s %#4M
Using %#6D from %#3s\n") Using %#6D from %#3s\n")
(status-for-session . "Session status for whom? ") (status-for-session . "Session status for whom? ")
(unknown-doing-what . "Exists")
(doing-where-conn . "in") (doing-where-conn . "in")
(doing-nowhere-conn . "but is") (doing-nowhere-conn . "but is")
) )
......
...@@ -1552,6 +1552,33 @@ The MAPS must be consecutive. No gaps or overlaps are currently allowed." ...@@ -1552,6 +1552,33 @@ The MAPS must be consecutive. No gaps or overlaps are currently allowed."
(eq (car-safe object) 'TEXT-LIST)) (eq (car-safe object) 'TEXT-LIST))
;;; ================================================================
;;; version-info
;;; Constructor:
(defsubst lyskom-create-version-info (protocol-version
server-software
software-version)
"Create a version-info from all parameters."
(cons 'VERSION-INFO
(vector protocol-version server-software software-version)))
;;; Selectors:
(defsubst version-info->protocol-version (version-info)
"Get protocol version from version-info."
(elt (cdr version-info) 0))
(defsubst version-info->server-software (version-info)
"Get server software name from version-info."
(elt (cdr version-info) 1))
(defsubst version-info->software-version (version-info)
"Get server software version from version-info."
(elt (cdr version-info) 2))
;;; ================================================================ ;;; ================================================================
;;; server-info ;;; server-info
......
No preview for this file type
...@@ -515,6 +515,13 @@ than 0. Args: ITEMS-TO-PARSE PRE-FETCHED. Returns -1 if ITEMS-TO-PARSE is ...@@ -515,6 +515,13 @@ than 0. Args: ITEMS-TO-PARSE PRE-FETCHED. Returns -1 if ITEMS-TO-PARSE is
(lyskom-parse-num) 'lyskom-parse-num))) (lyskom-parse-num) 'lyskom-parse-num)))
(defun lyskom-parse-version-info ()
"Parse info about the server and protocol."
(lyskom-create-version-info
(lyskom-parse-num)
(lyskom-parse-string)
(lyskom-parse-string)))
(defun lyskom-parse-server-info () (defun lyskom-parse-server-info ()
"Parse info about the server." "Parse info about the server."
(lyskom-create-server-info (lyskom-create-server-info
......
...@@ -697,6 +697,23 @@ Args: KOM-QUEUE HANDLER REGEXP WANT-PERSONS WANT-CONFS &rest DATA." ...@@ -697,6 +697,23 @@ Args: KOM-QUEUE HANDLER REGEXP WANT-PERSONS WANT-CONFS &rest DATA."
(lyskom-send-packet kom-queue (lyskom-format-objects 74 regexp want-persons (lyskom-send-packet kom-queue (lyskom-format-objects 74 regexp want-persons
want-confs))) want-confs)))
(defun initiate-get-version-info (kom-queue handler &rest data)
"Perform a get-version-info vall.
Args: KOM-QUEUE HANDLER &rest DATA"
(lyskom-call kom-queue lyskom-ref-no handler data 'lyskom-parse-version-info)
(lyskom-send-packet kom-queue (lyskom-format-objects 75)))
(defun initiate-lookup-z-name (kom-queue handler name want-persons want-confs
&rest data)
"Perform a z-lookup.
Args: KOM-QUEUE HANDLER NAME WANT-PERSONS WANT-CONFS &rest DATA"
(lyskom-call kom-queue lyskom-ref-no handler data
'lyskom-parse-conf-z-info-list)
(lyskom-send-packet kom-queue (lyskom-format-objects 76 name
want-persons
want-confs)))
(defun initiate-set-last-read (kom-queue handler conf-no text-no &rest data) (defun initiate-set-last-read (kom-queue handler conf-no text-no &rest data)
"Tell the server to set the highest unread article in conference CONF-NO "Tell the server to set the highest unread article in conference CONF-NO
to TEXT-NO to TEXT-NO
......
...@@ -228,7 +228,7 @@ variable documentation for lyskom-server-feautres" ...@@ -228,7 +228,7 @@ variable documentation for lyskom-server-feautres"
lyskom-default-user-name) lyskom-default-user-name)
;; This is nil if we can't find a unique match. ;; This is nil if we can't find a unique match.
(setq lyskom-pers-no (setq lyskom-pers-no
(conf-stat->conf-no (conf-z-info->conf-no
(lyskom-lookup-conf-by-name lyskom-default-user-name (lyskom-lookup-conf-by-name lyskom-default-user-name
'(pers))))) '(pers)))))
(if lyskom-pers-no (if lyskom-pers-no
...@@ -237,7 +237,7 @@ variable documentation for lyskom-server-feautres" ...@@ -237,7 +237,7 @@ variable documentation for lyskom-server-feautres"
(lyskom-get-string 'what-is-your-name) (lyskom-get-string 'what-is-your-name)
'(pers none) t "" t))) '(pers none) t "" t)))
(setq lyskom-pers-no (setq lyskom-pers-no
(or (conf-stat->conf-no (or (conf-z-info->conf-no
(lyskom-lookup-conf-by-name name '(pers))) (lyskom-lookup-conf-by-name name '(pers)))
(lyskom-create-new-person name))))) (lyskom-create-new-person name)))))
;; Now lyskom-pers-no contains a number of a person. ;; Now lyskom-pers-no contains a number of a person.
......
...@@ -952,6 +952,7 @@ Text: ...@@ -952,6 +952,7 @@ Text:
%#5s %#7s %#4M %#5s %#7s %#4M
K\366r %#6D fr\345n %#3s\n") K\366r %#6D fr\345n %#3s\n")
(status-for-session . "Sessionsstatus f\366r vilken person? ") (status-for-session . "Sessionsstatus f\366r vilken person? ")
(unknown-doing-what . "Existerar")
(doing-where-conn . "i") (doing-where-conn . "i")
(doing-nowhere-conn . "men r") (doing-nowhere-conn . "men r")