Skip to content
Snippets Groups Projects
Commit 35af28db authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Better handling of personal messages.

parent 24785781
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -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)))
;;; ================================================================
......
......@@ -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.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment