From 195d57c93b1fa23b51b6feb7a8f0973c0051a508 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Fri, 4 Jun 2021 16:32:14 +0200 Subject: [PATCH 06/11] Recognize quoted commands in rcirc-process-input-line --- lisp/net/rcirc.el | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index ab5634d75d..040eb60538 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1385,8 +1385,8 @@ rcirc-fill-paragraph (fill-region (point-min) (point-max) justify))))) (defun rcirc-process-input-line (line) - (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line) "Process LINE as a message or a command." + (if (string-match "^/\\([^/ ][^ ]*\\) ?\\(.*\\)$" line) (rcirc-process-command (match-string 1 line) (match-string 2 line) line) @@ -1401,28 +1401,23 @@ rcirc-process-message (setq rcirc-last-post-time (current-time)))) (defun rcirc-process-command (command args line) - (if (eq (aref command 0) ?/) - ;; "//text" will send "/text" as a message - (rcirc-process-message (substring line 1)) - (let ((fun (intern-soft (concat "rcirc-cmd-" command))) - (process (rcirc-buffer-process))) - (newline) - (with-current-buffer (current-buffer) - (delete-region rcirc-prompt-end-marker (point)) - (if (string= command "me") - (rcirc-print process (rcirc-buffer-nick) - "ACTION" rcirc-target args) "Process COMMAND with arguments ARGS. LINE is the raw input, from which COMMAND and ARGS was extracted." + (let ((fun (intern-soft (concat "rcirc-cmd-" command))) + (process (rcirc-buffer-process))) + (newline) + (with-current-buffer (current-buffer) + (delete-region rcirc-prompt-end-marker (point)) + (if (string= command "me") (rcirc-print process (rcirc-buffer-nick) - "COMMAND" rcirc-target line)) - (set-marker rcirc-prompt-end-marker (point)) - (if (fboundp fun) - (funcall fun args process rcirc-target) - (rcirc-send-string process - (concat command " :" args))))))) - + "ACTION" rcirc-target args) + (rcirc-print process (rcirc-buffer-nick) + "COMMAND" rcirc-target line)) + (set-marker rcirc-prompt-end-marker (point)) + (if (fboundp fun) + (funcall fun args process rcirc-target) + (rcirc-send-string process command : args))))) (defvar-local rcirc-parent-buffer nil "Message buffer that requested a multiline buffer.") -- 2.30.2