Commit 266c47e1 authored by David Byers's avatar David Byers
Browse files

Bugfixar i completing-read.el, modifieringar av anrop till completing-read,...

Bugfixar i completing-read.el, modifieringar av anrop till completing-read, bugfixar i parse.el, services.el, mottagarkontroll i edit-text.el
parent 438be69d
This diff is collapsed.
......@@ -3,10 +3,7 @@ Att g
Buggar
Completion bryr sig inte om MUSTMATCH-parametern.
Om KOMNAME är satt till "" så kommer completionkoden att försöka
komplettera det till alla personer. Det vill man *inte*.
Ändra variabler klarar inte att hantera buffertlokala variabler.
Completion-koden är ivägen när man vill skapa nya personer. [Nåja,
inte så mycket. Det är bara att man inte får skapa namn som är
......@@ -25,17 +22,6 @@ Buggar
läsa 1443602 (en fotnot till 1443554. Det är inte första gången
det händer.
Man kan inte skicka in inlägg med kom-emacs-knows-iso-8859-1 satt
till nil. (FIXAT)
LysKOMs completing-read är skit. Den gör fel. Den borde skrivas om.
(FIXAT)
lyskom-try-complete-partials borde returnera exakta matchar före
längsta match. Nu blir (lyskom-try-complete-partials "link"
'(("(foo) link (bar)" . 1) ("linkfoobar" . 2))) "linkfoobar", inte
"(foo) link (bar)". (FUNKTIONEN ERSATT; FIXAT)
Om ett namn som fylls i i efterhand gör att raden blir för lång,
så scrollar klienten ibland trots att den inte borde.
......@@ -50,19 +36,12 @@ Buggar
Fotnoter som visas på en gång filtreras inte.
M-> i prioritera-bufferten. Text 1320736. (FIXAT)
Det har hänt att call-info har blivit nil i lyskom-parse-error.
lyskom-add-membership gör membership-listan sorterad, vilket inte
prefetch-koden är gjord för. Alltså borde det kunna bli problem
att gå med i möten om man ger dem fel prioritet.
Om man försöker logga in med en förkortning som matchar flera namn
tror klienten att man inte finns. (FIXAT?)
Lista meddelanden via fjärrkontroll listar baklänges. (FIXAT)
När jag ska läsa en kommentar till ett brev i min brevlåda så blir
prompten "Läsa nästa brev" i stället för "Läsa nästa
kommentar". Kommentaren ligger inte i brevlådan. (LÅGPRIORITET)
......@@ -102,3 +81,31 @@ Allm
Återinför Olästa
Reentrant blocking-do
Fixade saker
Completion bryr sig inte om MUSTMATCH-parametern. (FIXAT)
Om KOMNAME är satt till "" så kommer completionkoden att försöka
komplettera det till alla personer. Det vill man *inte*. (FIXAT)
(lyskom-lookup-conf-by name är snabbare på att returnera nil).
Man kan inte skicka in inlägg med kom-emacs-knows-iso-8859-1 satt
till nil. (FIXAT)
LysKOMs completing-read är skit. Den gör fel. Den borde skrivas om.
(FIXAT)
lyskom-try-complete-partials borde returnera exakta matchar före
längsta match. Nu blir (lyskom-try-complete-partials "link"
'(("(foo) link (bar)" . 1) ("linkfoobar" . 2))) "linkfoobar", inte
"(foo) link (bar)". (FUNKTIONEN ERSATT; FIXAT)
M-> i prioritera-bufferten. Text 1320736. (FIXAT)
Om man försöker logga in med en förkortning som matchar flera namn
tror klienten att man inte finns. (FIXAT?)
Lista meddelanden via fjärrkontroll listar baklänges. (FIXAT)
......@@ -731,7 +731,8 @@ CCREP is a list of all recipients that are going to be cc-recipients."
;; Catch any quits
(progn
;; Filter multiple recipients through y-or-n-p.
(if (and kom-confirm-multiple-recipients (> (length data) 1)
(if (and (eq kom-confirm-multiple-recipients 'before)
(> (length data) 1)
(not (and (= (length data) 2)
(or (= lyskom-pers-no (conf-stat->conf-no
(car data)))
......@@ -1665,6 +1666,65 @@ If MARK-NO == 0, review all marked texts."
(concat name "@" sent " (" gott rest ")")))
username)))
;;; ================================================================
;;; Status (för) Session - Status (for a) session
;;;
;;; Author: David Byers
(def-kom-command kom-status-session (&optional arg)
"Show status for all sessions a person has. Asks for person name.
Optional argument ARG should be a list of sessions to get information
about or a single session number."
(interactive)
(let ((sessions (or arg
(lyskom-read-session-no
(lyskom-get-string 'status-for-session))))
(who-info (listify-vector (blocking-do 'who-is-on))))
(cond ((listp arg))
((numberp arg) (list arg))
(t (setq arg (lyskom-read-session-no
(lyskom-get-string 'status-for-session)))))
(mapcar (function (lambda (x) (lyskom-status-session x who-info)))
sessions)))
(defun lyskom-status-session (sid who-info)
"Show session status for session SID. WHO-INFO is a list of
WHO-INFOS that are potential sessions."
(while who-info
(if (eq sid (who-info->connection (car who-info)))
(lyskom-status-session-2 (car who-info)))
(setq who-info (cdr who-info))))
(defun lyskom-status-session-2 (info)
"Internal to lyskom-status-session"
(let ((client (if kom-deferred-printing
(lyskom-create-defer-info 'get-client-name
(who-info->connection info)
'lyskom-deferred-client-1
nil nil nil
(who-info->connection info))
(blocking-do-multiple
((name (get-client-name
(who-info->connection info)))
(version (get-client-version
(who-info->connection info))))
(concat name " " version)))))
(lyskom-format-insert (lyskom-get-string 'session-status)
(who-info->connection info)
(who-info->pers-no info)
(lyskom-return-username info)
(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))
client
(if (not (eq (who-info->working-conf info) 0))
(lyskom-get-string 'doing-where-conn)
(lyskom-get-string 'doing-nowhere-conn)))))
;;; ================================================================
......
......@@ -442,7 +442,7 @@ otherwise: the conference is read with lyskom-completing-read."
(cons lyskom-last-personal-message-sender 0)
""))) t))))
(if (zerop target)
(lyskom-insert 'message-all-info)
(lyskom-insert (lyskom-get-string 'message-all-info))
(lyskom-format-insert 'message-recipient-info target))
(lyskom-send-message target message)))
......
......@@ -223,7 +223,9 @@ 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
lyskom-proc)))
(lyskom-read-conf-internal string predicate 'lyskom-lookup)))
(if (string= string "")
nil
(lyskom-read-conf-internal string predicate 'lyskom-lookup))))
(defun lyskom-read-conf-internal (string predicate all)
......@@ -246,8 +248,7 @@ function work as a name-to-conf-stat translator."
(listify-vector (conf-list->conf-nos x-list))))
(candidate-type-list
(and x-list (listify-vector (conf-list->conf-types x-list))))
(result-list nil)
(get-conf-stat-done nil))
(result-list nil))
;;
;; login-list now contains a list of logins, IF the predicate
......@@ -260,8 +261,6 @@ function work as a name-to-conf-stat translator."
;; predicate, fetching the conf-stats asynchronously.
;;
(setq get-conf-stat-done nil)
(save-excursion
(set-buffer (process-buffer lyskom-blocking-process))
(while candidate-list
......@@ -291,13 +290,20 @@ function work as a name-to-conf-stat translator."
(cond
((eq all 'lyskom-lookup)
(let ((specials (lyskom-read-conf-expand-specials string
(let ((names (mapcar 'conf-stat->name result-list))
(specials (lyskom-read-conf-expand-specials string
predicate
login-list
x-list)))
(cond ((>= (length result-list) 1)
(cond ((= (length result-list) 1)
(car result-list))
((and (> (length result-list) 1)
(lyskom-completing-member string names))
(elt result-list
(- (length result-list)
(length (lyskom-completing-member string names)))))
(specials (lyskom-read-conf-lookup-specials string
predicate
login-list
......@@ -401,7 +407,7 @@ function work as a name-to-conf-stat translator."
(found nil))
(if specials (setq name-list (nconc specials name-list)))
(cond ((member string name-list) t) ; Exact match
(cond ((lyskom-completing-member string name-list) t) ; Exact match
((= (length name-list) 1) (car name-list))
((string-match (lyskom-get-string 'person-or-conf-no-regexp)
string) nil)
......@@ -415,6 +421,15 @@ function work as a name-to-conf-stat translator."
(defun lyskom-completing-member (string list)
"Check case-insensitively if STRING is a member of LIST"
(let (result)
(while (and list (not result))
(if (string= (downcase string) (downcase (car list)))
(setq result list)
(setq list (cdr list))))
result))
(defun lyskom-complete-collect (_fn_ _seq_ &optional _initial_)
"Apply FN to all elements in SEQ in sequence. FN takes two arguments,
......@@ -438,10 +453,13 @@ argument INITIAL is the initial value to give FN."
(or (and (memq 'all predicate)
conf-no)
(and (memq 'conf predicate)
conf-type
(not (conf-type->letterbox conf-type)))
(and (memq 'pers predicate)
conf-type
(conf-type->letterbox conf-type))
(and (memq 'login predicate)
conf-type
(memq conf-no logins))
(and (memq 'none predicate)
(and (null conf-no)
......@@ -739,7 +757,9 @@ If EMPTY is non-nil then the empty string is allowed (returns 0).
INITIAL is the initial contents of the input field.
If ONLY-ONE is non-nil only one session number will be returned."
(lyskom-completing-clear-cache)
(let (result data done)
(let (result data done
(lyskom-blocking-process lyskom-proc))
(while (not done)
(setq data (lyskom-read-session-no-aux prompt t initial))
(cond ((and (string= data "") (not empty)))
......
......@@ -60,11 +60,14 @@ See lyskom-edit-handler.")
"Status variable for an edit-buffer.")
;;; Error signaled by lyskom-edit-parse-headers
(put 'lyskom-edit-text-abort 'error-conditions
'(error lyskom-error lyskom-edit-error lyskom-abort-edit))
(put 'lyskom-unknown-header 'error-conditions
'(error lyskom-error lyskom-unknown-header lyskom-edit-error))
'(error lyskom-error lyskom-edit-error lyskom-unknown-header))
(put 'lyskom-no-subject 'error-conditions
'(error lyskom-error lyskom-no-subject lyskom-edit-error))
'(error lyskom-error lyskom-edit-error lyskom-no-subject))
(defun lyskom-edit-text (proc misc-list subject body
&optional handler &rest data)
......@@ -356,6 +359,10 @@ Entry to this mode runs lyskom-edit-mode-hook."
(setq headers (lyskom-edit-parse-headers)
misc-list (apply 'lyskom-create-misc-list (cdr headers))
subject (car headers)))
;;
;; Check that there is a subject
;;
(if (string= subject "")
(let ((old (point)))
(goto-char (point-min))
......@@ -366,8 +373,26 @@ Entry to this mode runs lyskom-edit-mode-hook."
(end-of-line)
(if (/= (point) old)
(signal 'lyskom-no-subject '(enter-subject-idi)))))
;;
;; Check the recipients
;;
(let ((extra-headers
(lyskom-edit-send-check-recipients misc-list
subject)))
(if extra-headers
(setq misc-list (apply 'lyskom-create-misc-list
(cdr (nconc headers
extra-headers))))))
;;
;; Transform the message text
;;
(setq message
(lyskom-send-transform-text (lyskom-edit-extract-text)))
(lyskom-send-transform-text (lyskom-edit-extract-text)))
(setq mode-name "LysKOM sending")
(save-excursion
(set-buffer (process-buffer lyskom-proc))
......@@ -377,11 +402,11 @@ Entry to this mode runs lyskom-edit-mode-hook."
(setq lyskom-is-writing nil)
(lyskom-tell-internat 'kom-tell-send)
(funcall send-function
'sending
'lyskom-create-text-handler
(concat subject "\n" message)
misc-list
buffer)))
'sending
'lyskom-create-text-handler
(concat subject "\n" message)
misc-list
buffer)))
(if kom-dont-restore-window-after-editing
(bury-buffer)
(save-excursion
......@@ -394,10 +419,12 @@ Entry to this mode runs lyskom-edit-mode-hook."
(set-buffer (window-buffer (selected-window))))
(goto-char (point-max))))
;;
;; Catch no-subject
;; Catch no-subject and other things
;;
(lyskom-edit-error
(lyskom-abort-edit
(apply 'lyskom-message (cdr-safe err)))
(lyskom-no-subject
(if (cdr-safe (cdr-safe err))
(goto-char (car-safe (cdr-safe (cdr-safe err)))))
(lyskom-beep lyskom-ding-on-no-subject)
......@@ -415,6 +442,119 @@ Entry to this mode runs lyskom-edit-mode-hook."
(lyskom-message "%s" (lyskom-get-string (car (cdr err)))))))
(defun lyskom-edit-send-check-recipients (misc-list subject)
"Check that the recipients of this text are OK. Ask the user to
confirm multiple recipients; check that the author of the commented
text is a member of some recipient of this text."
(let* ((comm-to-list nil)
(recipient-list nil)
(author-list nil)
(membership-list nil)
(check-rcpt-membership-list nil)
(extra-headers nil)
(me (save-excursion (set-buffer (process-buffer lyskom-proc))
lyskom-pers-no))
(num-me 0))
;;
;; List all texts this text is a comment to
;;
(lyskom-traverse misc (cdr misc-list)
(cond ((eq (car misc) 'comm-to)
(setq comm-to-list (cons (cdr misc)
comm-to-list)))
((or (eq (car misc) 'recpt)
(eq (car misc) 'cc-recpt))
(if (eq (cdr misc) me) (setq num-me (1+ num-me)))
(setq recipient-list (cons (cdr misc) recipient-list)))))
;;
;; Confirm multiple recipients
;;
(if (and kom-confirm-multiple-recipients
(not (eq kom-confirm-multiple-recipients 'before))
(> (- (length recipient-list) num-me) 1))
(if (not (lyskom-j-or-n-p (lyskom-format 'comment-all-relevant-p) t))
(signal 'lyskom-edit-text-abort (list "%s"
(lyskom-get-string
'please-edit-recipients)))))
(if kom-check-commented-author-membership
(progn
;;
;; For each commented text, get the author
;;
(setq author-list (mapcar
(function (lambda (x)
(text-stat->author
(blocking-do 'get-text-stat x))))
comm-to-list))
;;
;; For each author, check that the author is a member of one of
;; the recipients (I'd like a quick server call for this, rather
;; than get the entire membership for the author).
;;
(lyskom-message (lyskom-get-string 'checking-rcpt))
(save-excursion
(set-buffer (process-buffer lyskom-proc))
(mapcar (function (lambda (check-recipient-author-map-variable)
(initiate-get-membership
'sending
(function
(lambda (x y)
(setq check-rcpt-membership-list
(cons
(cons y x)
check-rcpt-membership-list))))
check-recipient-author-map-variable
check-recipient-author-map-variable)))
author-list)
(lyskom-wait-queue 'sending))
(lyskom-message (lyskom-get-string 'checking-rcpt-done))
(setq membership-list
(mapcar
(function (lambda (x)
(cons (car x)
(mapcar 'membership->conf-no
(listify-vector (cdr x))))))
check-rcpt-membership-list))
(while membership-list
(if (not (lyskom-edit-check-membership (cdr (car membership-list))
recipient-list))
(if (lyskom-j-or-n-p
(let ((kom-deferred-printing nil))
(lyskom-format 'add-recipient-p
(car (car membership-list)))) t)
(setq extra-headers
(nconc (list 'recpt (car (car membership-list)))
extra-headers))))
(setq membership-list (cdr membership-list)))))
extra-headers))
(defun lyskom-edit-check-membership (membership conf-list)
(let ((found nil))
(while (and conf-list (not found))
(setq found (or found
(memq (car conf-list) membership)))
(setq conf-list (cdr conf-list)))
found))
(defun lyskom-send-transform-text (message)
(if lyskom-format-experimental
(condition-case err
......@@ -548,7 +688,7 @@ Entry to this mode runs lyskom-edit-mode-hook."
(let ((marker (point-min-marker))
(edit-buffer (current-buffer))
(insert-at (point-min-marker))
(conf-stat (lyskom-read-conf-stat prompt '(all) nil "")))
(conf-stat (lyskom-read-conf-stat prompt '(all) nil "" t)))
(lyskom-save-excursion
;;(save-excursion
(set-buffer (process-buffer lyskom-proc))
......
......@@ -362,6 +362,12 @@ Read all about it at http://www.lysator.liu.se/history/")
(add-comment-to . "Adding article %#1n as a comment to text %#2n...")
(sub-comment-to . "Removing article %#1n as a comment to article %#2n...")
(comment-keep-recpt-p ."Should %#1s remain a recipient? ")
(comment-all-relevant-p . "There are multiple recipients. Are they all relevant? ")
(please-edit-recipients . "Modify the recipient list and send the article again.")
(add-recipient-p . "Add recipient %#1P? ")
(checking-rcpt . "Checking recipients...")
(checking-rcpt-done . "Checking recipients...done")
(matching-regexp . "Conferences/users matching `%#1s'\n")
; From commands2.el:
......@@ -713,7 +719,8 @@ Group message to %#3M\nfrom %#2P (%#4s):
(new-prio . "%6#1d")
; From flags.el:
(saving-settings . "Saving options")
(saving-settings . "Saving options...")
(saving-settings-done . "Saving options...done")
(hang-on . "Wait a moment...\n")
(could-not-save-options . "Couldn't save options.")
(could-not-create-area . "Couldn't create the article.\n")
......@@ -902,6 +909,12 @@ Text:
(who-i-am-client . "The programs is lyskom.el, version %#1s.\n")
(who-i-am-server . "This is %#1s, version %#2s.\n")
(who-i-am-emacs . "Running under %#1s.\n")
(session-status . "Session %#1d is %#2P <%#2p>
%#5s %#7s %#4M
Using %#6D from %#3s\n")
(status-for-session . "Session status for whom? ")
(doing-where-conn . "in")
(doing-nowhere-conn . "but is")
)
"Assoc list containing pairs of atoms and strings")
......@@ -998,6 +1011,7 @@ Text:
(kom-unset-conf-motd "Remove note (from the door)")
(kom-save-text "Save article (in file)")
(kom-edit-options "Change options")
(kom-save-options "Save options")
(kom-shutdown-server "Shut down (server)")
(kom-enable-adm-caps "Become administrator")
(kom-disable-adm-caps "Become (normal) user")
......@@ -1026,6 +1040,8 @@ Text:
(kom-remote-list-messages "Remote control list messages")
(kom-remote-erase-messages "Remote control erase messages")
(kom-remote-quit "Remote control quit")
(kom-status-session "Status (of a) session")
)
"A list of LysKOM-commands recognized by the extended parser.")
......@@ -1185,6 +1201,7 @@ Cf. paragraph-start.")
(define-key lyskom-mode-map "ra " 'kom-review-all)
(define-key lyskom-mode-map "sc" 'kom-status-conf)
(define-key lyskom-mode-map "su" 'kom-status-person)
(define-key lyskom-mode-map "ss" 'kom-status-session)
;; Running in buffer
......
......@@ -57,6 +57,15 @@
(defvar lyskom-options-text nil
"Text mass when reading options.")
(def-kom-command kom-save-options ()
"Save options that have been set somewhere."
(interactive)
(lyskom-save-options (or lyskom-buffer
(current-buffer))
(lyskom-get-string 'saving-settings)
(lyskom-get-string 'saving-settings-done)
(lyskom-get-string 'could-not-save-options)))
(defun kom-edit-options ()
"Edit options for the lyskom client."
......
No preview for this file type
......@@ -224,8 +224,11 @@ All the forms in BIND-LIST are evaluated before and symbols are bound."
(defun facep (x)
"Return t if X is a face name or an internal face vector."
(and (or (internal-facep x)
(and (symbolp x) (assq x global-face-data)))
(and (or (and (fboundp 'internal-facep)
(internal-facep x))
(and (symbolp x)
(boundp 'global-face-data)
(assq x global-face-data)))
t))))
(if (not (fboundp 'save-selected-window))
......
......@@ -286,7 +286,7 @@ result is assigned to the element."
original
secret
letterbox
anarchy
(eq anarchy t)
(and (not (eq anarchy 'space))
(lyskom-parse-1-or-0))
(and (not (eq anarchy 'space))
......
......@@ -136,9 +136,9 @@ The defaults for this command is the conference that you are in."
;; (not (zerop by))
(if (zerop lyskom-current-conf)
""
(conf-stat->name
(blocking-do 'get-conf-stat
lyskom-current-conf)))
(cons (conf-stat->name
(blocking-do 'get-conf-stat
lyskom-current-conf)) 0))
t)))
(if (not (zerop to))
......
......@@ -695,8 +695,37 @@ Args: KOM-QUEUE HANDLER REGEXP WANT-PERSONS WANT-CONFS &rest DATA."
"Tell the server to set the highest unread article in conference CONF-NO
to TEXT-NO
Args: KOM-QUEUE HANDLER CONF-NO TEXT-NO &rest DATA"
(if lyskom-set-last-read-flag
(progn
(lyskom-call kom-queue lyskom-ref-no handler data 'lyskom-parse-void)
(lyskom-send-packet kom-queue (lyskom-format-objects 77
conf-no text-no)))
(initiate-get-conf-stat kom-queue
'initiate-set-last-read-2
conf-no
kom-queue
handler
conf-no
text-no
data)))
(defun initiate-set-last-read-2 (conf-stat
kom-queue