summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/erc/erc.el2
-rw-r--r--test/lisp/erc/erc-tests.el15
2 files changed, 13 insertions, 4 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 9fa17365356..8e2bb833605 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2965,7 +2965,7 @@ Commands for which no erc-cmd-xxx exists, are tunneled through
this function. LINE is sent to the server verbatim, and
therefore has to contain the command itself as well."
(erc-log (format "cmd: DEFAULT: %s" line))
- (erc-server-send (substring line 1))
+ (erc-server-send (string-trim-right (substring line 1) "[\r\n]"))
t)
(defvar erc--read-time-period-history nil)
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 685f4e2bea2..b2dbc1012de 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -236,6 +236,7 @@
(let (erc-server-last-sent-time
erc-server-flood-queue
(orig-erc-cmd-MSG (symbol-function 'erc-cmd-MSG))
+ (erc-default-recipients '("#chan"))
calls)
(with-temp-buffer
(cl-letf (((symbol-function 'erc-cmd-MSG)
@@ -247,9 +248,7 @@
((symbol-function 'erc-server-process-alive)
(lambda () t))
((symbol-function 'erc-server-send-queue)
- #'ignore)
- ((symbol-function 'erc-default-target)
- (lambda () "" "#chan")))
+ #'ignore))
(ert-info ("Dispatch to user command handler")
@@ -259,6 +258,16 @@
(should (equal (pop erc-server-flood-queue)
'("PRIVMSG #chan :hi\r\n" . utf-8))))
+ (ert-info ("Quote preserves line intact")
+ (erc-process-input-line "/QUOTE FAKE foo bar\n")
+ (should (equal (pop erc-server-flood-queue)
+ '("FAKE foo bar\r\n" . utf-8))))
+
+ (ert-info ("Unknown command respected")
+ (erc-process-input-line "/FAKE foo bar\n")
+ (should (equal (pop erc-server-flood-queue)
+ '("FAKE foo bar\r\n" . utf-8))))
+
(ert-info ("Spaces preserved")
(erc-process-input-line "/msg #chan hi you\n")
(should (equal (pop calls) " #chan hi you"))