(seq-find (lambda (ctx)
(equal (seq-take ctx 2) test-ctx))
murk-contexts))
- (assoc server murk-contexts)))
+ (car (member (list server) murk-contexts))))
(defun murk-cycle-contexts (&optional reverse)
(setq murk-contexts
(concat (murk-context->string context) " <" from ">"))
text)))
+(defun murk-display-action (server from to action-text)
+ (let ((context (if (string-prefix-p "#" to)
+ (murk-get-context server to)
+ (murk-get-context server))))
+ (murk-display-string
+ context
+ (concat (murk-context->string context) " *")
+ from " " action-text)))
+
(defun murk-display-notice (context &rest notices)
(murk-display-string
context
" on " server " (no response sent)"))
((rx (: "\01ACTION " (let action-text (* (not "\01"))) "\01"))
- (murk-display-action from to action-text))
+ (murk-display-action server from to action-text))
(_
(murk-display-message server from to text)))))
("TOPIC" "Set/query topic for current channel." murk-command-topic)
("USERS" "List nicks of users in current context." murk-command-users)
("MSG" "Send private message to user." murk-command-msg murk-nick-completions)
+ ("ME" "Display action." murk-command-me)
("CLEAR" "Clear buffer text." murk-command-clear murk-context-completions)
("HELP" "Display help on client commands." murk-command-help murk-help-completions))
"Table of commands explicitly supported by murk.")
to text))
(murk-display-notice nil "Usage: /msg <nick> <message>"))))
+(defun murk-command-me (params)
+ (let* ((ctx (murk-current-context))
+ (server (murk-context-server ctx)))
+ (if (and ctx (not (murk-server-context-p ctx)))
+ (if params
+ (let* ((channel (murk-context-channel ctx))
+ (my-nick (murk-connection-nick server))
+ (action (string-join params " "))
+ (ctcp-text (concat "\01ACTION " action "\01")))
+ (murk-send-msg server
+ (murk-msg nil nil "PRIVMSG"
+ (list channel ctcp-text)))
+ (murk-display-action server my-nick channel action))
+ (murk-display-notice nil "Usage: /me <action>"))
+ (murk-display-notice nil "No current channel."))))
+
(defun murk-command-users (_params)
(let ((ctx (murk-current-context)))
(if (and ctx (not (murk-server-context-p ctx)))