Commit 4a3bfa04 authored by David Byers's avatar David Byers
Browse files

Nya hookar i lyskom-send-message

parent 15eb799b
Wed Aug 14 13:19:06 1996 David Byers <>
* swedish-strings.el,english-strings.el (lyskom-strings): Lade
till send-empty-message-p
* (lyskom-send-message-setup-hook): Ny variabel.
(lyskom-send-message-exit-hook): Ny variabel.
(lyskom-send-message-hook): Nu variabel.
* commands2.el (lyskom-send-message): Anropa
lyskom-send-message-setup-hook fre lsning av meddelande och
lyskom-send-message-exit-hook eftert.
lyskom-send-message-exit-hook eftert, Bytte variabelnamn,
omstrukturerade funktionen, anropa lyskom-send-message-hook.
(lyskom-send-message-auto-fill): Ny funktion.
(lyskom-send-message-resize-minibuffer): Ny funktion.
(lyskom-send-message-turn-off-resize-on-exit): Ny funktion.
......@@ -453,41 +453,76 @@ otherwise: the conference is read with lyskom-completing-read."
(lyskom-send-message 0 message))
(defun lyskom-send-message (pers-no message &optional dontshow)
(defvar lyskom-message-recipient)
(defvar lyskom-message-string)
(defun lyskom-send-message (pers-no
message &optional dontshow)
"Send a message to the person with the number PERS-NO. PERS-NO == 0
means send the message to everybody. MESSAGE is the message to
send. If DONTSHOW is non-nil, don't display the sent message."
(let* ((minibuffer-setup-hook minibuffer-setup-hook)
(minibuffer-exit-hook minibuffer-exit-hook)
(tmp (add-hook 'minibuffer-setup-hook
(lambda () (run-hooks
(tmp (add-hook 'minibuffer-exit-hook
(lambda () (run-hooks
(string (or message
(lyskom-read-string (lyskom-get-string 'message-prompt))))
(reply (blocking-do 'send-message pers-no string))
(to-conf-stat (if (zerop pers-no)
(blocking-do 'get-conf-stat pers-no))))
(if reply
(if (not dontshow)
(if to-conf-stat
(lyskom-format 'message-sent-to-user
string to-conf-stat)
(lyskom-format 'message-sent-to-all string))
(lyskom-format-insert-before-prompt 'message-nope
(or to-conf-stat
(lyskom-get-string 'everybody))
string)) ;+++ lyskom-errno
(lyskom-message-string nil)
(reply nil)
(lyskom-message-recipient nil))
(add-hook 'minibuffer-setup-hook
(lambda () (run-hooks
(add-hook 'minibuffer-exit-hook
(lambda () (run-hooks
(setq lyskom-message-string
(or message
(lyskom-read-string (lyskom-get-string 'message-prompt))))
(setq lyskom-message-recipient (if (zerop pers-no)
(blocking-do 'get-conf-stat
(run-hooks 'lyskom-send-message-hook)
(if lyskom-message-string
(setq reply (blocking-do 'send-message pers-no
(if reply
(if (not dontshow)
(if lyskom-message-recipient
(lyskom-format 'message-sent-to-user
(lyskom-format 'message-sent-to-all
(or lyskom-message-recipient
(lyskom-get-string 'everybody))
(lyskom-insert-string 'interrupted)) ;+++ lyskom-errno
(defun lyskom-send-message-trim-newlines ()
(let ((size (length lyskom-message-string)))
(while (and (> size 0)
(eq ?\n (aref lyskom-message-string (1- size))))
(setq size (1- size)))
(cond ((and (eq size 0)
(not (lyskom-j-or-n-p (lyskom-get-string
(setq lyskom-message-string nil))
((eq size 0)
(setq lyskom-message-string ""))
(t (setq lyskom-message-string (substring lyskom-message-string
0 size))))))
(defun lyskom-send-message-turn-off-resize-on-exit ()
(resize-minibuffer-mode -1)
(remove-hook 'lyskom-send-message-exit-hook
......@@ -446,6 +446,7 @@ Read all about it at")
(pers-membership-line . "%#1s%#2s%#3M\n")
(is-supervisor-mark . "O ")
(who-to-send-message-to . "Send message to whom? (%s) ")
(send-empty-message-p . "The message is empty. Send it anyway? ")
(his-total-unread . "\n%#1M has a total of %#2d unread articles.\n")
(message-prompt . "Message: ")
(message-sent-to-user .
......@@ -458,6 +458,7 @@ i svensk datorhistoria. L\344s mer p\345")
(pers-membership-line . "%#1s%#2s%#3M\n")
(is-supervisor-mark . "O ")
(who-to-send-message-to . "Vem vill du skicka meddelandet till? (%s) ")
(send-empty-message-p . "Meddelandet \344r tomt. Vill du \344nd\345 skicka det? ")
(his-total-unread . "\n%#1M har totalt %#2d ol\344sta.\n")
(message-prompt . "Meddelande: ")
(message-sent-to-user .
......@@ -194,6 +194,16 @@ tree.
This variable is stored in the LysKOM server.")
(defvar lyskom-send-message-hook '(lyskom-send-message-trim-newlines)
"*Hook that is called before a personal, group or common message is sent.
When called, lyskom-message-string is bound to the message that will be sent
and lyskom-message-recipient to the conf-stat of the recipient or nil if
the recipient does not exist or if the message is a common message.
If lyskom-message-string is set to nil by a hook, the message will not
be sent.")
(defvar lyskom-send-message-setup-hook nil
"*Hook that is called when the minibuffer is entered to read a message.")
Supports Markdown
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