(setq erc--autojoin-timer
(erc-cancel-timer erc--autojoin-timer)))
(when (eq erc-autojoin-timing 'ident)
- (let ((server (or erc-server-announced-name erc-session-server))
+ (let ((server (or erc-session-server erc-server-announced-name))
(joined (mapcar (lambda (buf)
(with-current-buffer buf (erc-default-target)))
(erc-channel-list erc-server-process))))
;; `erc-autojoin-timing' is `connect':
(dolist (l erc-autojoin-channels-alist)
(when (string-match (car l) server)
- (dolist (chan (cdr l))
- (let ((buffer (erc-get-buffer chan)))
- ;; Only auto-join the channels that we aren't already in
- ;; using a different nick.
- (when (or (not buffer)
- (not (with-current-buffer buffer
- (erc-server-process-alive))))
- (erc-server-join-channel server chan)))))))
+ (let ((server (or erc-session-server erc-server-announced-name)))
+ (dolist (chan (cdr l))
+ (let ((buffer (erc-get-buffer chan)))
+ ;; Only auto-join the channels that we aren't already in
+ ;; using a different nick.
+ (when (or (not buffer)
+ (not (with-current-buffer buffer
+ (erc-server-process-alive))))
+ (erc-server-join-channel server chan))))))))
;; Return nil to avoid stomping on any other hook funcs.
nil)
-(defun erc-server-join-channel (server channel)
- (let* ((secret (plist-get (nth 0 (auth-source-search
- :max 1
- :host server
- :port "irc"
- :user channel))
- :secret))
- (password (if (functionp secret)
- (funcall secret)
- secret)))
- (erc-server-send (concat "JOIN " channel
- (if password
- (concat " " password)
- "")))))
-
(defun erc-autojoin-add (proc parsed)
"Add the channel being joined to `erc-autojoin-channels-alist'."
(let* ((chnl (erc-response.contents parsed))
(nick (car (erc-parse-user (erc-response.sender parsed))))
(server (with-current-buffer (process-buffer proc)
- (or erc-server-announced-name erc-session-server))))
+ (or erc-session-server erc-server-announced-name))))
(when (erc-current-nick-p nick)
(when (and erc-autojoin-domain-only
(string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
(let* ((chnl (car (erc-response.command-args parsed)))
(nick (car (erc-parse-user (erc-response.sender parsed))))
(server (with-current-buffer (process-buffer proc)
- (or erc-server-announced-name erc-session-server))))
+ (or erc-session-server erc-server-announced-name))))
(when (erc-current-nick-p nick)
(when (and erc-autojoin-domain-only
(string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
(defalias 'erc-cmd-H 'erc-cmd-HELP)
(put 'erc-cmd-HELP 'process-not-needed t)
+(defun erc-server-join-channel (server channel &optional secret)
+ (let* ((secret (or secret
+ (plist-get (nth 0 (auth-source-search
+ :max 1
+ :host server
+ :port "irc"
+ :user channel))
+ :secret)))
+ (password (if (functionp secret)
+ (funcall secret)
+ secret)))
+ (erc-log (format "cmd: JOIN: %s" channel))
+ (erc-server-send (concat "JOIN " channel
+ (if password
+ (concat " " password)
+ "")))))
+
(defun erc-cmd-JOIN (channel &optional key)
"Join the channel given in CHANNEL, optionally with KEY.
If CHANNEL is specified as \"-invite\", join the channel to which you
(if (erc-member-ignore-case chnl joined-channels)
(switch-to-buffer (car (erc-member-ignore-case chnl
joined-channels)))
- (erc-log (format "cmd: JOIN: %s" chnl))
- (erc-server-send (if (and chnl key)
- (format "JOIN %s %s" chnl key)
- (format "JOIN %s" chnl)))))))
+ (let ((server (with-current-buffer (process-buffer erc-server-process)
+ (or erc-session-server erc-server-announced-name))))
+ (erc-server-join-channel server chnl key))))))
t)
(defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN)