;;
(defun lurk-display-message (from to text)
- (let ((context (if (equal from lirc-nick) to from)))
+ (let ((context (if (eq 'channel (lurk-get-context-type to))
+ to
+ (if (equal to lurk-nick) from to))))
(lurk-display-string
(propertize
(pcase (lurk-get-context-type to)
(_
(error "Unsupported context type")))
'face 'lurk-text
- 'help-echo (concat "Context: " to)))))
+ 'help-echo (concat "Context: " context)
+ 'context context))))
(defun lurk-display-notice (context &rest notices)
(lurk-display-string
(propertize
(concat lurk-notice-prefix " " (apply #'concat notices))
- 'help-echo (concat "Context: " (or context "none")))))
+ 'help-echo (concat "Context: " (or context "none"))
+ 'context context)))
(defun lurk-display-error (&rest messages)
(lurk-display-string
(propertize (apply #'concat messages)
'face 'lurk-error))))
+(defun lurk-highlight-context (context)
+ (with-current-buffer "*lurk*"
+ (let* ((pos lurk-prompt-marker)
+ (nextpos (previous-single-property-change pos 'context))
+ (inhibit-read-only t))
+ (while (> pos nextpos)
+ (let ((thiscontext (get-text-property nextpos 'context)))
+ (if thiscontext
+ (if (equal context thiscontext)
+ (add-text-properties nextpos pos
+ '(face (foreground-color . "green")))
+ (add-text-properties nextpos pos
+ '(face (foreground-color . "blue"))))
+ (add-text-properties nextpos pos
+ '(face lurk-text)))
+ thiscontext
+ (setq pos nextpos)
+ (setq nextpos (previous-single-property-change pos 'context nil 1)))))))
+
;;; Message evaluation
;;
(lurk-add-context-users channel names)))
("366" ; ENDOFNAMES
- (lurk-display-notice nil
- (lurk--as-string (length (lurk-get-context-users lurk-current-context)))
- " users in " lurk-current-context))
+ (let* ((params (lurk-msg-params msg))
+ (channel (elt params 1)))
+ (lurk-display-notice
+ channel
+ (lurk--as-string (length (lurk-get-context-users channel)))
+ " users in " channel)))
((rx (= 3 (any digit)))
(lurk-display-notice nil (mapconcat 'identity (cdr (lurk-msg-params msg)) " ")))
(let ((channel (car (lurk-msg-params msg))))
(lurk-add-context channel)
(setq lurk-current-context channel)
- (lurk-display-notice nil "Joining channel " channel)
+ (lurk-display-notice channel "Joining channel " channel)
(lurk-render-prompt)))
("JOIN"