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

Bug fixes, new date printing, enhances person status

parent 564ccd70
No preview for this file type
......@@ -341,6 +341,9 @@ otherwise: the conference is read with lyskom-completing-read."
(pers-stat->username pers-stat))
(lyskom-format-insert 'read-texts
(pers-stat->read-texts pers-stat))
(if (= (pers-stat->pers-no pers-stat) lyskom-pers-no)
(lyskom-format-insert 'marked-texts
(pers-stat->no-of-marks pers-stat)))
(lyskom-format-insert 'time-for-last-letter
(lyskom-return-time
(conf-stat->last-written conf-stat)))
......@@ -481,10 +484,10 @@ otherwise: the conference is read with lyskom-completing-read."
message))
(def-kom-command kom-send-alarm ()
(def-kom-command kom-send-alarm (&optional message)
"Send a message to all of the users in KOM right now."
(interactive)
(lyskom-send-message 0 nil))
(lyskom-send-message 0 message))
(defun lyskom-send-message (pers-no message)
......@@ -519,12 +522,13 @@ means send the message to everybody."
;;; Author: Linus Tolke
(def-kom-command kom-set-unread (&optional arg)
(def-kom-command kom-set-unread (&optional arg conf-no)
"Set number of unread articles in current conference."
(interactive "P")
(if (zerop lyskom-current-conf)
(if (and (zerop lyskom-current-conf) (null conf-no))
(lyskom-insert-string 'not-present-anywhere)
(let ((conf-stat (blocking-do 'get-conf-stat lyskom-current-conf)))
(let ((conf-stat (blocking-do 'get-conf-stat (or conf-no
lyskom-current-conf))))
(if (null conf-stat) ;+++ annan errorhantering
(lyskom-insert "Error!\n") ;+++ Hrrrmmmmffff????
(let* ((narg (prefix-numeric-value arg))
......
......@@ -380,6 +380,7 @@ and you have finished reading. Please come back later.
(user-name . "User: %36#1s\n")
(read-texts . "Articles read:%28#1d\n")
(marked-texts . "Articles marked:%26#1d")
(time-for-last-letter . "Time of last letter:%22#1s (accordning to your cache)\n")
(superconf . "%[%#3@Superconference:%31#1:m%] %#4s(%#2M)\n")
(supervisor . "%[%#3@Supervisor:%29#1:p%] %#4s(%#2P)\n")
......@@ -552,6 +553,10 @@ Mark the envelope with \"LysKOM bug report\"\n\n")
; used by lyskom-print-time
(time-y-m-d-h-m . "%4#1d %02#3d/%02#1d %02#4d:%02#5d ")
(today-time-format-string . "%#6s %02#4d:%02#5d")
(yesterday-time-format-string . "%#6s %02#4d:%02#5d")
(today . "today")
(yesterday . "yesterday")
; used by lyskom-return-time
(time-yyyy-mm-dd-hh-mm . "%4#1d %02#3d/%02#2d %02#4d:%02#5d")
(no-such-text-no . "The article doesn't exist. (%#1d)\n")
......
......@@ -390,6 +390,7 @@ du har l\344st klart allting. Kom tillbaks senare.
(user-name . "Anv\344ndare: %30#1s\n")
(read-texts . "L\344sta texter:%28#1d\n")
(marked-texts . "Markerade texter:%24#1d\n")
(time-for-last-letter . "Tid f\366r senaste brev:%20#1s (st\345r det i din cache)\n")
(superconf . "%[%#3@Superm\366te:%31#1:m%] %#4s(%#2M)\n")
(supervisor . "%[%#3@Organisat\366r:%29#1:p%] %#4s(%#2P)\n")
......@@ -579,6 +580,10 @@ M\344rk kuvertet \"LysKOM buggrapport f\366r elispklienten\".\n\n")
; used by lyskom-print-time
(time-y-m-d-h-m . "%4#1d-%02#2d-%02#3d %02#4d:%02#5d ")
(today-time-format-string . "%#6s %02#4d:%02#5d")
(yesterday-time-format-string . "%#6s %02#4d:%02#5d")
(today . "idag")
(yesterday . "igr")
; used by lyskom-return-time
(time-yyyy-mm-dd-hh-mm . "%4#1d-%02#2d-%02#3d %02#4d:%02#5d")
(no-such-text-no . "Det finns ingen s\345dan text. (%#1n)\n")
......
......@@ -43,7 +43,7 @@
;;;; ================================================================
;;;; Emacs dependant variables
(defvar kom-emacs-knows-iso-8859-1 nil
(defvar kom-emacs-knows-iso-8859-1 t
"*If non-nil then dont convert texts and other things to swascii.
This variable is not saved. It should be set in your .emacs")
......@@ -216,54 +216,58 @@ various LysKOM elements.")
'((text
text-text
lyskom-button-view-text
((kom-view "Återse" . lyskom-button-view-text)
(kom-write-comment "Kommentera" . lyskom-button-comment-text)
(kom-private-answer "Personligt svar" . lyskom-button-private-comment-text)
(kom-mark-text "Markera" . lyskom-button-mark-text)
(kom-unmark-text "Avmarkera" . lyskom-button-unmark-text))
(("Återse texten" . lyskom-button-view-text)
("Kommentera texten" . lyskom-button-comment-text)
("Personligt svar" . lyskom-button-private-comment-text)
("Markera texten" . lyskom-button-mark-text)
("Avmarkera texten" . lyskom-button-unmark-text))
nil)
(conf
conf-text
lyskom-button-view-conf-presentation
((kom-view-presentation "Återse presentation" .
lyskom-button-view-conf-presentation)
(kom-status-conf "Visa status" . lyskom-button-view-conf-status)
(kom-go-to-conf "Gå till mötet" . lyskom-button-goto-conf))
(("Visa presentation" . lyskom-button-view-conf-presentation)
("Visa mötesstatus" . lyskom-button-view-conf-status)
("Gå till mötet" . lyskom-button-goto-conf)
("Bli medlem i mötet" . lyskom-button-add-self)
("Utträd ur mötet" . lyskom-button-sub-self))
((kom-list-news . lyskom-button-goto-conf)))
(pers
pers-text
lyskom-button-view-pers-presentation
((kom-view-presentation "Återse presentation" .
(("Visa presentation" .
lyskom-button-view-pers-presentation)
(kom-status-person "Visa status" . lyskom-button-view-pers-status)
(kom-send-letter "Skicka brev" . lyskom-button-mail))
("Visa personstatus" . lyskom-button-view-pers-status)
("Skicka brev" . lyskom-button-mail)
("Sänd meddelande" . lyskom-button-send-message))
nil)
(url
url-text
lyskom-button-open-url
((kom-open-url "Öppna" . lyskom-button-open-url)
(kom-copy-url "Kopiera" . lyskom-button-copy-url))
(("Öppna" . lyskom-button-open-url)
("Kopiera" . lyskom-button-copy-url))
nil))
"This variable defines valid button types in LysKOM. Each element is a
list consisting of TYPE LABEL DEFAULT ACTIONS HINTS.
list consisting of (TYPE LABEL DEFAULT ACTIONS HINTS).
TYPE is the button type the entry defines
LABEL is a textual representation for the button type, used in menu titles. If
it is a symbol, that symbol will be looked up using lyskom-get-string.
it is a symbol, that symbol will be looked up using lyskom-get-string.
DEFAULT is the default action to take on a click. It must be a function.
ACTIONS are other possible actions. The format of this entry is described below.
HINTS is a list of hints to override the default action. This is described below.
ACTIONS are other possible actions. The format of this entry is described
below.
HINTS is a list of hints to override the default action. This is described
below.
The ACTIONS entry is used to construct a pop-up menu. It is a list consisting of
lists with the format (COMMAND STRING . FUNCTION). COMMAND is used to distinguish
the elements of the menu, STRING is the menu label and FUNCTION is the function to
call when the menu item is selected.
The ACTIONS entry is used to construct a pop-up menu. It is a list consisting
of lists with the format (STRING . FUNCTION). STRING is the menu label and
FUNCTION is the function to call when the menu item is selected.
The HINTS entry is used to generate hints that the default action should be
overridden. It is a list containing elements (COMMAND . HINT) where COMMAND is
as interactive LysKOM command and HINT is a function to call. When a button
is generated while the command COMMAND is being executed, HINT is used as a hint
for a new default action. The user has the option to ignore or used the hint.")
is generated while the command COMMAND is being executed, HINT is used as a
hint for a new default action. The user has the option to ignore or used the
hint.")
(defvar lyskom-text-buttons
......@@ -344,6 +348,9 @@ he gets a y-or-n-p question for all recipients.")
(defvar kom-max-buffer-size nil
"*If non-nil, ensure that buffers won't grow any larger than this")
(defvar lyskom-print-complex-dates t
"*If non-nil, print today and yesterday using a special format.")
(defvar lyskom-server-aliases
'(("kom.lysator.liu.se" . "LysKOM")
("kom.ludd.luth.se" . "LuddKOM")
......
......@@ -295,14 +295,45 @@ recipients to it that the user is a member in."
res))
(defun lyskom-subtract-one-day (x)
(let ((high-x (1- (car x)))
(low-x (car (cdr x))))
(if (> 20864 low-x)
(setq high-x (1- high-x)
low-x (+ low-x 65536)))
(setq low-x (- low-x 20864))
(list high-x low-x nil)))
(defun lyskom-calculate-day-diff (time)
(let* ((now (current-time))
(yesterday (lyskom-subtract-one-day now))
(decnow (decode-time now))
(decthen (decode-time yesterday)))
(cond ((and (= (time->mday time) (elt decnow 3))
(= (1+ (time->mon time)) (elt decnow 4))
(= (+ (time->year time) 1900) (elt decnow 5)))
'today)
((and (= (time->mday time) (elt decthen 3))
(= (1+ (time->mon time)) (elt decthen 4))
(= (+ (time->year time) 1900) (elt decthen 5)))
'yesterday)
(t nil))))
(defun lyskom-print-date-and-time (time)
"Print date and time. Arg: TIME."
(lyskom-format-insert 'time-y-m-d-h-m
(let* ((diff (lyskom-calculate-day-diff time)))
(lyskom-format-insert
(if (and diff lyskom-print-complex-dates)
(intern (concat (symbol-name diff) "-time-format-string"))
'time-y-m-d-h-m)
(+ (time->year time) 1900)
(1+ (time->mon time))
(time->mday time)
(time->hour time)
(time->min time)))
(time->min time)
(and diff (lyskom-get-string diff)))))
(defun lyskom-print-text (text-stat text mark-as-read text-no)
......
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