Commit 8e76519f authored by David Byers's avatar David Byers
Browse files

Fixed bugs 1621 and 1637. Prepare for printing additional info in presence...

Fixed bugs 1621 and 1637. Prepare for printing additional info in presence messages. Added generic person lists for use in e.g. kom-highlight-conferences and kom-presence-messages-in-buffer. Show presence messages for self using same rules as for others.
parent 861ddb33
2007-06-24 <David Byers@GULAG>
Prepare to print more info on logins:
* async.el (lyskom-parse-async): Parse the session number in the
login message. Get static session info.
(lyskom-show-logged-in-person): Accept the session info. Added
code (disabled) to show from where a user logged in.
(lyskom-parse-async): Get both conf-stat and session info for new
logins.
Fix bug 1637:
* lyskom-buttons.el (lyskom-generate-button): Use
lyskom-indirect-assq to match names against
kom-highlight-conferences.
Add some utility lists:
* option-edit.el (lyskom-custom-variables): Added
kom-person-list-1, kom-person-list-2, kom-person-list-3,
kom-person-list-4.
(lyskom-customize-buffer-format): Same here.
* vars.el.in (kom-person-list-4): New variable.
(kom-person-list-3): New variable.
(kom-person-list-2): New variable.
(kom-person-list-1): New variable.
Fix bug 1621:
* async.el (lyskom-show-presence): Use lyskom-indirect-assq when
the flag is a list.
(lyskom-parse-async): Show presence messages for self.
Fixed bug 1608:
* async.el (lyskom-show-logged-in-person): Applied modified patch
from Per Jonsson (unlike the original patch, still print the
......
......@@ -114,7 +114,9 @@ this function shall be with current-buffer the BUFFER."
'name-has-changed-to-name-r
old-name
new-name
(lyskom-default-button 'conf conf-no))))
(lyskom-default-button 'conf conf-no)
(and kom-text-properties
(list 'face kom-presence-face)))))
;; Update in the mship-edit buffer
......@@ -151,18 +153,20 @@ this function shall be with current-buffer the BUFFER."
((eq msg-no 9) ; A person has logged in
(let ((pers-no (lyskom-parse-num))
;;;(session-no (lyskom-parse-num))
)
(lyskom-parse-num)
(session-no (lyskom-parse-num)))
(lyskom-save-excursion
(set-buffer buffer)
(if (and lyskom-pers-no
(not (zerop lyskom-pers-no))
(/= pers-no lyskom-pers-no)) ; Don't show myself.
(initiate-get-conf-stat 'follow
'lyskom-show-logged-in-person
pers-no))
)))
(set-buffer buffer)
(if (and lyskom-pers-no
(not (zerop lyskom-pers-no)))
(let ((c (make-collector)))
(initiate-get-conf-stat 'follow 'collector-push pers-no c)
(initiate-get-static-session-info 'follow 'collector-push
session-no c)
(lyskom-run 'follow (lambda (c)
(lyskom-show-logged-in-person
(elt (collector->value c) 1)
(elt (collector->value c) 0)))
c))))))
;; msg-no 10 is the old broadcast message. No longer used.
......@@ -197,7 +201,6 @@ this function shall be with current-buffer the BUFFER."
(set-buffer buffer)
(if (and lyskom-pers-no
(not (zerop lyskom-pers-no))
(/= lyskom-pers-no pers-no)
(or (lyskom-show-presence pers-no kom-presence-messages-in-echo-area)
(lyskom-show-presence pers-no kom-presence-messages-in-buffer)))
(initiate-get-conf-stat 'follow
......@@ -397,11 +400,11 @@ according to the value of FLAG."
((eq flag 'morons) (memq num kom-morons))
((eq flag 'friends-and-morons) (or (memq num kom-friends)
(memq num kom-morons)))
((listp flag) (memq num flag))
((listp flag) (lyskom-indirect-assq num flag))
(t t)))
(defun lyskom-show-logged-in-person (conf-stat)
(defun lyskom-show-logged-in-person (conf-stat session-info)
"Visa p} kommandoraden vem som loggat in."
(let ((server (lyskom-session-nickname))
(login-when-date (let ((kom-print-relative-dates nil))
......@@ -423,15 +426,22 @@ according to the value of FLAG."
(cond
((lyskom-show-presence (conf-stat->conf-no conf-stat)
kom-presence-messages-in-buffer)
(lyskom-format-insert-before-prompt 'has-entered-r
(or conf-stat
(lyskom-get-string
'unknown-person))
(and kom-text-properties
(list 'face kom-presence-face))
server
login-when-date
login-when-time)))))
(lyskom-format-insert-before-prompt
'has-entered-r
(or conf-stat
(lyskom-get-string
'unknown-person))
(and kom-text-properties
(list 'face kom-presence-face))
server
login-when-date
login-when-time
(and session-info
nil
(lyskom-combine-username
(static-session-info->username session-info)
(static-session-info->ident-user session-info)
(static-session-info->hostname session-info))))))))
(defun lyskom-show-logged-out-person (conf-stat session-no)
......
......@@ -1071,7 +1071,7 @@ Help: \\[describe-mode] ---")
; From async.el:
(name-has-changed-to-name . "%#1:P has changed name to %#2:P")
(name-has-changed-to-name-r . "%[%#3@%#1:P%] has changed name to %[%#3@%#2:P%]\n")
(name-has-changed-to-name-r . "%#4@%[%#3@%#1:P%] has changed name to %[%#3@%#2:P%]\n")
(you-changed-name-to . "You have now changed your name to %[%#2@%#1:P%].\n")
(database-sync . "Synching database.")
......@@ -1091,7 +1091,7 @@ for a text.
===============================================================================
")
(has-entered . "%#1:P has entered %#2s.")
(has-entered-r . "%#2@%#1P has entered %#3s (%#4s %#5s).\n")
(has-entered-r . "%#2@%#1P has entered %#3s%#6?b%[ from %#6s%]%[%]%#4?b%[ (%#4s %#5s)%]%[%].\n")
(has-left . "%#1:P has left %#2s.")
(has-left-r . "%#2@%#1P has left %#3s (%#4s %#5s).\n")
(Unknown . "Unknown")
......
......@@ -505,39 +505,12 @@ kom-next- and -previous-link won't notice the button"
(list 'face
(or face
(or
(lyskom-traverse el kom-highlight-conferences
(cond ((and (symbolp (car el))
(boundp (car el))
(listp (symbol-value (car el)))
(memq numarg (symbol-value (car el))))
(lyskom-traverse-break
(cond ((facep (cdr el)) (cdr el))
((and (symbolp (cdr el))
(boundp (cdr el)))
(symbol-value (cdr el))))))
((and (symbolp (car el))
(boundp (car el))
(eq numarg (symbol-value (car el))))
(lyskom-traverse-break
(cond ((facep (cdr el)) (cdr el))
((and (symbolp (cdr el))
(boundp (cdr el)))
(symbol-value (cdr el))))))
((and (functionp (car el))
(funcall (car el) arg))
(lyskom-traverse-break
(cond ((facep (cdr el)) (cdr el))
((and (symbolp (cdr el))
(boundp (cdr el)))
(symbol-value (cdr el))))))
((and (listp (car el))
(memq numarg (car el)))
(lyskom-traverse-break
(cond ((facep (cdr el)) (cdr el))
((and (symbolp (cdr el))
(boundp (cdr el)))
(symbol-value (cdr el)))))))
nil)
(let ((val (lyskom-indirect-assq
numarg kom-highlight-conferences)))
(when val
(cond ((facep val) val)
((and (symbolp val) (boundp val))
(symbol-value val)))))
kom-active-face))
'mouse-face kom-highlight-face
'lyskom-button-text text
......
......@@ -83,6 +83,10 @@
[kom-highlight-conferences]
[kom-friends]
[kom-morons]
[kom-person-list-1]
[kom-person-list-2]
[kom-person-list-3]
[kom-person-list-4]
"\n"
[kom-show-unread-in-frame-title]
[kom-unread-mode-line-type]
......@@ -761,6 +765,10 @@ All key bindings:
))
(kom-friends (repeat (person nil :tag name) :indent 4))
(kom-morons (repeat (person nil :tag name) :indent 4))
(kom-person-list-1 (repeat (person nil :tag name) :indent 4))
(kom-person-list-2 (repeat (person nil :tag name) :indent 4))
(kom-person-list-3 (repeat (person nil :tag name) :indent 4))
(kom-person-list-4 (repeat (person nil :tag name) :indent 4))
(kom-url-viewer-preferences (repeat (url-viewer nil :tag viewer-program)
:indent 4))
(kom-windows-browser-command (file))
......
......@@ -1116,7 +1116,7 @@ Annat se \\[describe-mode] ---")
;; From async.el:
(name-has-changed-to-name . "%#1:P har nu bytt namn till %#2:P")
(name-has-changed-to-name-r . "%[%#3@%#1:P%] har nu bytt namn till %[%#3@%#2:P%]\n")
(name-has-changed-to-name-r . "%#4@%[%#3@%#1:P%] har nu bytt namn till %[%#3@%#2:P%]\n")
(you-changed-name-to . "Nu har du bytt namn till %[%#2@%#1:P%].\n")
(database-sync . "Databasen synkas.")
......@@ -1134,7 +1134,7 @@ upptagna. Logga ut och kom tillbaks senare om du v
===============================================================================
")
(has-entered . "Nu har %#1:P gtt in i %#2s.")
(has-entered-r . "%#2@Nu har %#1P gtt in i %#3s (%#4s %#5s).\n")
(has-entered-r . "%#2@Nu har %#1P gtt in i %#3s%#6?b%[ frn %#6s%]%[%]%#4?b%[ (%#4s %#5s)%]%[%].\n")
(has-left . "Nu har %#1:P gtt ur %#2s.")
(has-left-r . "%#2@Nu har %#1P gtt ur %#3s (%#4s %#5s).\n")
(Unknown . "Oknd")
......
......@@ -232,7 +232,7 @@ when recursing due to bound symbols being used as keys."
(cond ((atom el) (when (eq el key) (throw 'lyskom-indirect-assq-return default-return)))
((eq t (car el)) (setcar memo-list (cdr el)))
((functionp (car el))
(when (funcall (car el) key)
(when (condition-case nil (funcall (car el) key) (error nil))
(throw 'lyskom-indirect-assq-return (cdr el))))
((and (symbolp (car el)) (boundp (car el)))
(cond ((listp (symbol-value (car el)))
......
......@@ -1436,14 +1436,59 @@ If non-nil, LysKOM prints continuous info about what other people
are doing. Info is printed on the echo area and never in the buffer.
If minibuffer is used, no message is printed.
A list of integers means show messages for those users.
The value `t' means show messages for everyone.
The value `friends' means show messages for the users in `kom-friends'.
A list is treated as an `indirect association list', and is the
most flexible way to configure this variable. When a user logs
in, the person's number is matched against the list, and if the
value of the match is non-nil, a message is shown. The matching
rules are as follows:
The value `morons' means show messages for the users in `kom-morons'.
Element Meaning
------------------------------------------------------------------
`ATOM' Matches with the default value if ATOM equals
the person number (this means that you can set
this variable to a list of person numbers).
The value `friends-and-morons' means show messages for the users in
`kom-friends' and `kom-morons'.
`(t . VAL)' Matches with value VAL if no other match is
found.
`(FN . VAL)' Matches with value VAL if FN is a function that
returns non-nil when called with the person
number as its sole argument.
`(SYM . VAL)' If SYM is bound to a list, match the person
number against that list using these rules.
VAL is used as the default value for the
matching process.
`(SYM . VAL)' If SYM is not bound to a list, matches with
the value VAL if the value of SYM equals the
person number.
`(LIST . VAL)' Match the person number against LIST using
these rules. VAL is used as the default value.
`(ATOM . VAL)' Match with value VAL if ATOM equals the
person number.
------------------------------------------------------------------
For example, the value `((5 . nil) (kom-friends . t))' will show
a message for every person listed in `kom-friends', except for
person number 5.
The following values work but are obsolete as they can be
expressed by a list:
The value `friends' means show messages for the users in
`kom-friends'. Equivalent to the value `((kom-friends . t))
The value `morons' means show messages for the users in
`kom-morons'. Equivalent to `((kom-morons . t)).
The value `friends-and-morons' means show messages for the users
in `kom-friends' and `kom-morons'. Equivalent to the
value `((kom-friends . t) (kom-morons . t))'.
If you want the messages in the buffer, set the variable
`kom-presence-messages-in-buffer'.
......@@ -1451,6 +1496,17 @@ If you want the messages in the buffer, set the variable
Values other than those listed are reserved for future use."
server)
(def-kom-var kom-presence-messages-in-buffer nil
"**Controls display of presence messages in the LysKOM buffer.
If non-nil, LysKOM prints information about what other people are
doing in the LysKOM buffer. All printing is done just before the
prompt.
See `kom-presence-messages-in-echo-area for a list of permitted
values."
server)
(def-kom-var kom-unread-mode-line-type nil
"**Controls how information about unread sessions is shown in the mode line.
......@@ -1466,20 +1522,6 @@ All other values are reserved for future use."
)
(def-kom-var kom-presence-messages-in-buffer nil
"**Controls display of presence messages in the LysKOM buffer.
If non-nil, LysKOM prints information about what other people are
doing in the LysKOM buffer. All printing is done just before the
prompt.
If `nil' no messages are printed. If `presence', messages about people
logging in, out and people changing name are printed.
All other values are reserved for future use."
server)
(def-kom-var kom-show-where-and-what t
"**Controls display of hostname and activity information in `kom-who-is-on'.
......@@ -2238,6 +2280,38 @@ so they work regardless of what is passed to them.
All other values are reserved for future use."
server)
(def-kom-var kom-person-list-1 nil
"**General list of persons.
This variable has no predefined meanind and is intended for use
in variables such as `kom-presence-messages-in-buffer' and
`kom-highlight-conferences'."
server)
(def-kom-var kom-person-list-2 nil
"**General list of persons.
This variable has no predefined meanind and is intended for use
in variables such as `kom-presence-messages-in-buffer' and
`kom-highlight-conferences'."
server)
(def-kom-var kom-person-list-3 nil
"**General list of persons.
This variable has no predefined meanind and is intended for use
in variables such as `kom-presence-messages-in-buffer' and
`kom-highlight-conferences'."
server)
(def-kom-var kom-person-list-4 nil
"**General list of persons.
This variable has no predefined meanind and is intended for use
in variables such as `kom-presence-messages-in-buffer' and
`kom-highlight-conferences'."
server)
(def-kom-var kom-friends nil
"**List of friends and other nice people.
......
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