Commit 2c082b72 authored by David Byers's avatar David Byers
Browse files

First complete implementation of kom-become-anonymous

parent 65d4d30f
1999-10-13 David Byers <davby@ida.liu.se>
* command.el (lyskom-end-of-command): Don't do user-active when
we're anonymous.
* swedish-strings.el, english-strings.el (kom-tell-phrases): Tog
bort kom-tell-is-anonymous
* language.el (lyskom-tell-string): Print the missing tell key.
* cache.el (lyskom-tell-server): Don't tell server if we're
anonymous.
* commands2.el (kom-become-anonymous): Ny funktion.
(kom-become-nonanonymous): Ny funktion.
* lyskom-rest.el (lyskom-format-prompt): Make %a work in prompt
formats.
* completing-read.el (lyskom-read-conf-internal): Don't try to get
completion for all confs.
......
......@@ -490,15 +490,14 @@ CACHE is the name of the variable that points to the cache."
(defun lyskom-tell-server (string)
"Tell the server what the user is doing. Args: STRING."
(when lyskom-is-anonymous
(setq string (lyskom-tell-string 'kom-tell-is-being-anonymous)))
(save-excursion
(when lyskom-buffer
(set-buffer lyskom-buffer))
(cond
((equal string lyskom-what-i-am-doing))
(t
(setq lyskom-what-i-am-doing string)
(initiate-change-what-i-am-doing 'background nil string)))))
(unless lyskom-is-anonymous
(save-excursion
(when lyskom-buffer
(set-buffer lyskom-buffer))
(cond
((equal string lyskom-what-i-am-doing))
(t
(setq lyskom-what-i-am-doing string)
(initiate-change-what-i-am-doing 'background nil string))))))
(provide 'lyskom-cache)
......@@ -318,9 +318,10 @@ chosen according to this"
(lyskom-set-last-viewed))
(lyskom-prefetch-and-print-prompt)
(run-hooks 'lyskom-after-command-hook)
(if (lyskom-have-feature idle-time)
(save-excursion (set-buffer lyskom-buffer)
(initiate-user-active 'background nil)))
(when (and (lyskom-have-feature idle-time)
(not lyskom-is-anonymous))
(save-excursion (set-buffer lyskom-buffer)
(initiate-user-active 'background nil)))
(if kom-inhibit-typeahead
(discard-input))
;; lyskom-pending-commands should probably be a queue or a stack.
......
......@@ -1803,6 +1803,32 @@ Return-value: 'no-session if there is no suitable session to switch to
(lyskom-run 'main 'lyskom-end-of-command)))
;;;============================================================
;;; Bli anonym
(def-kom-command kom-become-anonymous ()
"Become pseudo-anonymous"
(interactive)
(if lyskom-is-anonymous
(lyskom-insert 'you-are-already-anonymous)
; (initiate-pepsi 'main nil 0)
(setq lyskom-is-anonymous t)
(lyskom-tell-server kom-mercial)
(lyskom-insert 'you-are-anonymous)
(lyskom-update-prompt t)))
(def-kom-command kom-become-nonanonymous ()
"Leave pseudo-anonymous mode"
(interactive)
(if lyskom-is-anonymous
(progn (when (and lyskom-current-conf
(not (zerop lyskom-current-conf)))
(initiate-pepsi 'main nil lyskom-current-conf))
(setq lyskom-is-anonymous nil)
(lyskom-update-prompt t)
(lyskom-insert 'you-are-nonanonymous))
(lyskom-insert 'you-are-already-nonanonymous)))
;;;============================================================
;;; ndra mtestyp (kom-change-conf-type)
;;;
......
......@@ -1587,6 +1587,8 @@ Point must be located on the line where the subject is."
(lyskom-edit-mode 1)
;++MINOR (setq mode-name lyskom-edit-mode-name)
(sit-for 0))
(is-anonymous
(lyskom-format-insert-before-prompt 'text-created-anonymous text-no))
(t
(lyskom-insert-before-prompt
(lyskom-format 'text-created text-no))
......
......@@ -508,6 +508,7 @@ Read all about it at http://www.lysator.liu.se/history/")
(supervisor-is-no-name . "Supervisor: %30#1p %#3s(%#2P)\n")
(presentation-no . "Presentation: %25#1n\n")
(conf-has-motd . "\n%#1M has a notice on his/her mailbox:\n")
(conf-mship-priority . "Prioritet: %25#1n%#2?b%[ %#2s%]%[%]\n")
(status-conf-generic . "%-40#1s %#2s\n")
(Everybody . "Everyone")
......@@ -1049,6 +1050,10 @@ Error message: %#1s**************************************************")
(footnote-prefix . "[Ff]")
(by . " by %#1P")
(text-created . "Text %#1n has been created.\n")
(text-created-anonymous . "\
Text %#1n has been created (anonymously). To make it more difficult
for others to figure out that you wrote the text, you should wait a while
before reading it.\n")
(resolve-session . "Which session: ")
......@@ -1354,6 +1359,11 @@ You must become an active member of the conference to enter it.\n")
(mail-headers-for . "Mail headers for text %#1n:\n")
(email-name-prefix . "")
(email-name-suffix . "")
(you-are-anonymous . "You are now somewhat anonymous.\n")
(you-are-nonanonymous . "You are no longer anonymous.\n")
(you-are-already-anonymous . "You are already somewhat anonymous.\n")
(you-are-already-nonanonymous . "You are alreay non-anonymous.\n")
))
......@@ -1508,6 +1518,9 @@ You must become an active member of the conference to enter it.\n")
(kom-add-private-answer . "Request private reply")
(kom-add-request-confirm . "Request confirmation of reading")
(kom-review-mail-headers . "Review mail headers")
(kom-become-anonymous . "Become anonymous")
(kom-become-nonanonymous . "Become non-anonymous (come forth into the light)")
))
(lyskom-language-var lyskom-language-codes en
......@@ -2050,9 +2063,11 @@ Select whether to execute command or keyboard macro.")
(turned-off . "Turned off ")
(number-of-times . "A few times")
(specific-spec . "Per mottager/avsndare")
(sound-file . "Audio file")
(selected-mark . "Mark ")
(conf-or-person . "Person eller mte")
(ask . "Ask every time ")
(before . "Before the text")
......@@ -2744,6 +2759,15 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
When this is on, the date and time is shown on all personal, group and
alarm messages.")
(kom-w3-simplify-body-doc . "\
When this is on, the client will ignore colors set in the HTML body when
displaying formatted HTML.")
(kom-mercial-doc . "\
This text is shown in the list of users when you have finished reading
everything.")
(kom-ding-on-no-subject-doc . "")
(kom-ding-on-personal-messages-doc . "")
......@@ -3030,8 +3054,7 @@ be saved in the server. Otherwise it will be saved in your .emacs.")
(kom-tell-review . "Is reviewing.")
(kom-tell-change-name . "Takes on a new name.")
(kom-tell-change-supervisor . "Changes the supervisor of something.")
(kom-tell-next-lyskom . "Moves to a different LysKOM.")
(kom-tell-is-anonymous . "Being secretive")))
(kom-tell-next-lyskom . "Moves to a different LysKOM.")))
(if (and (boundp 'kom-tell-phrases)
kom-tell-phrases)
......
......@@ -169,7 +169,8 @@ create. ALIST is a mapping from symbols to strings."
assoc list."
(condition-case nil
(lyskom-get-string key 'kom-tell-phrases)
(lyskom-internal-error (message "Bad kom-tell-phrases") "")))
(lyskom-internal-error (message "Bad kom-tell-phrases: missing %s" key)
"")))
(defsubst lyskom-get-string-internal (symbol category)
(cdr (assq lyskom-language (get symbol category))))
......
......@@ -568,7 +568,8 @@ Args: CONF-STAT READ-INFO"
(lyskom-run-hook-with-args 'lyskom-change-conf-hook
lyskom-current-conf
(conf-stat->conf-no conf-stat))
(initiate-pepsi 'main nil (conf-stat->conf-no conf-stat))
(unless lyskom-is-anonymous
(initiate-pepsi 'main nil (conf-stat->conf-no conf-stat)))
(setq lyskom-current-conf (conf-stat->conf-no conf-stat))
(let ((num-unread (text-list->length (read-info->text-list read-info))))
(lyskom-format-insert (if (not kom-print-number-of-unread-on-entrance)
......@@ -809,6 +810,7 @@ scrolling past lyskom-last-viewed (generally the most recent prompt.)
Leaves the point at the end of the window if not possible. If buffer
is not on screen then doesn't move point.
The text is converted according to the value of kom-emacs-knows-iso-8859-1."
(when (symbolp string) (setq string (lyskom-get-string string)))
(let ((was-at-max (= (save-excursion (end-of-line) (point)) (point-max))))
(save-excursion
(goto-char (point-max))
......@@ -2417,7 +2419,7 @@ Set lyskom-current-prompt accordingly. Tell server what I am doing."
(format-letter nil)
(messages (length lyskom-ansaphone-messages)))
(while (< start len)
(setq tmp (string-match "%[][cm Sswp#]" fmt start))
(setq tmp (string-match "%[][cm Sswp#aA]" fmt start))
(if tmp
(progn
(if (> tmp start)
......
......@@ -112,27 +112,11 @@ only recomputed if the window width changes."
(setq lp--last-format-string
(concat "%#1c %=3#2s %#9c %=-" (number-to-string total)
"#3M %=-12#4s %=5#5s %[%#10@%#6c%]%[%#11@%#7c%]%[%#12@%#8c%]")))))
(defun lp--find-unread (conf-no)
"Return the number of unread texts in CONF-NO.
If this function is unable to calculate the number of unread texts it will
return nil."
(save-excursion
(set-buffer lyskom-buffer)
(let ((rlist (read-list->all-entries lyskom-to-do-list))
(found nil))
(while (and (not found) rlist)
(when (eq conf-no (conf-stat->conf-no
(read-info->conf-stat (car rlist))))
(setq found (length (cdr (read-info->text-list (car rlist))))))
(setq rlist (cdr rlist)))
found)))
(defun lp--format-entry (entry)
"Format ENTRY for insertion in a buffer.
Returns a string suitable for insertion in a membership list."
(let ((un (lp--find-unread (membership->conf-no
(let ((un (lyskom-find-unread (membership->conf-no
(lp--entry->membership entry))))
(conf-stat (blocking-do 'get-conf-stat
(membership->conf-no
......
......@@ -51,59 +51,60 @@
(defvar lyskom-customize-buffer-format
'("\n"
; (lyskom bold centered)
; "\n\n"
; lyskom-doc
; "\n\n"
; [kom-customize-format]
; "\n\n"
; section
; (look-and-feel-misc bold centered)
; section
; "\n"
; [kom-default-language]
; [kom-show-namedays]
; [kom-show-week-number]
; "\n"
; [kom-idle-hide]
; [kom-show-where-and-what]
; [kom-show-since-and-when]
; "\n"
; [kom-friends]
; "\n"
; [kom-presence-messages]
; [kom-presence-messages-in-buffer]
; "\n"
; [kom-page-before-command]
; [kom-agree-text]
; "\n\n"
; section
; (window-locations bold centered)
; section
; "\n"
; (windows-where bold centered)
; "\n"
; windows-doc
; "\n\n"
; [kom-customize-in-window]
; [kom-edit-filters-in-window]
; [kom-prioritize-in-window]
; [kom-list-membership-in-window]
; [kom-write-texts-in-window]
; [kom-view-commented-in-window]
; [kom-personal-messages-in-window]
;
; "\n\n"
; section
; (audio-cues bold centered)
; section
; "\n"
; [kom-audio-player]
; "\n"
; (audio-cues-when bold centered)
; "\n"
; audio-cues-doc
; "\n\n"
(lyskom bold centered)
"\n\n"
lyskom-doc
"\n\n"
[kom-customize-format]
"\n\n"
section
(look-and-feel-misc bold centered)
section
"\n"
[kom-default-language]
[kom-show-namedays]
[kom-show-week-number]
"\n"
[kom-idle-hide]
[kom-show-where-and-what]
[kom-show-since-and-when]
"\n"
[kom-friends]
"\n"
[kom-presence-messages]
[kom-presence-messages-in-buffer]
"\n"
[kom-page-before-command]
[kom-agree-text]
[kom-mercial]
"\n\n"
section
(window-locations bold centered)
section
"\n"
(windows-where bold centered)
"\n"
windows-doc
"\n\n"
[kom-customize-in-window]
[kom-edit-filters-in-window]
[kom-prioritize-in-window]
[kom-list-membership-in-window]
[kom-write-texts-in-window]
[kom-view-commented-in-window]
[kom-personal-messages-in-window]
"\n\n"
section
(audio-cues bold centered)
section
"\n"
[kom-audio-player]
"\n"
(audio-cues-when bold centered)
"\n"
audio-cues-doc
"\n\n"
[kom-ding-on-priority-break]
[kom-ding-on-new-letter]
[kom-ding-on-wait-done]
......@@ -111,102 +112,103 @@
[kom-ding-on-common-messages]
[kom-ding-on-group-messages]
[kom-ding-on-personal-messages]
; [kom-silent-ansaphone]
; "\n\n"
; section
; (reading bold centered)
; section
; "\n"
; [kom-default-session-priority]
; [kom-print-number-of-unread-on-entrance]
; [kom-allow-incompleteness]
; [kom-created-texts-are-read]
; [kom-higher-priority-breaks]
; [kom-review-priority]
; [kom-show-footnotes-immediately]
; [kom-follow-comments-outside-membership]
; "\n"
; [kom-default-mark]
; [kom-membership-default-priority]
; [kom-membership-default-placement]
; [kom-unsubscribe-makes-passive]
; [kom-postpone-default]
; "\n"
; [kom-autowrap]
; [kom-show-author-at-end]
; [kom-show-creating-software]
; [kom-show-imported-importer]
; [kom-show-imported-external-recipients]
; [kom-show-imported-envelope-sender]
; [kom-smileys]
; "\n"
; [kom-dashed-lines]
; [kom-long-lines]
; [kom-text-footer-format]
; [kom-text-header-dash-length]
; [kom-text-footer-dash-length]
; "\n"
; [kom-truncate-threshold]
; [kom-truncate-show-lines]
; "\n"
; [kom-ignore-message-senders]
; [kom-ignore-message-recipients]
; [kom-show-personal-message-date]
; "\n\n"
; section
; (writing bold centered)
; section
; "\n"
; [kom-cite-string]
; [kom-ispell-dictionary]
; "\n"
; sending-doc
; "\n\n"
; [kom-confirm-multiple-recipients]
; [kom-check-commented-author-membership]
; [kom-check-for-new-comments]
;
; "\n\n"
; section
; (urls bold centered)
; section
; "\n"
; [kom-url-viewer-preferences]
; [kom-mosaic-command]
; [kom-netscape-command]
;
; "\n\n"
; section
; (personal-messages bold centered)
; section
; "\n"
; [kom-show-personal-messages-in-buffer]
; [kom-pop-personal-messages]
; [kom-default-message-recipient]
; "\n"
; (automatic-replies bold centered)
; "\n"
; [kom-ansaphone-record-messages]
; [kom-ansaphone-show-messages]
; "\n"
; [kom-ansaphone-default-reply]
;
; "\n\n"
; section
; (remote-control bold centered)
; section
; "\n"
; [kom-remote-control]
; [kom-self-control]
; "\n"
; [kom-remote-controllers]
; "\n\n"
; section
; (hooks bold centered)
; section
; "\n"
; [kom-login-hook]
; [kom-do-when-done]
[kom-silent-ansaphone]
"\n\n"
section
(reading bold centered)
section
"\n"
[kom-default-session-priority]
[kom-print-number-of-unread-on-entrance]
[kom-allow-incompleteness]
[kom-created-texts-are-read]
[kom-higher-priority-breaks]
[kom-review-priority]
[kom-show-footnotes-immediately]
[kom-follow-comments-outside-membership]
"\n"
[kom-default-mark]
[kom-membership-default-priority]
[kom-membership-default-placement]
[kom-unsubscribe-makes-passive]
[kom-postpone-default]
"\n"
[kom-autowrap]
[kom-show-author-at-end]
[kom-show-creating-software]
[kom-show-imported-importer]
[kom-show-imported-external-recipients]
[kom-show-imported-envelope-sender]
[kom-smileys]
[kom-w3-simplify-body]
"\n"
[kom-dashed-lines]
[kom-long-lines]
[kom-text-footer-format]
[kom-text-header-dash-length]
[kom-text-footer-dash-length]
"\n"
[kom-truncate-threshold]
[kom-truncate-show-lines]
"\n"
[kom-ignore-message-senders]
[kom-ignore-message-recipients]
[kom-show-personal-message-date]
"\n\n"
section
(writing bold centered)
section
"\n"
[kom-cite-string]
[kom-ispell-dictionary]
"\n"
sending-doc
"\n\n"
[kom-confirm-multiple-recipients]
[kom-check-commented-author-membership]
[kom-check-for-new-comments]
"\n\n"
section
(urls bold centered)
section
"\n"
[kom-url-viewer-preferences]
[kom-mosaic-command]
[kom-netscape-command]
"\n\n"
section
(personal-messages bold centered)
section
"\n"
[kom-show-personal-messages-in-buffer]
[kom-pop-personal-messages]
[kom-default-message-recipient]
"\n"
(automatic-replies bold centered)
"\n"
[kom-ansaphone-record-messages]
[kom-ansaphone-show-messages]
"\n"
[kom-ansaphone-default-reply]
"\n\n"
section
(remote-control bold centered)
section
"\n"
[kom-remote-control]
[kom-self-control]
"\n"
[kom-remote-controllers]
"\n\n"
section
(hooks bold centered)
section
"\n"
[kom-login-hook]
[kom-do-when-done]
))
;;; ======================================================================
......@@ -597,6 +599,8 @@ customize buffer but do not save them to the server."
(kom-text-header-dash-length (number))
(kom-text-footer-dash-length (number))
(kom-show-personal-message-date (toggle (on off)))
(kom-mercial (string))
(kom-w3-simplify-body (toggle (on off)))
))
(defvar lyskom-widget-functions
......
......@@ -1059,6 +1059,10 @@ Felmeddelande: %#1s**************************************************")
(by . " av %#1P")
(text-created . "Text nummer %#1n r skapad.\n")
(text-created-anonymous . "\
Text nummer %#1n r skapad (anonymt). Fr att gra det svrare fr
andra att ta reda p att du skapade inlgget br du vnta ett tag med
att lsa det.\n")
(resolve-session . "Ange vilken session: ")
......@@ -1364,6 +1368,11 @@ Du m
(mail-headers-for . "Brevhuvud fr inlgg %#1n:\n")
(email-name-prefix . "")
(email-name-suffix . "")
(you-are-anonymous . "Du r nu ngorlunda anonym.\n")
(you-are-nonanonymous . "Du r inte lngre anonym.\n")
(you-are-already-anonymous . "Du r redan ngorlunda anonym.\n")
(you-are-already-nonanonymous . "Du r redan icke-anonym.\n")
))
......@@ -1522,6 +1531,8 @@ Du m
(kom-add-request-confirm . "Begr lsbekrftelse")
(kom-review-mail-headers . "terse brevhuvud")
(kom-become-anonymous . "Bli anonym")
(kom-become-nonanonymous . "Bli icke-anonym (trd fram ur skuggorna)")
))
(lyskom-language-var lyskom-language-codes sv
......@@ -2100,7 +2111,7 @@ Du m
(ask . "Frga varje gng")
(before . "Fre texten")
(after . "Efter texten")
(fist . "Frst")
(first . "Frst")
(last . "Sist ")
(depth-first . "I kommentarsordning")
(time-order . "I tidsordning")
......@@ -2801,6 +2812,12 @@ i servern. Annars sparas det i din .emacs.")
Nr detta r pslaget s visas datum och klockslag fr alla personliga,
grupp och alarmmeddelanden.")
(kom-w3-simplify-body-doc . "\
Nr detta r pslaget s visas HTML utan de frger som anges i HTML-koden.")
(kom-mercial-doc . "\
Denna text visas i vilkalistan d du har lst frdigt alla mten.")
(kom-ding-on-no-subject-doc . "")
(kom-ding-on-personal-messages-doc . "")
(kom-ding-on-group-messages-doc . "")
......@@ -2951,6 +2968,8 @@ i servern. Annars sparas det i din .emacs.")
(kom-text-footer-dash-length-tag . "Inlggsfotens lngd")
(kom-text-header-dash-length-tag . "Lngden p linjen ovanfr inlggstexten")
(kom-show-personal-message-date-tag . "Visa datum fr alla meddelanden")
(kom-w3-simplify-body-tag . "Visa HTML utan standardfrger")
(kom-mercial-tag . "Text nr allt r utlst")
)
)
......@@ -3089,8 +3108,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-tell-review . "terser.")
(kom-tell-change-name . "ndrar sitt namn till ngot annat.")
(kom-tell-change-supervisor . "ndrar organisatr fr ngot.")
(kom-tell-next-lyskom . "Hoppar till ett annat LysKOM.")
(kom-tell-is-anonymous . "r hemlighetsfull")))