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

Bugfixar i def-kom-command, snyggare sessionsstatus

parent aa7dcd43
Sat Aug 10 12:24:22 1996 David Byers <davby@sen2.ida.liu.se>
* commands1.el (lyskom-status-session-9): Snyggare utskrivt av
idletid. Skriv inte ut idletid om klienten inte har skickat
user-active. (lyskom-format-secs-aux): Ny funktion.
(lyskom-format-secs): Ny funktion.
* english-strings.el, swedish-strings.el (lyskom-strings): Lade till
session-is-active.
* komtypes.el (def-komtype): Fixade buggen som gjorde att
def-komtype var obra genom att returnera en progn med defsubstarna
i istf att evaluera defsubstarna.
* vars.el.in (lyskom-server-features): Lgg in information om
protokollversion fr servrar med version lgre n 1.7.0
(lyskom-server-features): Lade in lyskom-dynamic-session-info-flag
......
......@@ -1912,14 +1912,52 @@ WHO-INFOS that are potential sessions."
(lyskom-get-string 'doing-nowhere-conn))
(lyskom-format-time
(static-session-info->connection-time static))
(if (eq (/ (dynamic-session-info->idle-time info) 60)
0)
"\n"
(lyskom-format (lyskom-get-string 'session-status-inactive)
(/ (dynamic-session-info->idle-time info) 60))))
(cond ((eq (/ (dynamic-session-info->idle-time info) 60) 0)
(lyskom-get-string 'session-is-active))
((not (session-flags->user_active_used
(dynamic-session-info->flags info)))
"\n")
(t
(lyskom-format (lyskom-get-string 'session-status-inactive)
(lyskom-format-secs
(dynamic-session-info->idle-time info))))))
(if (session-flags->invisible (dynamic-session-info->flags info))
(lyskom-insert (lyskom-get-string 'session-is-invisible)))))
(setq who-info-list (cdr who-info-list)))))
(defun lyskom-format-secs-aux (string num x1 x2 one many)
(cond ((<= num 0) string)
((= num 1) (if (string= "" string)
(concat string (lyskom-get-string one))
(concat string (if (and (= x1 0)
(= x2 0))
(format " %s "
(lyskom-get-string 'and))
", ")
(lyskom-get-string one))))
(t (if (string= "" string)
(concat string (format "%d %s" num
(lyskom-get-string many)))
(concat string (if (and (= x1 0)
(= x2 0))
(format " %s "
(lyskom-get-string 'and))
", ")
(format "%d %s"
num
(lyskom-get-string many)))))))
(defun lyskom-format-secs (time)
"Format the number of seconds in TIME as a human-readable string."
(let ((secs (% time 60))
(mins (% (/ time 60) 60))
(hrs (% (/ time 3600) 24))
(days (/ time 86400))
(string ""))
(setq string (lyskom-format-secs-aux string days hrs mins 'one-day 'days))
(setq string (lyskom-format-secs-aux string hrs mins 0 'one-hour 'hours))
(setq string (lyskom-format-secs-aux string mins 0 0 'one-minute 'minutes))))
;;; ================================================================
......
......@@ -932,6 +932,14 @@ Using %#6D from %#3s\n")
Using %#6D from %#3s
On since %#8s%#9s")
(session-status-inactive . "\nHas been inactive for %#1d minutes\n")
(one-day . "one day")
(one-hour . "one hour")
(one-minute . "one minute")
(days . "days")
(hours . "hours")
(minutes . "minutes")
(and . "and")
(session-is-active . " and is currently active.\n")
(session-is-invisible . "This session is invisible.\n")
(status-for-session . "Session status for whom? ")
(unknown-doing-what . "Exists")
......
......@@ -1033,48 +1033,57 @@ TYPE is one of RECPT, CC-RECPT COMM-TO COMM-IN FOOTN-TO or FOOTN-IN."
(defmacro def-komtype (type &rest args)
(let ((typename (symbol-name type))
(n 0))
(n 0)
(tmp nil))
;; Constructor
(eval (list 'defsubst
(intern (concat "lyskom-create-" typename))
args
(concat "Create a `" typename "' from arguments.\n"
"Args: " (upcase (mapconcat
'symbol-name args " ")) "\n"
"Automatically created with def-komtype.")
(list 'cons
(list 'quote (intern (upcase typename)))
(cons 'vector args))))
;; Identifier
(eval (list 'defsubst
(intern (concat typename "-p"))
(list type)
(concat "Return `t' if " (upcase typename)
" is a " typename ".\n"
"Args: " (upcase typename) "\n"
"Automatically created with def-komtype.")
(list 'and
(list 'consp type)
(list 'eq (list 'car type)
(list 'quote (intern (upcase typename)))))))
(append
(list 'progn
(list 'defsubst
(intern (concat "lyskom-create-" typename))
args
(concat "Create a `" typename "' from arguments.\n"
"Args: " (upcase (mapconcat
'symbol-name args " ")) "\n"
"Automatically created with def-komtype.")
(list 'cons
(list 'quote (intern (upcase typename)))
(cons 'vector args)))
;; Identifier
(list 'defsubst
(intern (concat typename "-p"))
(list type)
(concat "Return `t' if " (upcase typename)
" is a " typename ".\n"
"Args: " (upcase typename) "\n"
"Automatically created with def-komtype.")
(list 'and
(list 'consp type)
(list 'eq (list 'car type)
(list 'quote (intern (upcase typename)))))))
;; Selectors/Modifiers
(while args
(let ((argname (symbol-name (car args))))
;; Selctor
(eval (list 'defsubst
(intern (concat typename "->" argname))
(list type)
"Automatically created with def-komtype."
(list 'aref (list 'cdr type) n)))
;; Modifier
(eval (list 'defsubst
(intern (concat "set-" typename "->" argname))
(list type (car args))
"Automatically created with def-komtype."
(list 'aset (list 'cdr type) n (car args))))
(setq n (1+ n)
args (cdr args)))))
'())
(progn
(while args
(let ((argname (symbol-name (car args))))
;; Selctor
(setq tmp (cons
(list 'defsubst
(intern (concat typename "->" argname))
(list type)
"Automatically created with def-komtype."
(list 'aref (list 'cdr type) n))
tmp))
;; Modifier
(setq tmp (cons
(list 'defsubst
(intern (concat "set-" typename "->" argname))
(list type (car args))
"Automatically created with def-komtype."
(list 'aset (list 'cdr type) n (car args)))
tmp))
(setq n (1+ n)
args (cdr args))))
tmp))))
(def-komtype session-flags
invisible user_active_used user_absent
......
......@@ -968,7 +968,15 @@ K\366r %#6D fr\345n %#3s\n")
%#5s %#7s %#4M
K\366r %#6D fr\345n %#3s
Uppkopplad sedan %#8s%#9s")
(session-status-inactive . "\nHar inte varit aktiv p\345 %#1d minuter\n")
(session-status-inactive . "\nHar inte varit aktiv p\345 %#1s\n")
(one-day . "en dag")
(one-hour . "en timme")
(one-minute . "en minut")
(days . "dagar")
(hours . "timmar")
(minutes . "minuter")
(and . "och")
(session-is-active . " och r aktiv.\n")
(session-is-invisible . "Denna session \344r osynlig.\n")
(status-for-session . "Sessionsstatus f\366r vilken person? ")
(unknown-doing-what . "Existerar")
......
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