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

Tog bort död kod i lyskom-rest.el, fixade j-or-n-p så den fungerar bättre,...

Tog bort död kod i lyskom-rest.el, fixade j-or-n-p så den fungerar bättre, mindre scrollning vis promptbyte, hantera lokala variabler i ändra variabler.
parent 53bb1c5a
Tue Jul 23 11:28:29 1996 David Byers <davby@sen2.ida.liu.se>
* edit-text.el (lyskom-edit-send-check-recipients): Skrev om till
att anvnda query-read-texts istf get-membership.
* flags.el (lyskom-Edit-options-modify): Ny funktion.
(kom-edit-options): Byt ut Edit-options-modify mot
lyskom-Edit-options-modify s att den hanterar buffertlokala
variabler lite bttre. Denna patch r dock helt beroende av
implementationen av edit-options och fungerar kanske inte s bra i
alla emacsversioner.
* filter-edit.el (lyskom-filter-edit-save): Spara ndringarna i
rtt buffert s inte buffertlokala variabler skrivs ver med nil
eller defaultvrden.
Mon Jul 22 14:10:51 1996 David Byers <davby@sen2.ida.liu.se>
* async.el (lyskom-default-new-text-hook): Eventuellt r
scrollning till botten vid promptbyte eliminerad.
* vars.el.in (lyskom-noadmin-removed-commands): Lade till
kom-sync-database.
* swedish-strings.el (lyskom-strings): Lade till syncing-database
och really-sync
* commands2.el (kom-sync-database): Ny funktion
* services.el (initiate-sync): Ny funktion.
* lyskom-rest.el: Tog bort kom-dict och relaterade funktioner.
Removes lyskom-put-back-on-to-do-list Removed lyskom-return-time.
(lyskom-insert-before-prompt): Inlajnade
lyskom-do-insert-before-prompt
* commands2.el (kom-shutdown-server): Gr def-kom-command, anvnd
blocking-do.
* lyskom-rest.el (j-or-n-p): Hantera C-g ven om read-char normalt
inte kan lsa C-g. Hantera C-l ocks.
Tog bort lyskom-handle-command-answer.
* commands2.el (kom-change-conf-type): Hantera ndra mtestyp p
personer. Spara de flaggor som inte explicit stts av funktionen.
Visa aktuell mtestyp innan frgorna stlls. Anvnd
lyskom-j-or-n-p fr att stlla frgorna.
Fri Jul 19 18:29:41 1996 David Kgedal <davidk@lysator.liu.se>
* view-text.el (lyskom-follow-comments): Det stod comments p ett
......
......@@ -3,8 +3,6 @@ Att g
Buggar
Ä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
prefix till existerande namn]
......@@ -109,3 +107,5 @@ Fixade saker
Lista meddelanden via fjärrkontroll listar baklänges. (FIXAT)
Ändra variabler klarar inte att hantera buffertlokala variabler. FIXAT.
......@@ -407,12 +407,13 @@ converted, before insertion."
(not lyskom-executing-command)) ;We have time to do it.
;; Alter the prompt.
(let ((buffer-read-only nil))
(lyskom-save-excursion
(save-excursion
(goto-char (point-max))
(beginning-of-line)
(delete-region (point) (point-max)))
(lyskom-run 'async 'lyskom-print-prompt)))
(let ((no-message nil))
(run-hooks 'lyskom-new-text-hook)
......
......@@ -70,7 +70,7 @@
(interactive)
(let ((conf-stat
(lyskom-read-conf-stat (lyskom-get-string 'what-conf-to-delete)
'(all))))
'(all) nil nil t)))
(if conf-stat
(if (lyskom-ja-or-nej-p
(lyskom-format 'confirm-delete-pers-or-conf
......
......@@ -1080,22 +1080,30 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
;;; ================================================================
;;; Spara databasen - Save database
;;;
(def-kom-command kom-sync-database ()
"Save the LysKOM database."
(interactive)
(if (lyskom-ja-or-nej-p (lyskom-get-string 'really-sync))
(progn (lyskom-insert-string 'syncing-server)
(lyskom-report-command-answer (blocking-do 'sync)))))
;;; ================================================================
;;; St{ng av servern - Shutdown
;;; Author: Inge Wallin
(defun kom-shutdown-server ()
(def-kom-command kom-shutdown-server ()
"Shutdown the LysKOM server."
(interactive)
(lyskom-start-of-command 'kom-shutdown-server)
(if (lyskom-ja-or-nej-p (lyskom-get-string 'really-shutdown))
(progn
(lyskom-insert-string 'closing-server)
(initiate-shutdown 'main 'lyskom-handle-command-answer 0))
(lyskom-end-of-command)))
(lyskom-report-command-answer (blocking-do 'shutdown 0)))))
;;; ================================================================
......@@ -1412,25 +1420,54 @@ membership info."
(def-kom-command kom-change-conf-type ()
"Change type of a conference"
(interactive)
(let* ((conf-no (lyskom-read-conf-no
(let* ((conf-stat (lyskom-read-conf-stat
(lyskom-get-string 'what-conf-to-change)
'(conf) nil "" t))
(open (j-or-n-p (lyskom-get-string 'anyone-member)))
'(conf pers) nil "" t))
(foo
(let* ((type (conf-stat->conf-type conf-stat))
(box (conf-type->letterbox type))
(ori (conf-type->original type))
(pro (conf-type->rd_prot type))
(sec (conf-type->secret type)))
(lyskom-format-insert 'change-type-prompt
conf-stat
conf-stat
(cond
((or box ori pro sec)
(concat
"("
(if box (lyskom-get-string 'Mailbox) "")
(if (and box (or sec ori pro)) ", " "")
(if sec (lyskom-get-string
'Protected) "")
(if (and sec (or ori pro)) ", " "")
(if ori (lyskom-get-string
'no-comments) "")
(if (and ori pro) ", " "")
(if pro (lyskom-get-string 'closed) "")
")"))
(t "")))))
(open (lyskom-j-or-n-p (lyskom-get-string 'anyone-member)))
(secret (if (not open)
(j-or-n-p (lyskom-get-string 'secret-conf))))
(orig (j-or-n-p (lyskom-get-string 'comments-allowed)))
(anarchy (j-or-n-p (lyskom-get-string 'anonymous-allowed))))
(cache-del-conf-stat conf-no)
(if (not (blocking-do 'set-conf-type
conf-no
(lyskom-j-or-n-p (lyskom-get-string 'secret-conf))))
(orig (lyskom-j-or-n-p (lyskom-get-string 'comments-allowed)))
(anarchy (lyskom-j-or-n-p (lyskom-get-string 'anonymous-allowed))))
(cache-del-conf-stat (conf-stat->conf-no conf-stat))
(if (not (blocking-do
'set-conf-type
(conf-stat->conf-no conf-stat)
(lyskom-create-conf-type (not open)
(not orig)
secret
nil
(conf-type->letterbox
(conf-stat->conf-type conf-stat))
anarchy
nil
nil
nil)))
(conf-type->rsv1
(conf-stat->conf-type conf-stat))
(conf-type->rsv2
(conf-stat->conf-type conf-stat))
(conf-type->rsv3
(conf-stat->conf-type conf-stat)))))
(progn (lyskom-insert-string 'nope)
(lyskom-format-insert 'error-code
(lyskom-get-error-text lyskom-errno)
......
......@@ -449,8 +449,7 @@ 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)
(author-is-member nil)
(extra-headers nil)
(me (save-excursion (set-buffer (process-buffer lyskom-proc))
lyskom-pers-no))
......@@ -482,7 +481,7 @@ text is a member of some recipient of this text."
'please-edit-recipients)))))
(if (and kom-check-commented-author-membership
(memq 'comm-to misc-list))
(assq 'comm-to (cdr misc-list)))
(progn
(lyskom-message (lyskom-get-string 'checking-rcpt))
......@@ -497,7 +496,7 @@ text is a member of some recipient of this text."
comm-to-list))
;;
;; For each author, see if the author is a direct decipient
;; For each author, see if the author is a direct recipient
;; of the text. If so, there is no point in continuing.
;; (People can unsubscribe from their mailboxes, but if they
;; do, this code won't help anyway.)
......@@ -513,64 +512,44 @@ text is a member of some recipient of this text."
(eq (cdr misc) me))
(setq author-list (delq (cdr misc) author-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).
;; For each author, get his or her memberships in all
;; recipient conferences.
;;
(save-excursion
(set-buffer (process-buffer lyskom-proc))
(mapcar (function (lambda (check-recipient-author-map-variable)
(initiate-get-membership
(mapcar (function
(lambda (author-number)
(lyskom-collect 'sending)
(mapcar
(function
(lambda (conference-number)
(initiate-query-read-texts
'sending
nil
author-number conference-number)))
recipient-list)
(lyskom-list-use '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
(lambda (x)
(setq author-is-member
(memq nil
(mapcar 'not x))))))
(lyskom-wait-queue 'sending)
(if (and (null author-is-member)
(lyskom-j-or-n-p
(let ((kom-deferred-printing nil))
(lyskom-format 'add-recipient-p
(car (car membership-list)))) t)
(lyskom-format
'add-recipient-p
author-number)) 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))
(nconc (list 'recpt
author-number)
extra-headers)))))
author-list))))
extra-headers))
......
......@@ -536,6 +536,8 @@ Mark the envelope with \"LysKOM bug report\"\n\n")
(really-shutdown . "Are you sure you want to shut down the server? ")
(closing-server . "Shutting down the server...")
(really-sync . "Are you sure you want to save the database? ")
(syncing-server . "Saving the database...")
(administrator . "administrator")
(no-longer-administrator . "a regular user again")
(you-are-now . "Ok, you are now running as %#1s.\n")
......@@ -613,14 +615,14 @@ Mark the envelope with \"LysKOM bug report\"\n\n")
;; The format of this function should coincide with the format of the
;; lyskom-text-start variable. DONT change one without changing the other.
(time-yyyy-mm-dd-hh-mm . "%4#1d-%02#2d-%02#3d %02#4d:%02#5d")
; used by lyskom-print-time
(time-y-m-d-h-m . "%4#1d %02#3d/%02#1d %02#4d:%02#5d ")
(today-time-format-string . "%#6s %02#4d:%02#5d")
(yesterday-time-format-string . "%#6s %02#4d:%02#5d")
(today . "today")
(yesterday . "yesterday")
; used by lyskom-return-time
(time-yyyy-mm-dd-hh-mm . "%4#1d %02#3d/%02#2d %02#4d:%02#5d")
(no-such-text-no . "The article doesn't exist. (%#1n)\n")
(head-Subject . "Subject: ")
......@@ -1013,6 +1015,7 @@ Using %#6D from %#3s\n")
(kom-edit-options "Change options")
(kom-save-options "Save options")
(kom-shutdown-server "Shut down (server)")
(kom-sync-database "Save (the) database")
(kom-enable-adm-caps "Become administrator")
(kom-disable-adm-caps "Become (normal) user")
(kom-set-motd "Change login message")
......
......@@ -786,13 +786,13 @@ If NOERROR is non-nil, return nil instead of signaling an error."
(setq lyskom-filter-list
(append
(setq kom-permanent-filter-list (nreverse xpermanent-list))
(setq kom-session-filter-list (nreverse xtemporary-list))))))
(setq kom-session-filter-list (nreverse xtemporary-list))))
(setq filter-edit-change-flag nil)
(lyskom-message "%s" (lyskom-get-string 'filter-edit-saving))
(lyskom-save-options lyskom-buffer
(lyskom-get-string 'filter-edit-saving)
(lyskom-get-string 'filter-edit-saving-done)
(lyskom-get-string 'filter-edit-saving-error)))
(lyskom-get-string 'filter-edit-saving-error)))))
(defun lyskom-filter-edit-revert ()
......
......@@ -53,6 +53,26 @@
(string-match "^lyskom-"
(symbol-name symbol)))))
(defun lyskom-Edit-options-modify (modfun)
(save-excursion
(let ((buffer-read-only nil) var pos)
(re-search-backward "^;; \\|\\`")
(forward-char 3)
(setq pos (point))
(save-restriction
(narrow-to-region pos (progn (end-of-line) (1- (point))))
(goto-char pos)
(setq var (read (current-buffer))))
(goto-char pos)
(forward-line 1)
(forward-char 1)
(save-excursion
(set var (funcall modfun var))
(if (boundp 'lyskom-buffer)
(set-buffer lyskom-buffer))
(set var (funcall modfun var)))
(kill-sexp 1)
(prin1 (symbol-value var) (current-buffer)))))
(defvar lyskom-options-text nil
"Text mass when reading options.")
......@@ -75,6 +95,8 @@
(let ((buf (current-buffer))
(curwin (current-window-configuration)))
(edit-options)
(fset 'Edit-options-modify
(symbol-function 'lyskom-Edit-options-modify))
(make-local-variable 'lyskom-buffer)
(make-local-variable 'lyskom-edit-return-to-configuration)
(setq lyskom-buffer buf)
......
No preview for this file type
......@@ -492,8 +492,14 @@ Args: KOM-QUEUE HANDLER LEVEL &rest DATA."
(lyskom-call kom-queue lyskom-ref-no handler data 'lyskom-parse-void)
(lyskom-send-packet kom-queue (lyskom-format-objects 42 level)))
;;; Call 43 is sync. That should not be done too often, so no
;;; function is written... Use 'kill -SIGUSR1' instead.
;;; Call 43 is sync. Starting with version 1.9 of lyskomd it is a
;;; privileged operation, so there is no harm in having the function
;;; easily available any more.
(defun initiate-sync (kom-queue handler &rest data)
"Sync the LysKOM datbase. This is a prioritized call."
(lyskom-call kom-queue lyskom-ref-no handler data 'lyskom-parse-void)
(lyskom-send-packet kom-queue (lyskom-format-objects 43)))
;;; Call 44 is shutdown. Use 'kill -HUP' instead.
......
......@@ -333,6 +333,17 @@ du har l\344st klart allting. Kom tillbaks senare.
(no-marked-texts-mark .
"Du har inga markerade inl\344gg med markeringen %#1d.\n")
;;; For later
(norhtward . "norrut")
(soutward . "sderut")
(permanent-sundown . "Solen kommer inte att g upp. Flytta %#1s!")
(permanent-sunup . "Solen kommer inte att g ned. Fytta %#1s!")
(sunup-soon . "Solen gr snart upp")
(sundown-recently . "Solen gick nyligen ned")
(after-sunset . "Solen har gtt ned")
(before-sunup . "Solen har inte gtt upp nnu")
(sun-is-up . "Solen r uppe")
;;;
(weekdays . ["s\366ndag" "m\345ndag" "tisdag" "onsdag" "torsdag"
"fredag" "l\366rdag" "s\366ndag"])
(time-is . "Det \344r %#1s %#2s(enligt servern).")
......@@ -380,6 +391,7 @@ i svensk datorhistoria. L\344s mer p\345 http://www.lysator.liu.se/history/")
(conf-for-status . "Vilket m\366te vill du se statusen f\366r? ")
(no-such-conf . "M\366tet finns ej.\n")
(status-record . "Status f\366r m\366te %#1M (%#2m) %#3s\n\n")
(change-type-prompt . "\304ndra m\366testyp f\366r m\366te %#1M (%#2m) %#3s\n")
(Mailbox . "Brevl\345da")
(Protected . "Skyddat")
(no-comments . "original")
......@@ -549,6 +561,8 @@ M\344rk kuvertet \"LysKOM buggrapport f\366r elispklienten\".\n\n")
(really-shutdown . "\304r du s\344ker p\345 att du vill st\344nga av servern? ")
(closing-server . "St\344nga av servern...")
(really-sync . "\304r du s\344ker p\345 att du vill spara databasen? ")
(syncing-server . "Spara databasen...")
(administrator . "administrat\366r")
(no-longer-administrator . "en normal anv\344ndare igen")
(you-are-now . "Ok, du k\366r nu som %#1s.\n")
......@@ -628,14 +642,15 @@ M\344rk kuvertet \"LysKOM buggrapport f\366r elispklienten\".\n\n")
;; The format of this function should coincide with the format of the
;; lyskom-text-start variable. DONT change one without changing the other.
(time-yyyy-mm-dd-hh-mm . "%4#1d-%02#2d-%02#3d %02#4d:%02#5d")
; used by lyskom-print-time
(time-y-m-d-h-m . "%4#1d-%02#2d-%02#3d %02#4d:%02#5d ")
(today-time-format-string . "%#6s %02#4d:%02#5d")
(yesterday-time-format-string . "%#6s %02#4d:%02#5d")
(today . "idag")
(yesterday . "ig\345r")
; used by lyskom-return-time
(time-yyyy-mm-dd-hh-mm . "%4#1d-%02#2d-%02#3d %02#4d:%02#5d")
(no-such-text-no . "Det finns ingen s\345dan text. (%#1n)\n")
(head-Subject . "\304rende: ")
......@@ -1038,6 +1053,7 @@ K\366r %#6D fr\345n %#3s\n")
(kom-edit-options "\304ndra variabler")
(kom-save-options "Spara variabler")
(kom-shutdown-server "St\344ng av servern")
(kom-sync-database "Spara databasen")
(kom-enable-adm-caps "\326verg\345 till administrat\366rsmod")
(kom-disable-adm-caps "\326verg\345 till normalmod")
(kom-set-motd "S\344tt loginmeddelande")
......
......@@ -1191,7 +1191,8 @@ the value of kom-tell-phrases for fun.")
(defconst lyskom-admin-removed-commands
'(kom-enable-adm-caps))
(defconst lyskom-noadmin-removed-commands
'(kom-disable-adm-caps kom-remove-motd kom-set-motd kom-shutdown-server))
'(kom-disable-adm-caps kom-remove-motd kom-set-motd kom-shutdown-server
kom-sync-database))
;;; ================================================================
......
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