diff --git a/src/ChangeLog b/src/ChangeLog index 834f698258280cdaec7bde3ff1c6ddd4b6357013..a3d1564f365786a03a13199f6f4ed7a169eb72ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +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. diff --git a/src/async.el b/src/async.el index c9ae7d0ed9848d8b17d318b88e5b63610aa21279..8cc9dfad60642abb4fbc8a246a2014b862c47ffc 100644 --- a/src/async.el +++ b/src/async.el @@ -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." diff --git a/src/parse.el b/src/parse.el index 24603bccab9f236dbf5ca0288c656bf636116a86..71e535333ec846a0823b21b38539175d36364667 100644 --- a/src/parse.el +++ b/src/parse.el @@ -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)))) diff --git a/src/swedish-strings.el b/src/swedish-strings.el index f5d08ab25909d99dc6356f37e2c0e7152bd54b4e..f091444adc0505fdd5299f25a917bfa5923a654e 100644 --- a/src/swedish-strings.el +++ b/src/swedish-strings.el @@ -530,7 +530,7 @@ Ditt meddelande till %#2M: ") (message-sent-to-all . "================================================================ -Ditt allm�nna meddelande l�d: +Ditt alarmmeddelande l�d: %#1t ---------------------------------------------------------------- @@ -802,7 +802,7 @@ upptagna. Logga ut och kom tillbaks senare om du v (message-broadcast . "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -Allm�nt meddelande fr�n %#1P (%#3s): +Alarmmeddelande fr�n %#1P (%#3s): %#2t ---------------------------------------------------------------- @@ -2451,7 +2451,7 @@ i servern. Annars sparas det i din .emacs.") (kom-show-personal-messages-in-buffer-doc . "\ Denna inst�llning best�mmer var personliga meddelanden, gruppmeddelanden - och allm�nna 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 . "N�r det kommer brev: ") (kom-ding-on-priority-break-tag . "N�r det kommer prioriterade inl�gg:") (kom-ding-on-wait-done-tag . "N�r man har v�ntat klart: ") - (kom-ding-on-common-messages-tag . "Vid allm�nna 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 . "N�r �renderad saknas: ") diff --git a/src/vars.el.in b/src/vars.el.in index 8fe2cc20b024d1f38623d4fda74718bef423323d..200acb31731c331088b5db71ce7e2551907df5b9 100644 --- a/src/vars.el.in +++ b/src/vars.el.in @@ -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 diff --git a/src/view-text.el b/src/view-text.el index 4ef415b75e01f725220166b408b6014de6c3db67..8c28df7c0a7026b716c4a519bc61f532d7bba0bd 100644 --- a/src/view-text.el +++ b/src/view-text.el @@ -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)