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

Fixed bug 984 (elispklienten bör kunna oläsmarkera inlägg)

Detailed changes:
> 	* commands1.el (lyskom-get-marked-texts): New function.
> 	(lyskom-review-marked-texts): Use it.
> 	(lyskom-unread-marked-texts): New function.
> 	(kom-unread-all-marked-texts): New command.
> 	(kom-unread-marked-texts): New command.
>
> 	* faqs.el (lyskom-unread-faq): New function.
> 	(kom-unread-faq): New command.
> 	(kom-unread-server-faq): New command.
>
> 	* commands1.el (kom-unread-presentation): New command.
>
parent 9165315a
2003-03-16 David Byers <david.byers@swipnet.se>
Work on bug 984:
Fixed bug 984:
* commands1.el (lyskom-get-marked-texts): New function.
(lyskom-review-marked-texts): Use it.
(lyskom-unread-marked-texts): New function.
(kom-unread-all-marked-texts): New command.
(kom-unread-marked-texts): New command.
* faqs.el (lyskom-unread-faq): New function.
(kom-unread-faq): New command.
(kom-unread-server-faq): New command.
* commands1.el (kom-unread-presentation): New command.
* review.el (kom-unread-all): New command.
(kom-unread-first): New command
......
......@@ -199,6 +199,35 @@ This command accepts text number prefix arguments (see
nil "" t))))
(lyskom-review-presentation conf-stat)))
(def-kom-command kom-unread-presentation (&optional text-or-conf-no)
"Marks the presentation for a person or a conference as unread. If
you give a prefix argument it is treated as a text number prefix
argument (see `lyskom-read-text-no-prefix-arg'), and this command
unreads the presentation of the author of that text.
This command accepts text number prefix arguments (see
`lyskom-read-text-no-prefix-arg')."
(interactive (and current-prefix-arg ; only peek at textno:s when prefixed!
(list (lyskom-read-text-no-prefix-arg
'text-to-unread-author-of))))
(let ((conf-stat
(if text-or-conf-no
(blocking-do 'get-conf-stat
(if (interactive-p)
(text-stat->author
(blocking-do 'get-text-stat text-or-conf-no))
text-or-conf-no))
(lyskom-read-conf-stat
(lyskom-get-string 'unread-presentation-for-whom)
'(all)
nil "" t))))
(if (zerop (conf-stat->presentation conf-stat))
(lyskom-format-insert 'has-no-presentation conf-stat)
(lyskom-format-insert 'marking-text-unread
(conf-stat->presentation conf-stat))
(lyskom-report-command-answer
(lyskom-mark-unread (conf-stat->presentation conf-stat))))))
(defun lyskom-review-presentation (conf-stat)
"Review the presentation of conference CONF-STAT."
(if (null conf-stat)
......@@ -2353,21 +2382,40 @@ increasing number of marks per mark type (and, when equal, by mark type)."
(interactive)
(lyskom-review-marked-texts nil))
(def-kom-command kom-unread-marked-texts ()
"Mark all texts you have marked with a particular mark as unread."
(interactive)
(lyskom-unread-marked-texts
(lyskom-read-mark-type (lyskom-get-string 'what-mark-to-unread) t)))
(def-kom-command kom-unread-all-marked-texts ()
"Mark all texts you have marked, regardless of mark, as unread."
(interactive)
(lyskom-unread-marked-texts nil))
(defun lyskom-unread-marked-texts (mark-no)
"Mark all marked texts with the mark equal to MARK-NO unread.
If MARK-NO is nil, review all marked texts."
(let ((text-list (lyskom-get-marked-texts mark-no)))
(if (null text-list)
(lyskom-insert (if (null mark-no)
(lyskom-get-string 'no-marked-texts)
(lyskom-format 'no-marked-texts-mark
(lyskom-symbolic-mark-type-string
mark-no))))
(lyskom-traverse text-no text-list
(lyskom-format-insert 'marking-text-unread text-no)
(lyskom-report-command-answer
(lyskom-mark-unread text-no))))))
(defun lyskom-review-marked-texts (mark-no)
"Review all marked texts with the mark equal to MARK-NO.
If MARK-NO is nil, review all marked texts."
(let ((mark-list (cache-get-marked-texts))
(text-list nil))
(while (not (null mark-list))
(let ((mark (car mark-list)))
(if (and mark
(or (null mark-no)
(eq mark-no (mark->mark-type mark))))
(setq text-list (cons (mark->text-no mark)
text-list))))
(setq mark-list (cdr mark-list)))
(if (eq (length text-list) 0)
(let ((text-list (lyskom-get-marked-texts mark-no)))
(if (null text-list)
(lyskom-insert (if (null mark-no)
(lyskom-get-string 'no-marked-texts)
(lyskom-format 'no-marked-texts-mark
......@@ -2381,6 +2429,18 @@ If MARK-NO is nil, review all marked texts."
(read-list-enter-read-info read-info lyskom-reading-list t)
(read-list-enter-read-info read-info lyskom-to-do-list t)))))
(defun lyskom-get-marked-texts (mark-no)
"Return a list of all texts marked with MARK-NO."
(let ((mark-list (cache-get-marked-texts))
(text-list nil))
(lyskom-traverse mark (cache-get-marked-texts)
(if (and mark
(or (null mark-no)
(eq mark-no (mark->mark-type mark))))
(setq text-list (cons (mark->text-no mark)
text-list))))
text-list))
;;; ================================================================
;;; [ndra L|senord - Change password
......
......@@ -266,8 +266,10 @@ instead of removing it.")
(really-delete-commented-text . "Removing a commented text may annoy many readers. Remove anyway?")
(deleting-text . "Removing text %#1:n...")
(presentation-for-whom . "Which conference/user? ")
(presentation-for-whom . "View presentation for which conference/user? ")
(text-to-see-author-of . "Review presentation of author of which text? ")
(unread-presentation-for-whom . "Unread presentation for which conference/user? ")
(text-to-unread-author-of . "Mark presentation of author of which text as unread? ")
(somebody-deleted-that-conf . "Somebody just deleted that conference.\n")
(review-presentation-of . "Review presentation of %#1M.\n")
(has-no-presentation . "%#1:M has no presentation.\n")
......@@ -413,6 +415,7 @@ and you have finished reading. Please come back later.
(list-which-mark . "List texts with which mark type (name or 0-255, RET for all)? ")
(new-passwd-again . "Repeat the new password for confirmation: ")
(what-mark-to-unread . "Mark which mark type as unread (name or 0-255, RET for all)? ")
(what-mark-to-view . "Review which mark type (name or 0-255, RET for all)? ")
(whos-passwd . "Change password for whom? (yourself) ")
(old-passwd . "Your current password: ")
......@@ -1447,6 +1450,7 @@ On since %#8s%#9s")
(text-to-del-as-faq . "Which text do you want to remove as FAQ? ")
(deleting-faq . "Removing text %#1n as FAQ for %#2?b%[%#2M%]%[the server%]...")
(conf-has-no-faq . "%#1?b%[%#1M%]%[The server%] has no FAQ\n")
(unread-which-faq . "Mark FAQ for which conference as unread? ")
(view-which-faq . "View FAQ for which conference? ")
(review-faq-for-r . "View FAQ for %#1?b%[%#1M%]%[the server%].\n")
(set-faq-for-conf-done . "FAQ for %#1?b%[%#1M%]%[the server%] set to text %#3n.\n")
......@@ -2088,6 +2092,12 @@ environment to one that uses \"%#2s\" to encode text.
. "Unread again")
(kom-unread-first . "Unread first")
(kom-unread-all . "Unread all")
(kom-unread-presentation . "Unread presentation")
(kom-unread-server-faq . "Unread server FAQ")
(kom-unread-faq . "Unread FAQ")
(kom-unread-marked-texts . "Unread marked (texts)")
(kom-unread-all-marked-texts . "Unread all markeed (texts)")
))
(lyskom-language-var global lyskom-language-codes en
......@@ -2440,6 +2450,13 @@ environment to one that uses \"%#2s\" to encode text.
(define-key lyskom-en-unread-prefix (kbd "r") 'kom-unread-root-review)
(define-key lyskom-en-unread-prefix (kbd "f") 'kom-unread-first)
(define-key lyskom-en-unread-prefix (kbd "A") 'kom-unread-all)
(define-key lyskom-en-unread-prefix (kbd "f") 'kom-unread-first)
(define-key lyskom-en-unread-prefix (kbd "p") 'kom-unread-presentation)
(define-key lyskom-en-unread-prefix (kbd "q") 'kom-unread-faq)
(define-key lyskom-en-unread-prefix (kbd "Q") 'kom-unread-server-faq)
(define-key lyskom-en-unread-prefix (kbd "m") 'kom-unread-marked-texts)
(define-key lyskom-en-unread-prefix (kbd "a m") 'kom-unread-all-marked-texts)
(define-key lyskom-en-unread-prefix (kbd "a SPC") 'kom-unread-all)
(define-key lyskom-en-review-prefix (kbd "SPC") 'kom-view)
(define-key lyskom-en-review-prefix (kbd "0") 'kom-initial-digit-view)
......
......@@ -188,6 +188,12 @@ do this. To add a FAQ, use `kom-add-server-faq'."
(lyskom-review-faq nil (server-info->aux-item-list
(blocking-do 'get-server-info))))
(def-kom-command kom-unread-server-faq ()
"Mark the FAQs for the server as unread."
(interactive)
(lyskom-unread-faq nil (server-info->aux-item-list
(blocking-do 'get-server-info))))
(def-kom-command kom-review-faq (&optional conf-no)
"View the FAQs for a particular conference."
(interactive
......@@ -203,6 +209,32 @@ do this. To add a FAQ, use `kom-add-server-faq'."
(lyskom-review-faq conf-stat (conf-stat->aux-items conf-stat))
(lyskom-format-insert 'conf-no-does-not-exist-r conf-no)))))
(def-kom-command kom-unread-faq (&optional conf-no)
"Marks the FAQs for a particular conference as unread."
(interactive
(list
(let* ((conf-stat (blocking-do 'get-conf-stat lyskom-current-conf))
(initial (and conf-stat (cons (conf-stat->name conf-stat) 0))))
(lyskom-read-conf-no 'unread-which-faq '(conf pers) t initial t))))
(if (zerop conf-no)
(lyskom-unread-faq nil (server-info->aux-item-list
(blocking-do 'get-server-info)))
(let ((conf-stat (blocking-do 'get-conf-stat conf-no)))
(if conf-stat
(lyskom-unread-faq conf-stat (conf-stat->aux-items conf-stat))
(lyskom-format-insert 'conf-no-does-not-exist-r conf-no)))))
(defun lyskom-unread-faq (conf-stat aux-list)
(let ((faq-list (mapcar (lambda (aux)
(string-to-int (aux-item->data aux)))
(lyskom-get-aux-item aux-list 14))))
(if (null faq-list)
(lyskom-format-insert 'conf-has-no-faq conf-stat)
(lyskom-traverse text-no faq-list
(lyskom-format-insert 'marking-text-unread text-no)
(lyskom-report-command-answer
(lyskom-mark-unread text-no))))))
(defun lyskom-review-faq (conf-stat aux-list)
(let ((faq-list (mapcar (lambda (aux)
......
......@@ -262,8 +262,10 @@ f
(really-delete-commented-text . "Att radera kommenterade inlgg irriterar mnga lsare. Radera nd?")
(deleting-text . "Radering av text %#1:n...")
(presentation-for-whom . "Vilket mte/person? ")
(presentation-for-whom . "Se presentation fr vilket mte/person? ")
(unread-presentation-for-whom . "Olsmarkera presentation fr vilket mte/person? ")
(text-to-see-author-of . "Se presentation fr vilket inlggs frfattare? ")
(text-to-unread-author-of . "Olsmarkera presentation fr vilket inlggs frfattare? ")
(somebody-deleted-that-conf . "Ngon tog precis bort mtet.\n")
(review-presentation-of . "terse presentation av %#1M.\n")
(has-no-presentation . "%#1:M har ingen presentation.\n")
......@@ -405,6 +407,7 @@ du har l
(list-which-mark . "Lista vilken markeringstyp (namn eller 0-255, RET fr alla)? ")
(new-passwd-again . "Mata in det nya lsenordet igen fr kontroll: ")
(what-mark-to-unread . "Olsmarkera vilken markeringstyp (namn eller 0-255, RET fr alla)? ")
(what-mark-to-view . "terse vilken markeringstyp (namn eller 0-255, RET fr alla)? ")
(whos-passwd . "Vem vill du ndra lsenord fr? (dig sjlv) ")
(old-passwd . "Mata in ditt nuvarande lsenord: ")
......@@ -1482,6 +1485,7 @@ Uppkopplad sedan %#8s%#9s")
(text-to-del-as-faq . "Vilken text vill du ta bort som FAQ? ")
(deleting-faq . "Tar bort inlgg %#1n som FAQ fr %#2?b%[%#2M%]%[servern%]...")
(conf-has-no-faq . "%#1?b%[%#1M%]%[Servern%] har ingen FAQ\n")
(unread-which-faq . "terse FAQ fr vilket mte? ")
(view-which-faq . "terse FAQ fr vilket mte? ")
(review-faq-for-r . "terse FAQ fr %#1?b%[%#1M%]%[servern%].\n")
(set-faq-for-conf-done . "Text %#3n r nu FAQ fr %#1?b%[%#1M%]%[servern%].\n")
......@@ -2122,6 +2126,11 @@ teckenkodning.
. "Olsmarkera igen")
(kom-unread-all . "Olsmarkera alla")
(kom-unread-first . "Olsmarkera frsta")
(kom-unread-presentation . "Olsmarkera presentation")
(kom-unread-server-faq . "Olsmarkera server-FAQ")
(kom-unread-faq . "Olsmarkera FAQ")
(kom-unread-marked-texts . "Olsmarkera markerade")
(kom-unread-all-marked-texts . "Olsmarkera alla markerade")
))
(lyskom-language-var local lyskom-language-codes sv
......@@ -2538,6 +2547,12 @@ teckenkodning.
(define-key lyskom-sv-unread-prefix (kbd "t") 'kom-unread-root-review)
(define-key lyskom-sv-unread-prefix (kbd "A") 'kom-unread-all)
(define-key lyskom-sv-unread-prefix (kbd "f") 'kom-unread-first)
(define-key lyskom-sv-unread-prefix (kbd "p") 'kom-unread-presentation)
(define-key lyskom-sv-unread-prefix (kbd "q") 'kom-unread-faq)
(define-key lyskom-sv-unread-prefix (kbd "Q") 'kom-unread-server-faq)
(define-key lyskom-sv-unread-prefix (kbd "m") 'kom-unread-marked-texts)
(define-key lyskom-sv-unread-prefix (kbd "a m") 'kom-unread-all-marked-texts)
(define-key lyskom-sv-unread-prefix (kbd "a SPC") 'kom-unread-all)
(define-key lyskom-sv-review-prefix (kbd "SPC") 'kom-view)
(define-key lyskom-sv-review-prefix (kbd "0") 'kom-initial-digit-view)
......
......@@ -2944,6 +2944,11 @@ Users are encouraged to use their best sense of humor."
kom-unread-more
kom-unread-all
kom-unread-first
kom-unread-all-marked-texts
kom-unread-marked-texts
kom-unread-faq
kom-unread-server-faq
kom-unread-presentation
))
;;; ================================================================
......
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