diff --git a/src/ChangeLog b/src/ChangeLog index 0d8a225c66b440a085e6582200486e70b89da146..867593f4fcf7a046f511fa8e32f1a6465b3ef267 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +Sun Sep 29 04:26:52 1991 Per Cederqvist (ceder at ruben) + + * vars.el (kom-show-personal-message-in-buffer, + kom-pop-personal-message, kom-ding-on-personal-messages, + lyskom-personal-messages-hook): added. + + * async.el (lyskom-insert-personal-message): Beeps only if + kom-ding-on-personal-messages is non-nil. + + * async.el (lyskom-insert-personal-message): Pops to the buffer if + kom-pop-personal-message is set. + + * async.el (lyskom-insert-personal-message): Created. Does the + acual job that lyskom-show-personal-message used to do. + + * async.el (lyskom-show-personal-message): Run + lyskom-personal-message-hook when a message arrives. + + * async.el (lyskom-show-personal-message): Insert the message in + the normal buffer, or a special buffer, or not at all depending + on how kom-show-personal-messages-in-buffer is set. + Sat Sep 28 21:33:38 1991 Per Cederqvist (ceder at ruben) * async.el (lyskom-parse-async): Removed the "info" backdoor. diff --git a/src/async.el b/src/async.el index 5a1504cbef4b6420e63c69633a4f0493971bee35..0dbff00d0c28815641c65016b3d65a81bce5b41e 100644 --- a/src/async.el +++ b/src/async.el @@ -263,9 +263,33 @@ Args: SENDER: conf-stat for the person issuing the broadcast message or a RECIPIENT: 0 if this message is for everybody, otherwise the pers-no of the user. MESSAGE: A string containing the message." - (lyskom-insert-before-prompt + (cond + ((eq kom-show-personal-messages-in-buffer t) + (lyskom-insert-personal-message sender recipient message + 'lyskom-insert-before-prompt)) + ((null kom-show-personal-messages-in-buffer)) + (t + (lyskom-save-excursion + (set-buffer (get-buffer-create kom-show-personal-messages-in-buffer)) + (goto-char (point-max)) + (lyskom-insert-personal-message sender recipient message 'insert)))) + (run-hooks 'lyskom-personal-message-hook)) + +(defun lyskom-insert-personal-message (sender recipient message + insert-function) + "Insert a personal message in the current buffer. +Arguments: SENDER RECIPIENT MESSAGE INSERT-FUNCTION. +SENDER is a pers-stat (possibly nil) or a string. +RECIPIENT is 0 if the message is public, otherwise the pers-no of the user. +MESSAGE is a string containing the message. +INSERT-FUNCTION is a function that given a string inserts it into the +current buffer." + + (funcall + insert-function "\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n") - (lyskom-insert-before-prompt + (funcall + insert-function (if (= recipient 0) (lyskom-format 'message-broadcast (cond @@ -281,9 +305,12 @@ Args: SENDER: conf-stat for the person issuing the broadcast message or a (t (lyskom-get-string 'unknown))) message (substring (current-time-string) 11 19)))) - (lyskom-insert-before-prompt + (funcall insert-function "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n") - (beep)) + (if kom-pop-personal-messages + (pop-to-buffer (current-buffer))) + (if kom-ding-on-personal-messages + (beep))) ;;; ================================================================ diff --git a/src/vars.el b/src/vars.el index 169fbe46c74ffe732ea9f1db78465e33992a19d0..7dcf84158dc5cb812d33dfcedc8b99e9427d9c5b 100644 --- a/src/vars.el +++ b/src/vars.el @@ -151,7 +151,20 @@ otherwise => the new conf is entered after all conferences.") (defvar lyskom-prompt-executing-default-command-text ". " "*Text to end the prompt while the default-commands is executing.") +(defvar kom-show-personal-messages-in-buffer t + "*Buffer to show personal messages in. +If nil, discard them. +If t, insert them in the *kom* buffert. +If non-nil and non-t this should be a buffer or a name of a (possibly +nonexistent) buffer in which the message is inserted.") +(defvar kom-pop-personal-messages nil + "*Non-nil means pop up a buffer with personal messages as they arrive. +kom-show-personal-messages-in-buffer decides which buffer to pop.") + +(defvar kom-ding-on-personal-messages t + "*Non-nil means ding as personal messages arrive. +Non-nil and non-t means only ding when they really are personal.") (defconst lyskom-elisp-variables '( kom-do-when-done @@ -422,6 +435,14 @@ The hook is run with current-buffer the lyskom buffer, not the who-info-buffer." "*Hook to run when we have logged in. Other purposes than kom-do-when-starting. This could be set in the user-area.") +(defvar lyskom-personal-message-hook nil + "*Hook to run when a personal message is received. +When the hook is run 'sender' is bound to the pers-stat of the sender +of the message (or possibly nil), 'recipient' is 0 if the message is a +public message and otherwise the pers-no of the user, and 'message' is +a string that holds the message.") + + (defvar lyskom-executing-command t "Non-nil means the client is executing a command. Most commands can't be interrupted by another command.")