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>
* completing-read.el (lyskom-read-conf-internal): Skrare
......
......@@ -1715,10 +1715,14 @@ WHO-INFOS that are potential sessions."
(if (not (eq (who-info->working-conf info) 0))
(who-info->working-conf info)
(lyskom-get-string 'not-present-anywhere))
(if (string-match "^\\(.*[^.]\\)\\.*$"
(who-info->doing-what info))
(match-string 1 (who-info->doing-what info))
(who-info->doing-what info))
(let ((string
(if (string-match "^\\(.*[^.]\\)\\.*$"
(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
(if (not (eq (who-info->working-conf info) 0))
(lyskom-get-string 'doing-where-conn)
......
......@@ -65,16 +65,25 @@
(setq lyskom-completing-who-info-cache
(listify-vector (blocking-do 'who-is-on)))))
(defun lyskom-completing-lookup-name (string)
"Look up STRING as a name. Same as \(blocking-do 'lookup-name ...\)
(defun lyskom-completing-cache-completion (string data)
(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."
(let ((tmp (assoc string lyskom-completing-lookup-name-cache)))
(let* ((downs (downcase string))
(tmp (assoc downs lyskom-completing-lookup-name-cache)))
(if tmp
(cdr tmp)
(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
(cons (cons string tmp)
(cons (cons downs tmp)
lyskom-completing-lookup-name-cache))
tmp))))
......@@ -105,30 +114,31 @@ but first checks a cache."
return its number or zero if nothing was matched.
See lyskom-read-conf for a description of the parameters."
(let ((conf-stat (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-stat) 0)
((stringp conf-stat) 0)
(t (conf-stat->conf-no conf-stat)))))
(let ((conf-z-info (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-z-info) 0)
((stringp conf-z-info) 0)
(t (conf-z-info->conf-no conf-z-info)))))
(defun lyskom-read-conf-stat (prompt type &optional empty initial mustmatch)
"Read a conference name from the minibuffer with completion and
return its conf-stat or nil if nothing was matched.
See lyskom-read-conf for a description of the parameters."
(let ((conf-stat (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-stat) nil)
((stringp conf-stat) nil)
(t conf-stat))))
(let ((conf-z-info (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-z-info) nil)
((stringp conf-z-info) nil)
(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)
"Read a conference name from the minibuffer with completion and
return its name.
See lyskom-read-conf for a description of the parameters."
(let ((conf-stat (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-stat) "")
((stringp conf-stat) conf-stat)
(t (conf-stat->name conf-stat)))))
(let ((conf-z-info (lyskom-read-conf prompt type empty initial mustmatch)))
(cond ((null conf-z-info) "")
((stringp conf-z-info) conf-z-info)
(t (conf-z-info->name conf-z-info)))))
(defun lyskom-read-conf (prompt type &optional empty initial mustmatch)
"Completing read a conference or person from the minibuffer.
......@@ -147,7 +157,7 @@ INITIAL initial contents of the minibuffer
MUSTMATCH if non-nil, the user must enter a valid name.
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
A string: A name that matched nothing in the database."
......@@ -218,7 +228,7 @@ from person and conference number specifications."
cs)))))
(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
a documentation of PREDICATE."
(let ((lyskom-blocking-process (or lyskom-blocking-process
......@@ -259,11 +269,11 @@ function work as a name-to-conf-stat translator."
(let* ((login-list (and (memq 'login predicate)
(lyskom-read-conf-get-logins)))
(x-list (lyskom-completing-lookup-name string))
(candidate-list (and x-list
(listify-vector (conf-list->conf-nos x-list))))
(candidate-type-list
(and x-list (listify-vector (conf-list->conf-types x-list))))
(x-list (lyskom-completing-lookup-z-name string
1 1))
(candidate-list
(and x-list
(listify-vector (conf-z-info-list->conf-z-infos x-list))))
(lyskom-read-conf-internal-result-list nil)
(result-list nil))
......@@ -274,49 +284,31 @@ function work as a name-to-conf-stat translator."
;; candidate-list contains a list of conf-nos, with the
;; 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.
;;
(save-excursion
(set-buffer (process-buffer lyskom-blocking-process))
(while candidate-list
(if (lyskom-read-conf-internal-verify-type (car candidate-list)
(car candidate-type-list)
predicate
login-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)))
(lyskom-traverse el candidate-list
(if (lyskom-read-conf-internal-verify-type (conf-z-info->conf-no el)
(conf-z-info->conf-type el)
predicate
login-list
candidate-list)
(setq result-list (cons el result-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
((eq all 'lyskom-lookup)
(let ((names (mapcar 'conf-stat->name
(let ((names (mapcar 'conf-z-info->name
result-list))
(specials (lyskom-read-conf-expand-specials string
predicate
login-list
x-list)))
candidate-list)))
(cond ((= (length result-list) 1)
(car result-list))
......@@ -329,14 +321,14 @@ function work as a name-to-conf-stat translator."
(specials (lyskom-read-conf-lookup-specials string
predicate
login-list
x-list))
candidate-list))
((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil)
((lyskom-read-conf-internal-verify-type nil
nil
predicate
login-list
x-list)
candidate-list)
string))))
;;
......@@ -349,7 +341,7 @@ function work as a name-to-conf-stat translator."
(let ((specials (lyskom-read-conf-expand-specials string
predicate
login-list
x-list)))
candidate-list)))
(cond ((= (length result-list) 1) t)
(result-list nil)
((= (length specials) 1) t)
......@@ -360,7 +352,7 @@ function work as a name-to-conf-stat translator."
nil
predicate
login-list
x-list)))))
candidate-list)))))
;;
......@@ -373,11 +365,11 @@ function work as a name-to-conf-stat translator."
;;
(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
predicate
login-list
x-list)))
candidate-list)))
(cond (specials (append specials names))
(names names)
((string-match (lyskom-get-string 'person-or-conf-no-regexp)
......@@ -386,7 +378,7 @@ function work as a name-to-conf-stat translator."
nil
predicate
login-list
x-list)
candidate-list)
(list string))
(t nil))))
......@@ -401,7 +393,7 @@ function work as a name-to-conf-stat translator."
(let ((specials (lyskom-read-conf-expand-specials string
predicate
login-list
x-list)))
candidate-list)))
(cond (specials specials)
((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil)
......@@ -409,7 +401,7 @@ function work as a name-to-conf-stat translator."
nil
predicate
login-list
x-list)
candidate-list)
(list string))
(t nil))))
......@@ -421,11 +413,11 @@ function work as a name-to-conf-stat translator."
;;
(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
predicate
login-list
x-list))
candidate-list))
(found nil))
(if specials (setq name-list (nconc specials name-list)))
......@@ -433,12 +425,15 @@ function work as a name-to-conf-stat translator."
((= (length name-list) 1) (car name-list))
((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil)
(t (or (lyskom-complete-string name-list)
(and (lyskom-read-conf-internal-verify-type nil
nil
predicate
login-list
x-list)
(t (or (lyskom-completing-cache-completion
(lyskom-complete-string name-list)
x-list)
(and (lyskom-read-conf-internal-verify-type
nil
nil
predicate
login-list
candidate-list)
(list string))))))))))))
......@@ -471,7 +466,7 @@ function work as a name-to-conf-stat translator."
(memq conf-no logins))
(and (memq 'none predicate)
(and (null conf-no)
(null (conf-list->conf-nos x-list))))))
(null x-list)))))
(defun lyskom-complete-string (string-list)
......@@ -918,10 +913,7 @@ Returns the name."
(num (string-to-number string))
(conf-no
(if (= 0 num) ; Dont lookup unless necessary
(conf-stat->conf-no
(lyskom-read-conf-internal string
predicate
'lyskom-lookup)))))
(conf-z-info->conf-no partial))))
(while list
(if (or (eq conf-no (who-info->pers-no (cdr (car list))))
(eq num (who-info->connection (cdr (car list)))))
......
......@@ -915,6 +915,7 @@ Text:
%#5s %#7s %#4M
Using %#6D from %#3s\n")
(status-for-session . "Session status for whom? ")
(unknown-doing-what . "Exists")
(doing-where-conn . "in")
(doing-nowhere-conn . "but is")
)
......
......@@ -1552,6 +1552,33 @@ The MAPS must be consecutive. No gaps or overlaps are currently allowed."
(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
......
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
(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 ()
"Parse info about the server."
(lyskom-create-server-info
......
......@@ -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
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)
"Tell the server to set the highest unread article in conference CONF-NO
to TEXT-NO
......
......@@ -228,7 +228,7 @@ variable documentation for lyskom-server-feautres"
lyskom-default-user-name)
;; This is nil if we can't find a unique match.
(setq lyskom-pers-no
(conf-stat->conf-no
(conf-z-info->conf-no
(lyskom-lookup-conf-by-name lyskom-default-user-name
'(pers)))))
(if lyskom-pers-no
......@@ -237,7 +237,7 @@ variable documentation for lyskom-server-feautres"
(lyskom-get-string 'what-is-your-name)
'(pers none) t "" t)))
(setq lyskom-pers-no
(or (conf-stat->conf-no
(or (conf-z-info->conf-no
(lyskom-lookup-conf-by-name name '(pers)))
(lyskom-create-new-person name)))))
;; Now lyskom-pers-no contains a number of a person.
......
......@@ -952,6 +952,7 @@ Text:
%#5s %#7s %#4M
K\366r %#6D fr\345n %#3s\n")
(status-for-session . "Sessionsstatus f\366r vilken person? ")
(unknown-doing-what . "Existerar")
(doing-where-conn . "i")
(doing-nowhere-conn . "men r")
)
......
......@@ -1093,6 +1093,9 @@ This variable is not saved in the LysKOM server.")
"Non-nil means all communications with the server is stored in a buffer.
The name is stored in lyskom-debug-communications-to-buffer-buffer.")
(defvar lyskom-debug-what-i-am-doing t
"Non-nil means asynchronous message 5 will be logged to the debug buffer. ")
(defvar lyskom-debug-communications-to-buffer-buffer "*kom*-debugs"
"Name of the buffer to insert the communications with the server into if
lyskom-debug-communications-to-buffer is non-nil.")
......
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