(setf (erc-response.contents parsed) msg)
(setq buffer (erc-get-buffer (if privp nick tgt) proc))
;; Even worth checking for empty target here? (invalid anyway)
- (unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0)))
- (if (and privp msgp (not (erc-is-message-ctcp-and-not-action-p msg)))
+ (unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0))
+ (erc-is-message-ctcp-and-not-action-p msg))
+ (if privp
(when erc-auto-query
(let ((erc-join-buffer erc-auto-query))
(setq buffer (erc--open-target nick))))
+ ;; A channel buffer has been killed but is still joined
(setq buffer (erc--open-target tgt))))
(when buffer
(with-current-buffer buffer
(const :tag "Use current buffer" buffer)
(const :tag "Use current buffer" t)))
-;; FIXME either retire this or put it to use or more clearly explain
-;; what it's supposed to do. It's currently only used by the obsolete
+;; FIXME either retire this or put it to use after determining how
+;; it's meant to work. Clearly, the doc string does not describe
+;; current behavior. It's currently only used by the obsolete
;; function `erc-auto-query'.
(defcustom erc-query-on-unjoined-chan-privmsg t
"If non-nil create query buffer on receiving any PRIVMSG at all.
(should-not (get-buffer "$*"))))
+(ert-deftest erc-scenarios-dcc-chat-accept ()
+ :tags '(:expensive-test)
+ (erc-scenarios-common-with-cleanup
+ ((erc-scenarios-common-dialog "dcc/chat")
+ (dcc-server (erc-d-run "127.0.0.1" t "erc-dcc-server" 'accept-dcc
+ :ending "\n"))
+ (dcc-port (process-contact dcc-server :service))
+ (dumb-server (erc-d-run "localhost" t 'accept :tmpl-vars
+ `((port . ,(number-to-string dcc-port)))))
+ (port (process-contact dumb-server :service))
+ (expect (erc-d-t-make-expecter)))
+
+ (ert-info ("Connect to foonet")
+ (with-current-buffer (erc :server "127.0.0.1"
+ :port port
+ :nick "tester"
+ :password "changeme"
+ :full-name "tester")
+ (should (string= (buffer-name) (format "127.0.0.1:%d" port)))))
+
+ (ert-info ("Offer received")
+ (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "foonet"))
+ (funcall expect 10 "DCC: chat offered by dummy")
+ (erc-cmd-DCC "CHAT" "dummy")))
+
+ ;; Regression
+ (erc-d-t-ensure-for 1 (not (get-buffer "tester")))
+
+ ;; Becomes current buffer by default (because `erc-join-buffer')
+ (erc-d-t-wait-for 10 (get-buffer "DCC-CHAT-dummy"))
+
+ (with-current-buffer "foonet"
+ (funcall expect 10 "*** DCC: accepting chat from dummy"))
+
+ (ert-info ("Chat with dummy")
+ (with-current-buffer "DCC-CHAT-dummy"
+ (erc-scenarios-common-say "Hi")
+ (funcall expect 10 "Hola")))))
+
;;; erc-scenarios-misc.el ends here
--- /dev/null
+;; -*- mode: lisp-data; -*-
+((open 10 "Hi")
+ (0 "Hola"))
--- /dev/null
+;; -*- mode: lisp-data; -*-
+((pass 1 "PASS :changeme"))
+((nick 1 "NICK tester"))
+((user 1 "USER user 0 * :tester")
+ (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
+ (0 ":irc.foonet.org 002 tester :Your host is irc.foonet.org, running version oragono-2.6.0-7481bf0385b95b16")
+ (0 ":irc.foonet.org 003 tester :This server was created Mon, 31 May 2021 09:56:24 UTC")
+ (0 ":irc.foonet.org 004 tester irc.foonet.org oragono-2.6.0-7481bf0385b95b16 BERTZios CEIMRUabefhiklmnoqstuv Iabefhkloqv")
+ (0 ":irc.foonet.org 005 tester AWAYLEN=390 BOT=B CASEMAPPING=ascii CHANLIMIT=#:100 CHANMODES=Ibe,k,fl,CEMRUimnstu CHANNELLEN=64 CHANTYPES=# ELIST=U EXCEPTS EXTBAN=,m FORWARD=f INVEX KICKLEN=390 :are supported by this server")
+ (0 ":irc.foonet.org 005 tester MAXLIST=beI:60 MAXTARGETS=4 MODES MONITOR=100 NETWORK=foonet NICKLEN=32 PREFIX=(qaohv)~&@%+ STATUSMSG=~&@%+ TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,USERHOST:10,PRIVMSG:4,TAGMSG:4,NOTICE:4,MONITOR:100 TOPICLEN=390 UTF8MAPPING=rfc8265 UTF8ONLY WHOX :are supported by this server")
+ (0 ":irc.foonet.org 005 tester draft/CHATHISTORY=100 :are supported by this server")
+ (0 ":irc.foonet.org 251 tester :There are 0 users and 4 invisible on 1 server(s)")
+ (0 ":irc.foonet.org 252 tester 0 :IRC Operators online")
+ (0 ":irc.foonet.org 254 tester 2 :channels formed")
+ (0 ":irc.foonet.org 255 tester :I have 4 clients and 0 servers")
+ (0 ":irc.foonet.org 265 tester 4 4 :Current local users 4, max 4")
+ (0 ":irc.foonet.org 266 tester 4 4 :Current global users 4, max 4")
+ (0 ":irc.foonet.org 422 tester :MOTD File is missing"))
+
+((mode-user 1.2 "MODE tester +i")
+ ;; No mode answer
+ (0 ":irc.foonet.org NOTICE tester :This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.")
+ (0.2 ":dummy!~u@34n9brushbpj2.irc PRIVMSG tester :\C-aDCC CHAT chat 2130706433 " port "\C-a"))