X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ea283d21fc5697f112fa19b8fce1d5042b377132..058e8562775571790e48b1614e84a9617a9e1e17:/lisp/erc/erc-join.el diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el index 0a24cb864d..1fbafe0089 100644 --- a/lisp/erc/erc-join.el +++ b/lisp/erc/erc-join.el @@ -1,6 +1,6 @@ ;;; erc-join.el --- autojoin channels on connect and reconnects -;; Copyright (C) 2002-2004, 2006-2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2004, 2006-2016 Free Software Foundation, Inc. ;; Author: Alex Schroeder ;; Maintainer: emacs-devel@gnu.org @@ -83,7 +83,7 @@ If the value is `ident', autojoin after successful NickServ identification, or after `erc-autojoin-delay' seconds. Any other value means the same as `connect'." :group 'erc-autojoin - :version "24.5" + :version "24.1" :type '(choice (const :tag "On Connection" connect) (const :tag "When Identified" ident))) @@ -93,7 +93,7 @@ This only takes effect if `erc-autojoin-timing' is `ident'. If NickServ identification occurs before this delay expires, ERC autojoins immediately at that time." :group 'erc-autojoin - :version "24.5" + :version "24.1" :type 'integer) (defcustom erc-autojoin-domain-only t @@ -156,7 +156,13 @@ This function is run from `erc-nickserv-identified-hook'." (dolist (l erc-autojoin-channels-alist) (when (string-match (car l) server) (dolist (chan (cdr l)) - (erc-server-join-channel server chan))))) + (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) @@ -170,7 +176,7 @@ This function is run from `erc-nickserv-identified-hook'." (password (if (functionp secret) (funcall secret) secret))) - (erc-server-send (concat "join " channel + (erc-server-send (concat "JOIN " channel (if password (concat " " password) "")))))