Commit d215629c authored by David Byers's avatar David Byers
Browse files

Coding system fix

Better error messages when adding members
Try to keep buffer lists updated
parent 9dc87dad
1999-11-17 David Byers <davby@ida.liu.se>
* startup.el (lyskom): Set process coding system to latin-1 again.
Don't remember why I changed it in the first place.
* lyskom-rest.el (lyskom-is-loaded): Add
lyskom-remove-buffer-from-lists to kill-buffer-hook.
* buffers.el (lyskom-remove-buffer-from-lists): New function.
(lyskom-clean-buffer-list): Moved here from commands2.el
(lyskom-clean-all-buffer-lists): Ditto.
* lyskom-rest.el (lyskom-is-loaded): Add a hook to delete killed
buffers from all buffer lists.
* command.el (lyskom-end-of-command): Clean
lyskom-sessions-with-unread, lyskom-sessions-with-unread-letters
and lyskom-buffer list.
* lyskom-rest.el (lyskom-sentinel): Remove buffer from
lyskom-sessions-with-unread-letters.
1999-11-09 David Byers <davby@ida.liu.se>
* bugs.el (kom-bug-report): Moved here from commands.el.
* async.el (lyskom-delete-old-text): Remove deleted text from
lyskom-reading-list too.
1999-11-07 David Byers <davby@ida.liu.se>
* edit-text.el (lyskom-is-permitted-author): Use new version of
lyskom-is-supervisor.
1999-11-06 David Byers <davby@ida.liu.se>
* commands1.el (lyskom-add-member-answer): Print useful messages
when add fails because user is already a member.
* utilities.el (lyskom-is-supervisor): New function.
(lyskom-is-strictly-supervisor): Ditto.
(lyskom-is-member): Ditto.
1999-11-17 Joel Rosdahl <joel@lysator.liu.se>
* Added README.debian and a debian subdirectory with files for
......
......@@ -10,6 +10,14 @@ eftersom den just nu inte kan anv
* Den parsade strängen måste bort innan man anropar callback-funktionen.
ispell-hooken rättar ärendet i bufferten men det blir inte rättat i
den inskickade versionen av inlägget. KAnske.
Om det kommer ett async-new-recipient och vi inte kan hitta lokalt
textnummer i mottagaren, ignorera meddelandet.
Någon form at reply till importerade brev som använder mx-reply-to
eller mx-to, mx-cc om de finns.
......
......@@ -724,7 +724,9 @@ This call is used in response to a deleted text message"
(when (and membership
(lyskom-visible-membership membership))
(read-list-delete-text (text-stat->text-no text-stat)
lyskom-to-do-list)))
lyskom-to-do-list)
(read-list-delete-text (text-stat->text-no text-stat)
lyskom-reading-list)))
(lyskom-set-mode-line)))
......
......@@ -175,6 +175,35 @@ the children object"
;;;; ======================================================================
;;;; ======================================================================
(defun lyskom-clean-all-buffer-lists ()
"Remove dead buffers from all relevant buffer lists"
(setq lyskom-sessions-with-unread
(lyskom-clean-buffer-list lyskom-sessions-with-unread)
lyskom-sessions-with-unread-letters
(lyskom-clean-buffer-list lyskom-sessions-with-unread-letters)
lyskom-buffer-list
(lyskom-clean-buffer-list lyskom-buffer-list)))
(defun lyskom-clean-buffer-list (buffers)
"Remove all dead buffers from BUFFERS"
(let ((result nil))
(while buffers
(when (lyskom-buffer-p (car buffers))
(setq result (cons (car buffers) result)))
(setq buffers (cdr buffers)))
(nreverse result)))
(defun lyskom-remove-buffer-from-lists (&optional buffer)
"Remove BUFFER from all internal lists.
If BUFFER is not specified, assume the current buffer"
(unless buffer (setq buffer (current-buffer)))
(setq lyskom-sessions-with-unread
(delq buffer lyskom-sessions-with-unread))
(setq lyskom-sessions-with-unread-letters
(delq buffer lyskom-sessions-with-unread-letters))
(setq lyskom-buffer-list
(delq buffer lyskom-buffer-list)))
(defvar lyskom-associated-buffer-list nil
"List of (CATEGORY . BUFFER-LIST) listing all buffers of various
categories")
......
......@@ -303,6 +303,7 @@ chosen according to this"
"Print prompt, maybe scroll, prefetch info."
(lyskom-save-excursion
(message "")
(lyskom-clean-all-buffer-lists)
(while (and lyskom-to-be-printed-before-prompt
(lyskom-queue->first lyskom-to-be-printed-before-prompt))
(if (not (bolp)) (lyskom-insert "\n"))
......
......@@ -408,7 +408,6 @@ PERS-CONF-STAT: the conf-stat of the person being added.
PERS-STAT: the pers-stat of the person being added.
Optional MESSAGE-STRING is the message to print before making server call.
Returns t if it was possible, otherwise nil."
(if (or (null conf-conf-stat)
(null pers-conf-stat))
......@@ -464,15 +463,27 @@ Returns t if it was possible, otherwise nil."
priority where
membership-type)))))
(defun lyskom-add-member-answer (answer conf-conf-stat pers-conf-stat)
"Handle the result from an attempt to add a member to a conference."
(if (null answer)
(progn
(lyskom-insert-string 'nope)
(if (conf-type->rd_prot (conf-stat->conf-type conf-conf-stat))
;; The conference is protected. Tell the user to contact
(let ((supervisorconf (blocking-do
(let* ((errno lyskom-errno)
(is-supervisor (lyskom-is-supervisor (conf-stat->conf-no conf-conf-stat)
lyskom-pers-no))
(is-member (lyskom-is-member (conf-stat->conf-no conf-conf-stat)
(conf-stat->conf-no pers-conf-stat)))
(rd-prot (conf-type->rd_prot (conf-stat->conf-type conf-conf-stat))))
(cond (is-member
(lyskom-format-insert 'add-already-member
pers-conf-stat
conf-conf-stat))
((and rd-prot is-supervisor)
(lyskom-format-insert 'error-code (lyskom-get-error-text errno)))
(rd-prot (let ((supervisorconf (blocking-do
'get-conf-stat
(conf-stat->supervisor conf-conf-stat))))
(if supervisorconf
......@@ -480,10 +491,11 @@ Returns t if it was possible, otherwise nil."
conf-conf-stat
supervisorconf)
(lyskom-format-insert 'cant-find-supervisor
conf-conf-stat)))
(lyskom-format-insert 'error-code
conf-conf-stat))))
(t (lyskom-format-insert 'error-code
(lyskom-get-error-text lyskom-errno)
lyskom-errno)))
lyskom-errno)))))
(lyskom-insert-string 'done)
;;+++Borde {ndra i cachen i st{llet.
......
......@@ -1173,99 +1173,6 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
; (t (lyskom-message "%s" (lyskom-get-string 'does-not-exist))))
;;; ================================================================
;;; Skapa bugg-rapport - Compile bugg-report
;;; Author: Linus Tolke
(defun kom-bug-report ()
"This command should make it easier to include the correct info in a buggreport"
(interactive)
(let* ((curbuf (current-buffer))
(old-buf (if (boundp 'debugger-old-buffer)
(symbol-value 'debugger-old-buffer)
(current-buffer)))
(repname "*lyskom-bugreport*"))
(lyskom-message "%s" (lyskom-get-string 'buggreport-compilestart))
(set-buffer old-buf)
(cond
((condition-case nil
(eq old-buf (process-buffer lyskom-proc))
(error nil)))
((condition-case nil
(save-excursion
(set-buffer (process-buffer lyskom-proc))
(set-buffer lyskom-unparsed-buffer)
(eq old-buf (current-buffer)))
(error nil))
(set-buffer (process-buffer lyskom-proc)))
(t
(error "I dont know what buffer you are running lyskom in (%s)?"
old-buf)))
(with-output-to-temp-buffer repname
(princ (lyskom-get-string 'buggreport-description))
(princ (lyskom-get-string 'buggreport-internals))
(princ (lyskom-get-string 'buggreport-command-keys))
(terpri)
(princ (key-description (recent-keys)))
(terpri)
(princ (lyskom-get-string 'buggreport-version))
(print lyskom-clientversion)
(princ (lyskom-get-string 'buggreport-emacs-version))
(print (emacs-version))
(princ (lyskom-get-string 'buggreport-system-id))
(print system-type)
(princ (lyskom-get-string 'buggreport-ctl-arrow-doc))
(print (condition-case nil
(documentation-property 'ctl-arrow 'variable-documentation)
(error)))
(princ (lyskom-get-string 'buggreport-unparsed))
(print (save-excursion
(set-buffer lyskom-unparsed-buffer)
(goto-char (point-min))
(forward-line 10)
(buffer-substring (point-min) (point))))
(if (and (boundp 'debugger-old-buffer)
(symbol-value 'debugger-old-buffer))
(princ (lyskom-format 'buggreport-backtrace
(save-excursion
(set-buffer curbuf)
(buffer-substring (point-min)
(point-max))))))
(if lyskom-debug-communications-to-buffer
(progn
(princ (lyskom-get-string 'buggreport-communications))
(print (save-excursion
(set-buffer lyskom-debug-communications-to-buffer-buffer)
(buffer-substring (point-min) (point-max))))))
(princ (lyskom-get-string 'buggreport-all-kom-variables))
(mapatoms
(function
(lambda (symbol)
(and (boundp symbol)
(string-match "^\\(kom-\\|lyskom-\\)" (symbol-name symbol))
(not (string-match "-cache$\\|^kom-dict$\\|^lyskom-strings$\
\\|-map$\\|^lyskom-commands$"
(symbol-name symbol)))
(progn
(terpri)
(princ (symbol-name symbol))
(princ ":")
(print (symbol-value symbol))))))))
(save-excursion
(set-buffer repname)
(goto-char (point-min))
(replace-regexp "byte-code(\".*\""
(lyskom-get-string 'buggreport-instead-of-byte-comp)))
(lyskom-message "%s" (lyskom-get-string 'buggreport-compileend))))
(fset 'kom-compile-bug-report (symbol-function 'kom-bug-report))
;;; ================================================================
;;; [ndra livsl{ngd - Set lifespan of texts in a conference
......@@ -1639,16 +1546,6 @@ is alive."
;;; lyskom-buffer-list)))
(defun lyskom-clean-buffer-list (buffers)
"Remove all dead buffers from BUFFERS"
(let ((result nil))
(while buffers
(when (lyskom-buffer-p (car buffers))
(setq result (cons (car buffers) result)))
(setq buffers (cdr buffers)))
(nreverse result)))
(defun lyskom-next-kom (buffer-list-name direction)
"Internal version of kom-next-kom
BUFFER-LIST-NAME is the list of buffers to rotate through. It must be a
......@@ -2203,6 +2100,16 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-format-insert 'conf-no-does-not-exist-r conf-no))
((null faq-list)
(lyskom-format-insert 'conf-has-no-faq conf-stat))
((eq 1 (length faq-list))
(lyskom-format-insert 'review-faq-for-r conf-stat)
(lyskom-view-text (car faq-list)
nil ;mark-as-read
nil ;follow-comments
nil ;conf-stat
nil ;priority
nil ;build-review-tree
t ;flat-review
))
(t
(lyskom-format-insert 'review-faq-for-r conf-stat)
(read-list-enter-read-info
......
......@@ -715,25 +715,16 @@ Based on ispell-message."
(defun lyskom-is-permitted-author (conf-stat)
(and conf-stat
(or (eq 0 (conf-stat->permitted-submitters conf-stat))
(lyskom-is-supervisor conf-stat))))
(defun lyskom-is-supervisor (conf-stat &optional memo)
"Return non-nil if lyskom-pers-no is a supervisor of CONF-STAT."
(cond ((null conf-stat) nil)
((memq (conf-stat->conf-no conf-stat) memo) nil)
((eq lyskom-pers-no (conf-stat->conf-no conf-stat)) t)
((eq lyskom-pers-no (conf-stat->supervisor conf-stat)) t)
((eq 0 (conf-stat->supervisor conf-stat)) nil)
((lyskom-get-membership (conf-stat->conf-no conf-stat) t) t)
((lyskom-is-supervisor
(blocking-do 'get-conf-stat (conf-stat->supervisor conf-stat))
(cons (conf-stat->conf-no conf-stat) memo)))))
(lyskom-is-supervisor (conf-stat->conf-no conf-stat)
lyskom-pers-no))))
(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."
text is a member of some recipient of this text.
Cannot be called from a callback."
(let* ((comm-to-list nil)
(recipient-list nil)
(author-list nil)
......
......@@ -394,7 +394,9 @@ If the optional argument REFETCH is non-nil, all caches are cleared and
;; This is horribly ugly. It acts like a user command, but it isn't.
(defun lyskom-view-priority-text ()
"Display the first text from the next conference on the lyskom-to-do-list."
"Display the first text from the next conference on the lyskom-to-do-list.
Cannot be called from a callback."
(lyskom-start-of-command 'kom-view-next-text)
(unwind-protect
(progn
......@@ -2204,6 +2206,7 @@ The name of the file is read using the minibuffer and the default is kom-text."
arg (1- arg))
(setq arg 0)))
(set-buffer buf)
(setq kom-deferred-printing nil)
(erase-buffer)
(mapcar (function
(lambda (n)
......@@ -3062,6 +3065,8 @@ If MEMBERSHIPs prioriy is 0, it always returns nil."
"Handles changes in the lyskom-process."
(setq lyskom-sessions-with-unread
(delq proc lyskom-sessions-with-unread))
(setq lyskom-sessions-with-unread-letters
(delq proc lyskom-sessions-with-unread-letters))
(set-buffer (process-buffer proc))
(lyskom-start-of-command (lyskom-get-string 'process-signal) t)
(lyskom-format-insert 'closed-connection sentinel
......@@ -3352,7 +3357,7 @@ One parameter - the prompt string."
(let ((extent (make-extent nil nil nil)))
(set-extent-keymap extent lyskom-modeline-keymap)
(setq global-mode-string
(append (list "" (cons extent lyskom-unread-mode-line))
(append (list "" (cons extent 'lyskom-unread-mode-line))
global-mode-string)))
(setq global-mode-string
(append '("" lyskom-unread-mode-line) global-mode-string))))
......@@ -3363,6 +3368,9 @@ One parameter - the prompt string."
(lyskom-get-string 'mode-line-letters))
" "))
(add-hook 'kill-buffer-hook 'lyskom-remove-buffer-from-lists)
;;;
;;; Set up lyskom-line-start-chars. The reason we do it here is that
;;; char-to-int may not be defined until compatibility.el has been
......
......@@ -385,7 +385,9 @@ going from where we were before."
;;;
(defun lyskom-get-letters-to (persno recipient num &optional again pstart)
"Get NUM texts written by PERSNO. Args: persno num"
"Get NUM texts written by PERSNO. Args: persno num
Cannot be called from a callback."
(let ((persstat (blocking-do 'get-pers-stat persno)))
(lyskom-check-review-access t persstat)
......@@ -783,7 +785,9 @@ Args: persno confno num &optional again pstart cstart"
(defun lyskom-get-texts-by-generic (persno num pred args
&optional again pstart)
"Get NUM texts written by PERSNO. Args: persno num"
"Get NUM texts written by PERSNO. Args: persno num
Cannot be called from a callback."
(let* ((persstat (blocking-do 'get-pers-stat persno))
(user-area (pers-stat->user-area persstat)))
......
......@@ -160,7 +160,7 @@ See lyskom-mode for details."
(setq proc (open-network-stream name buffer
proxy-host
proxy-port))
(set-process-coding-system proc 'no-conversion 'no-conversion)
(set-process-coding-system proc 'iso-latin-1 'iso-latin-1)
;; Install our filter.
;; Do this before we send the CONNECT command to
......@@ -190,7 +190,7 @@ CONNECT %s:%d HTTP/1.0\r\n\
)
(t (setq proc (open-network-stream name buffer
host port))
(set-process-coding-system proc 'no-conversion 'no-conversion))))
(set-process-coding-system proc 'iso-latin-1 'iso-latin-1))))
(switch-to-buffer buffer)
(lyskom-mode) ;Clearing lyskom-default...
(setq lyskom-buffer buffer)
......
......@@ -243,6 +243,7 @@ Guran vill helst s
(done . "klart.\n")
(cancelled . "avbrutet.\n")
(nope . "Det gick inte.\n")
(add-already-member . "%#1P r redan medlem i %#2M.\n")
(cant-find-supervisor . "Hittar inte organisatren fr %#1M.\n")
(is-read-protected-contact-supervisor . "%#1M r slutet.
......
......@@ -733,3 +733,66 @@ return nil."
(goto-char (point-max))
(setq num 1))))
(setq num (1- num))))
;;; ============================================================
;;; Database stuff
;; Extracted from edit-text.el
;;(defun lyskom-is-supervisor (conf-stat &optional memo)
;; "Return non-nil if lyskom-pers-no is a supervisor of CONF-STAT."
;; (cond ((null conf-stat) nil)
;; ((memq (conf-stat->conf-no conf-stat) memo) nil)
;; ((eq lyskom-pers-no (conf-stat->conf-no conf-stat)) t)
;; ((eq lyskom-pers-no (conf-stat->supervisor conf-stat)) t)
;; ((eq 0 (conf-stat->supervisor conf-stat)) nil)
;; ((lyskom-get-membership (conf-stat->conf-no conf-stat) t) t)
;; ((lyskom-is-supervisor
;; (blocking-do 'get-conf-stat (conf-stat->supervisor conf-stat))
;; (cons (conf-stat->conf-no conf-stat) memo)))))
(defun lyskom-is-supervisor (conf-no viewer-no)
"Return non-nil if the supervisor of CONF-NO is VIEWER-NO."
(or (eq viewer-no conf-no)
(lyskom-is-strictly-supervisor conf-no viewer-no)))
(defun lyskom-is-strictly-supervisor (conf-no viewer-no)
"Return non-nil if VIEWER-NO is strictly a supervisor of CONF-NO
Cannot be called from a callback."
(let ((collector (make-collector))
(conf-stat nil))
(initiate-get-conf-stat 'background 'collector-push conf-no collector)
(lyskom-wait-queue 'background)
(setq conf-stat (car (collector->value collector)))
(cond ((null viewer-no) nil)
((eq viewer-no 0) nil)
((null conf-stat) nil)
((eq viewer-no (conf-stat->supervisor conf-stat)) t)
((lyskom-is-member (conf-stat->supervisor conf-stat) viewer-no) t)
(t nil))))
(defun lyskom-is-member (conf-no pers-no &optional queue)
"Return the membership in CONF-NO of PERS-NO
Optional argument QUEUE is the queue to send the queries on.
Cannot be called from a callback."
(or (and (eq pers-no lyskom-pers-no)
(lyskom-try-get-membership conf-no t))
(let ((collector (make-collector)))
(initiate-query-read-texts (or queue 'background)
'collector-push
pers-no
conf-no
collector)
(lyskom-wait-queue (or queue 'background))
(car (collector->value collector)))))
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