Commit 14fbab3e authored by David Byers's avatar David Byers
Browse files

Fixed bugs 747 and 709.

Detailed changes:
> 	Fix bug 747:
> 	* commands2.el (lyskom-status-pers-list-one-membership): New
> 	function.
> 	(kom-status-person): Use it.
>
> 	Fix bug 709:
> 	* faqs.el (kom-list-faqs): New command.
> 	(kom-list-server-faqs): New command.
> 	(lyskom-do-list-faqs): New function.
>
> 	* lyskom-rest.el (lyskom-next-property-bounds): New function.
> 	(lyskom-do-special-inserts): Use it. Added end parameter.
> 	(lyskom-do-insert): Pass end parameter.
>
> 	* lyskom-buttons.el (lyskom-button-transform-text): Do links from
> 	kom-text-buttons after the hard-coded stuff.
>
parent 76661d80
2003-07-27 David Byers <byers@lysator.liu.se>
Fix bug 747:
* commands2.el (lyskom-status-pers-list-one-membership): New
function.
(kom-status-person): Use it.
Fix bug 709:
* faqs.el (kom-list-faqs): New command.
(kom-list-server-faqs): New command.
(lyskom-do-list-faqs): New function.
* lyskom-rest.el (lyskom-next-property-bounds): New function.
(lyskom-do-special-inserts): Use it. Added end parameter.
(lyskom-do-insert): Pass end parameter.
* lyskom-buttons.el (lyskom-button-transform-text): Do links from
kom-text-buttons after the hard-coded stuff.
Fix bug 761:
* startup.el (kom-start-anew): Set lyskom-is-administrator to nil
after logging on.
......
......@@ -490,6 +490,7 @@ This command accepts text number prefix arguments \(see
(let ((membership-list
(blocking-do 'get-membership
(conf-stat->conf-no conf-stat)))
(deferred-mships nil)
(lyskom-count-var 0)
(lyskom-passive-count-var 0))
......@@ -511,57 +512,17 @@ This command accepts text number prefix arguments \(see
;; "Print a row describing the membership of
;; MEMBER-CONF-STAT
(let ((member-conf-stat
(blocking-do 'get-conf-stat
(membership->conf-no membership))))
(if (or (null member-conf-stat)
(null membership))
(lyskom-insert-string 'secret-membership)
(lyskom-format-insert
"%#1@%-17#2s"
(if (membership-type->passive
(membership->type membership))
`(face ,kom-dim-face)
nil)
(lyskom-format-time
'date-and-time
(membership->last-time-read membership)))
(let ((unread (- (+ (conf-stat->first-local-no
member-conf-stat)
(conf-stat->no-of-texts
member-conf-stat))
(membership->last-text-read membership)
(length (membership->read-texts
membership))
1)))
(lyskom-format-insert
'pers-membership-line
(if (zerop unread) " " (format "%9d " unread))
(if (= (conf-stat->conf-no conf-stat)
(conf-stat->supervisor member-conf-stat))
(lyskom-get-string 'is-supervisor-mark)
" ")
member-conf-stat
(lyskom-return-membership-type
(membership->type membership))
(if (membership-type->passive
(membership->type membership))
`(face ,kom-dim-face)
nil)
)
(when (and (membership->created-by membership)
(not (zerop (membership->created-by membership)))
(not (eq (conf-stat->conf-no conf-stat)
(membership->created-by membership))))
(lyskom-format-insert 'pers-membership-line-2
(lyskom-format-time
'date-and-time
(membership->created-at membership))
(membership->created-by membership)))
(if (membership-type->passive (membership->type membership))
(setq lyskom-passive-count-var
(+ lyskom-passive-count-var unread))
(setq lyskom-count-var (+ lyskom-count-var unread))))))))
(if (membership-type->passive
(membership->type membership))
(setq deferred-mships
(cons membership deferred-mships))
(setq lyskom-count-var
(+ lyskom-count-var
(lyskom-status-pers-list-one-membership conf-stat membership)))))
(lyskom-traverse membership (nreverse deferred-mships)
(setq lyskom-passive-count-var
(+ lyskom-passive-count-var
(lyskom-status-pers-list-one-membership conf-stat membership)))))
;; "Print the total number of unread texts for the person CONF-STAT."
(lyskom-format-insert 'his-total-unread
......@@ -569,6 +530,56 @@ This command accepts text number prefix arguments \(see
lyskom-count-var
lyskom-passive-count-var))))))
(defun lyskom-status-pers-list-one-membership (conf-stat membership)
(let ((member-conf-stat
(blocking-do 'get-conf-stat
(membership->conf-no membership))))
(if (or (null member-conf-stat)
(null membership))
(lyskom-insert-string 'secret-membership)
(lyskom-format-insert
"%#1@%-17#2s"
(if (membership-type->passive
(membership->type membership))
`(face ,kom-dim-face)
nil)
(lyskom-format-time
'date-and-time
(membership->last-time-read membership)))
(let ((unread (- (+ (conf-stat->first-local-no
member-conf-stat)
(conf-stat->no-of-texts
member-conf-stat))
(membership->last-text-read membership)
(length (membership->read-texts
membership))
1)))
(lyskom-format-insert
'pers-membership-line
(if (zerop unread) " " (format "%9d " unread))
(if (= (conf-stat->conf-no conf-stat)
(conf-stat->supervisor member-conf-stat))
(lyskom-get-string 'is-supervisor-mark)
" ")
member-conf-stat
(lyskom-return-membership-type
(membership->type membership))
(if (membership-type->passive
(membership->type membership))
`(face ,kom-dim-face)
nil)
)
(when (and (membership->created-by membership)
(not (zerop (membership->created-by membership)))
(not (eq (conf-stat->conf-no conf-stat)
(membership->created-by membership))))
(lyskom-format-insert 'pers-membership-line-2
(lyskom-format-time
'date-and-time
(membership->created-at membership))
(membership->created-by membership)))
unread))))
;;; ================================================================
......
......@@ -1498,6 +1498,7 @@ On since %#8s%#9s")
(faq-in-text-by . "FAQ in text %#1n %#5s %#3sby %#2P %#4s")
(server-has-new-faq . "\nThere %#1?d%[is a new FAQ%]%[are %#1d new FAQs%] for the server.\n")
(unread-faqs-header . "\nUnread FAQ%#1?d%[%]%[s%] for %#2?b%[%#2M%]%[the server%]::\n")
(all-faqs-header . "All FAQs for %#1?b%[%#1M%]%[the server%]:\n")
(too-many-languages . "Cannot code that many character sets. Send uncoded? ")
(too-many-content-types . "Cannot figure out what content type you want. Simplify the text.")
......@@ -2159,6 +2160,8 @@ environment to one that uses \"%#2s\" to encode text.
(kom-leave-all-conferences . "Leave (almost) all conferences")
(kom-limit-import . "Limit imported texts")
(kom-change-message-flag . "Change reception (of) group messages")
(kom-list-faqs . "List FAQs")
(kom-list-server-faqs . "List server-FAQs")
))
(lyskom-language-var global lyskom-language-codes en
......@@ -2465,6 +2468,8 @@ environment to one that uses \"%#2s\" to encode text.
(define-key lyskom-en-list-prefix (kbd "M") 'kom-membership)
(define-key lyskom-en-list-prefix (kbd "s") 'kom-list-summary)
(define-key lyskom-en-list-prefix (kbd "f") 'kom-list-filters)
(define-key lyskom-en-list-prefix (kbd "q") 'kom-list-faqs)
(define-key lyskom-en-list-prefix (kbd "Q") 'kom-list-server-faqs)
(define-key lyskom-en-next-prefix (kbd "t") 'kom-view-next-new-text)
(define-key lyskom-en-next-prefix (kbd "c") 'kom-go-to-next-conf)
......
......@@ -465,3 +465,34 @@ create a new FAQ."
(when kom-auto-review-faqs
(lyskom-do-review-faq faq-list t))))
(def-kom-command kom-list-faqs (conf-stat)
"List all FAQs for a conference."
(interactive (list (lyskom-read-conf-stat "Conference: "
'(conf)
nil
lyskom-current-conf
t)))
(lyskom-do-list-faqs conf-stat
(lyskom-get-aux-item
(conf-stat->aux-items conf-stat)
14)))
(def-kom-command kom-list-server-faqs ()
"List all FAQs for a conference."
(interactive)
(lyskom-do-list-faqs
nil
(lyskom-get-aux-item (server-info->aux-item-list
(blocking-do 'get-server-info)) 14)))
(defun lyskom-do-list-faqs (conf-stat faq-list)
(cond (faq-list
(lyskom-format-insert 'all-faqs-header
(and conf-stat
(conf-stat->conf-no conf-stat)))
(lyskom-do-list-summary (mapcar (lambda (faq)
(string-to-int (aux-item->data faq)))
faq-list)))
(t (lyskom-format-insert 'conf-has-no-faq conf-stat))))
......@@ -365,15 +365,6 @@ lyskom-text-buttons. Returns the modified string."
(start 0)
(el nil))
;; Do links from kom-text-links last -- they have precedence
;; Do the first recipient last so links for that rcpt have prio
(lyskom-traverse rcpt rcpts
(lyskom-button-add-links text (cdr (assq rcpt kom-text-links))))
;; Do global links from kom-text-links very last
(lyskom-button-add-links text (cdr (assq t kom-text-links)))
;; Do other text buttons
(while blist
(setq el (car blist))
......@@ -432,7 +423,16 @@ lyskom-text-buttons. Returns the modified string."
text)
(setq start (match-end 0)))
(setq start (1+ (match-beginning 0)))))
(setq blist (cdr blist))))
(setq blist (cdr blist)))
;; Do links from kom-text-links last -- they have precedence
;; Do the first recipient last so links for that rcpt have prio
(lyskom-traverse rcpt rcpts
(lyskom-button-add-links text (cdr (assq rcpt kom-text-links))))
;; Do global links from kom-text-links very last
(lyskom-button-add-links text (cdr (assq t kom-text-links)))
)
text)
......
......@@ -1095,21 +1095,24 @@ The position lyskom-last-viewed will always remain visible."
)))))
;;;
;;; Thanks to the stupid danish fool who wrote the widget package, we
;;; have to do it this way, because w3 uses widgets, and because
;;; widgets use overlays, and because overlays aren't copied between
;;; buffers. If the idiot danish flaming asshole had used text
;;; properties or something equally sensible instead, we could have
;;; managed without this shit.
;;;
;;; (Me, upset? Why would you think *that*?)
;;;
(defun lyskom-next-property-bounds (from to sym)
"Sort of like next-text-property-bounds, but limited at the front and
back, and works even if from has the property."
(let ((result (cond ((get-text-property from sym)
(cons from (next-single-property-change from sym)))
((next-single-property-change from sym)
(let ((start (next-single-property-change from sym)))
(cons start (next-single-property-change start sym)))))))
(when result
(cond ((null (cdr result)) (setcdr result (or to (point-max))))
((and from (< (car result) from)) (setcar result from))
((and to (> (cdr result) to)) (setcar result to))))
result))
(defun lyskom-do-special-inserts (start sym)
(defun lyskom-do-special-inserts (start end sym)
(condition-case var
(let ((bounds (next-text-property-bounds 1 (max (point-min) (1- start))
sym))
(let ((bounds (lyskom-next-property-bounds start end sym))
(next (make-marker))
(fn nil))
(while bounds
......@@ -1133,8 +1136,8 @@ The position lyskom-last-viewed will always remain visible."
(defun lyskom-do-insert (string)
(let ((start (point)))
(insert string)
(lyskom-do-special-inserts start 'lyskom-overlay)
(lyskom-do-special-inserts start 'special-insert)
(lyskom-do-special-inserts start (point) 'lyskom-overlay)
(lyskom-do-special-inserts start (point) 'special-insert)
))
......
......@@ -1533,6 +1533,7 @@ Uppkopplad sedan %#8s%#9s")
(faq-in-text-by . "FAQ i text %#1n %#5s %#3sav %#2P %#4s")
(server-has-new-faq . "\nDet finns %#1d ny%#1?d%[%]%[a%] FAQ till servern.\n")
(unread-faqs-header . "\nOlst%#1?d%[%]%[a%] FAQ till %#2?b%[%#2M%]%[servern%]:\n")
(all-faqs-header . "Alla FAQ till %#1?b%[%#1M%]%[servern%]:\n")
(too-many-languages . "Fr mnga teckenuppsttningar fr att koda. Skicka in okodat? ")
(too-many-content-types . "Kan inte avgra innehllstyp. Frenkla inlgget.")
......@@ -2192,6 +2193,8 @@ teckenkodning.
(kom-leave-all-conferences . "Uttrd ur (nstan) alla mten")
(kom-limit-import . "Begrnsa import av texter")
(kom-change-message-flag . "ndra mottagning (av) gruppmeddelanden")
(kom-list-faqs . "Lista FAQ")
(kom-list-server-faqs . "Lista server-FAQ")
))
(lyskom-language-var local lyskom-language-codes sv
......@@ -2539,6 +2542,10 @@ teckenkodning.
(define-key lyskom-sv-list-prefix (kbd "r") 'kom-list-re)
(define-key lyskom-sv-list-prefix (kbd "s") 'kom-membership)
(define-key lyskom-sv-list-prefix (kbd "f") 'kom-list-filters)
(define-key lyskom-sv-list-prefix (kbd "q") 'kom-list-faqs)
(define-key lyskom-sv-list-prefix (kbd "Q") 'kom-list-server-faqs)
(lyskom-try-define-key lyskom-sv-list-prefix (kbd "") 'kom-list-summary)
(lyskom-try-define-key lyskom-sv-list-prefix (kbd "{") 'kom-list-summary)
(lyskom-try-define-key lyskom-sv-list-prefix (kbd "[") 'kom-list-summary)
......
......@@ -2979,6 +2979,8 @@ Users are encouraged to use their best sense of humor."
kom-will-person-read-text
kom-limit-import
kom-change-message-flag
kom-list-faqs
kom-list-server-faqs
))
;;; ================================================================
......
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