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

Support new recipient async message

parent 2b4c5b32
1999-06-14 David Byers <davby@ida.liu.se>
* parse.el (lyskom-parse-error): Removed message "bug i
lyskom-parse-error" since this would happen frequently when error
messages are sent to a client that has been restarted.
Handle new recipient async message
* async.el (lyskom-default-new-recipient-hook): New function.
(lyskom-async-new-recipient): New function.
(lyskom-parse-async): Handle new recipient message.
* view-text.el (lyskom-text-read-at-least-once-p): New optional
argument BG.
1999-06-13 David Byers <davby@ida.liu.se>
* commands2.el (kom-del-faq): New function.
......
......@@ -222,12 +222,19 @@ this function shall be with current-buffer the BUFFER."
(let ((text-no (lyskom-parse-num))
(conf-no (lyskom-parse-num))
(misc-type (lyskom-parse-num)))
(lyskom-save-excursion
(set-buffer buffer)
(cache-del-conf-stat conf-no)
(cache-del-text-stat text-no)
;; FIXME: Code here.
)))
(cond ((eq misc-type 0) (setq misc-type 'RECPT))
((eq misc-type 1) (setq misc-type 'CC-RECPT))
((eq misc-type 15) (setq misc-type 'BCC-RECPT)))
(when (symbolp misc-type)
(lyskom-save-excursion
(set-buffer buffer)
(cache-del-text-stat text-no)
(cache-del-conf-stat conf-no)
(initiate-get-text-stat 'follow
'lyskom-async-new-recipient
text-no
text-no conf-no misc-type)
))))
((eq msg-no 17) ; Deleted recipient
(let ((text-no (lyskom-parse-num))
......@@ -522,6 +529,54 @@ converted, before insertion."
(recenter -1))))))))))
;;; ================================================================
;;; New recipient
;;; The text stat and might have been cached and thus invalid. Check
;;; for this. The conf-stat for the conf-no is almost certainly
;;; invalid.
(defun lyskom-async-new-recipient (text-stat text-no conf-no misc-type)
"Handle a new recipient message"
;; Check if we are added. A new letter!
(when (and (eq conf-no lyskom-pers-no)
(not (eq (text-stat->author text-stat) lyskom-pers-no)))
(lyskom-beep kom-ding-on-new-letter))
;; If the text is read in another conference, mark it as read here too
;; unless the new recipient is the mailbox
(if (and (lyskom-text-read-at-least-once-p text-stat t)
(not (eq conf-no lyskom-pers-no)))
(initiate-mark-as-read 'follow
nil
conf-no
(list text-no))
;; Text is previously unread or in the mailbox
(let ((local-no nil))
(lyskom-traverse misc-info (text-stat->misc-info-list text-stat)
(when (and (eq (misc-info->type misc-info) misc-type)
(eq (misc-info->recipient-no misc-info) conf-no))
(setq local-no (misc-info->local-no misc-info))))
(if (null local-no) (error "No local no"))
(initiate-get-conf-stat 'async 'lyskom-add-new-text
conf-no
text-no
local-no)
(lyskom-prefetch-text-all text-no)
(lyskom-run 'async 'lyskom-default-new-recipient-hook text-stat)
(lyskom-run 'async 'lyskom-prefetch-and-print-prompt))))
(defun lyskom-default-new-recipient-hook (text-stat)
(when (and (not lyskom-dont-change-prompt) ;We shall change it
(not lyskom-executing-command)) ;We have time to do it.
(lyskom-update-prompt))
(run-hooks 'lyskom-new-recipient-hook))
;;; ================================================================
;;; Functions for dealing with a new or deleted text
......@@ -546,9 +601,7 @@ converted, before insertion."
(if (and (not lyskom-dont-change-prompt) ;We shall change it
(not lyskom-executing-command)) ;We have time to do it.
(lyskom-update-prompt))
(let ((no-message nil))
(run-hooks 'lyskom-deleted-text-hook)))
(run-hooks 'lyskom-deleted-text-hook))
(defun lyskom-async-new-text (text-stat)
"Take care of a message that a new text has been created."
......
......@@ -1081,9 +1081,8 @@ CALL-INFO is destructively changed to
(setq lyskom-pending-calls
(lyskom-assoc-dremove ref-no lyskom-pending-calls))
(lyskom-decrease-pending-calls)
(if call-info
(lyskom-tr-call-to-parsed call-info nil)
(lyskom-message "Bug i lyskom-parse-error"))
(when call-info
(lyskom-tr-call-to-parsed call-info nil))
(lyskom-check-call kom-queue))))
......
......@@ -530,7 +530,7 @@ Ditt meddelande till %#2M:
")
(message-sent-to-all
. "================================================================
Ditt allmnna meddelande ld:
Ditt alarmmeddelande ld:
%#1t
----------------------------------------------------------------
......@@ -802,7 +802,7 @@ upptagna. Logga ut och kom tillbaks senare om du v
(message-broadcast .
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Allmnt meddelande frn %#1P (%#3s):
Alarmmeddelande frn %#1P (%#3s):
%#2t
----------------------------------------------------------------
......@@ -2451,7 +2451,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-show-personal-messages-in-buffer-doc . "\
Denna instllning bestmmer var personliga meddelanden, gruppmeddelanden
och allmnna meddelanden visas. Meddelanden kan antingen visas i
och alarmmeddelanden visas. Meddelanden kan antingen visas i
LysKOM-bufferten, kastas bort helt eller visas i en namngiven buffert.")
......@@ -2645,7 +2645,7 @@ i servern. Annars sparas det i din .emacs.")
(kom-ding-on-new-letter-tag . "Nr det kommer brev: ")
(kom-ding-on-priority-break-tag . "Nr det kommer prioriterade inlgg:")
(kom-ding-on-wait-done-tag . "Nr man har vntat klart: ")
(kom-ding-on-common-messages-tag . "Vid allmnna meddelanden: ")
(kom-ding-on-common-messages-tag . "Vid alarmmeddelanden: ")
(kom-ding-on-group-messages-tag . "Vid gruppmeddelanden: ")
(kom-ding-on-personal-messages-tag . "Vid personliga meddelanden: ")
(kom-ding-on-no-subject-tag . "Nr renderad saknas: ")
......
......@@ -1546,9 +1546,15 @@ set the local variable no-message non-nil."
(def-kom-var lyskom-deleted-text-hook nil
"*Hook to run when a text is deleted.
This hook is run after the prompt is removed if it shall be changed but
before the new prompt is printed."
server)
(def-kom-var lyskom-new-recipient-hook nil
"*Hook to run when a text gains a new recipient.
This hook is run after the prompt is removed if it shall be changed but before
the text Text 4711 {r skapad! is printed in the message area. And before the
new prompt is printed."
the new prompt is printed. It is not run if the text has been marked as read
in any conference other than the person's letterbox."
server)
(def-kom-var lyskom-who-info-has-changed-hook nil
......
......@@ -388,9 +388,12 @@ recipients to it that the user is a member in."
res)))
(defun lyskom-text-read-at-least-once-p (text-stat)
(defun lyskom-text-read-at-least-once-p (text-stat &optional bg)
"Return t if TEXT-STAT has been marked as read in any of the recipients
the user is a member of. Uses blocking-do. Returns t if TEXT-STAT is nil."
the user is a member of. Uses blocking-do. Returns t if TEXT-STAT is nil.
If BG is non-nil, this function is run in the background and must not use
blocking-do."
(if text-stat
(let* ((misc-info-list (text-stat->misc-info-list text-stat))
(misc-item nil)
......@@ -405,8 +408,11 @@ the user is a member of. Uses blocking-do. Returns t if TEXT-STAT is nil."
(cond ((or (eq type 'RECPT)
(eq type 'BCC-RECPT)
(eq type 'CC-RECPT))
(setq membership (lyskom-get-membership
(misc-info->recipient-no misc-item)))
(setq membership (if bg
(lyskom-try-get-membership
(misc-info->recipient-no misc-item))
(lyskom-get-membership
(misc-info->recipient-no misc-item))))
(when membership
(setq is-member t)
(when (or (<= (misc-info->local-no misc-item)
......
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