("NICK" "Change nick." lurk-command-nick)
("LIST" "Display details of one or more channels." lurk-command-list)
("WHOIS" "Ask server for details of nick." nil lurk-nick-completions)
+ ("USERS" "List nicks of users in current context." lurk-command-users)
("MSG" "Send private message to user." lurk-command-msg lurk-nick-completions)
("CLEAR" "Clear buffer text." lurk-command-clear lurk-context-completions)
("HELP" "Display help on client commands." lurk-command-help lurk-help-completions))
(dolist (context params)
(lurk-clear-context context))))
+(defun lurk-command-users (params)
+ (if lurk-current-context
+ (progn
+ (lurk-display-notice lurk-current-context "Users in context:")
+ (lurk-display-notice
+ lurk-current-context
+ (string-join (lurk-get-context-users lurk-current-context) " ")))
+ (lurk-display-notice nil "No current channel.")))
+
;;; Command entering
;;
(defun lurk-complete-input ()
(interactive)
(let ((completion-ignore-case t))
- (when (and (>= (point) lurk-input-marker))
+ (when (>= (point) lurk-input-marker)
(pcase (buffer-substring lurk-input-marker (point))
((rx (: "/" (let cmd-str (+ (not whitespace))) (+ " ") (* (not whitespace)) string-end))
(let ((space-idx (save-excursion
(re-search-backward " " lurk-input-marker t)))
(start (if space-idx (+ 1 space-idx) lurk-input-marker)))
(unless (string-prefix-p "/" (buffer-substring start end))
- (completion-in-region start end (lurk-get-context-users lurk-current-context)))))))))
+ (let* ((users (lurk-get-context-users lurk-current-context))
+ (users-no@ (mapcar
+ (lambda (u) (car (split-string u "@" t)))
+ users)))
+ (completion-in-region start end users-no@)))))))))
(defun lurk-enter ()
"Enter current contents of line after prompt."