unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25349: 25.1.90; erc join -vs- passwords
@ 2017-01-03 22:32 Tom Tromey
  2017-01-04  3:47 ` Nikolay Kudryavtsev
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Tom Tromey @ 2017-01-03 22:32 UTC (permalink / raw)
  To: 25349


I'm using erc and joining a channel that has a channel password.
I've tried to put the password in my ~/.authinfo.  However, there
are two erc bugs that prevent this from working.

1. In erc-join.el, various functions do:

    (or erc-server-announced-name erc-session-server)

   I think this is backward -- the announced name is the real name of
   the host, but this can vary, so isn't useful as a .authinfo key.
   e.g., for me, erc-server-announced-name is currently "belew.mozilla.org"
   but erc-session-server is "irc.mozilla.org" -- which is what I used
   to connect and is the name I'd want to use in .authinfo.

   Changing the instances of this in erc-join.el makes auto-join work
   for me.

2. erc-cmd-JOIN does not check authinfo at all.  Maybe it should share
   this code with erc-join.el.




In GNU Emacs 25.1.90.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9)
 of 2016-12-15 built on pokyo
Repository revision: 467768f64ee109fe127619e75fee7f3b5de1fec1
Windowing system distributor 'Fedora Project', version 11.0.11804000
System Description:	Fedora release 24 (Twenty Four)

Configured using:
 'configure --prefix=/home/tromey/Emacs/install
 --with-file-notifications=no'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: JS

Minor modes in effect:
  erc-spelling-mode: t
  erc-truncate-mode: t
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  flyspell-mode: t
  which-function-mode: t
  projectile-global-mode: t
  projectile-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  flycheck-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t

Recent messages:
Expiring articles...done
Are you sure you want to quit reading news? (y or n) y
Saving Gnus registry (73035 entries) to ~/.gnus.registry.eieio...
Saving Gnus registry (size 73035) to ~/.gnus.registry.eieio...done
Saving file /home/tromey/.newsrc...
Wrote /home/tromey/.newsrc
Saving /home/tromey/.newsrc.eld...
Saving file /home/tromey/.newsrc.eld...
Wrote /home/tromey/.newsrc.eld
Saving /home/tromey/.newsrc.eld...done

Load-path shadows:
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/25.1.90/lisp/play/bubbles

Features:
(shadow emacsbug debug ffap conf-mode css-mode descr-text gud eieio-opt
speedbar sb-image ezimage dframe vc-annotate macros dwarf-mode rust-mode
doctor gnus-fun find-dired dxr tabify man perl-mode sh-script smie
executable smerge-mode etags xref project git-commit-mode find-file js
sgml-mode iso-transl mailalias bbdb-sc supercite regi mail-hist nnir
idutils python tramp-sh tramp tramp-compat tramp-loaddefs trampver
ucs-normalize git-rebase-mode derived term/xterm xterm org-element
org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view
jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs log-view gnus-html url-cache mm-url shr-color url-http url
url-proxy url-privacy url-history url-auth url-cookie url-domsuf url-gw
url-expand url-methods url-util url-parse url-vars shr dom browse-url
erc-spelling erc-truncate bbdb-gui bbdb-hooks bbdb-rmail rmailsum rmail
vc-mtn vc-hg sort smiley gnus-cite flow-fill mm-archive gnus-async
gnus-bcklg qp gnus-ml disp-table gnus-topic nndraft nnmh nnfolder utf-7
bbdb-gnus bbdb-snarf mail-extr bbdb-com network-stream nsm starttls
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp
gnus-cache gnus-registry registry eieio-compat eieio-base gnus-art mm-uu
mml2015 mm-view mml-smime smime dig mailcap gnus-sum gnus-group
gnus-undo smtpmail sendmail gnus-start gnus-cloud nnimap nnmail
mail-source tls gnutls utf7 netrc nnoo parse-time gnus-spec gnus-int
gnus-range gnus-win gnus gnus-ems nnheader dabbrev log-edit message idna
rfc822 mml mml-sec epg mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader
pcvs-util copyright misearch multi-isearch add-log bug-reference vc-bzr
vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-git diff-mode cc-mode cc-fonts
cc-guess cc-menus cc-cmds shell flyspell ispell diminish appt diary-lib
diary-loaddefs cal-menu calendar cal-loaddefs which-func imenu edmacro
kmacro projectile grep compile ibuf-ext ibuffer minimap autorevert
filenotify desktop frameset cus-start cus-load erc-notify
erc-desktop-notifications notifications dbus xml erc-services erc-list
erc-menu erc-join erc-ring erc-networks erc-pcomplete pcomplete
erc-track erc-match erc-netsplit erc-hl-nicks easy-mmode color
erc-button erc-fill erc-stamp wid-edit erc-goodies erc erc-backend
erc-compat format-spec auth-source cl-seq eieio gnus-util mm-util
help-fns mail-prsvr password-cache thingatpt pp status dired-aux dired-x
dired warnings advice vc-dir ewoc vc vc-dispatcher flycheck json map
find-func rx subr-x dash cc-styles cc-align cc-engine cc-vars cc-defs
bbdb cl timezone ange-ftp comint ansi-color ring server savehist
finder-inf bbdb-autoloads dwarf-mode-autoloads eieio-core cl-macs
lisppaste-autoloads pydoc-info-autoloads info-look weblogger-autoloads
info package epg-config seq byte-opt gv bytecomp byte-compile cl-extra
help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 4956169 2764016)
 (symbols 48 147899 536)
 (miscs 40 49685 30197)
 (strings 32 1374486 796506)
 (string-bytes 1 59281313)
 (vectors 16 171120)
 (vector-slots 8 4046984 214559)
 (floats 8 1121 2125)
 (intervals 56 350578 9418)
 (buffers 976 761)
 (heap 1024 613853 395688))

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-03 22:32 bug#25349: 25.1.90; erc join -vs- passwords Tom Tromey
@ 2017-01-04  3:47 ` Nikolay Kudryavtsev
  2017-01-04 11:07   ` Tom Tromey
  2017-01-04 15:13 ` Tom Tromey
  2017-05-06  3:47 ` bug#25349: fix checked in Tom Tromey
  2 siblings, 1 reply; 12+ messages in thread
From: Nikolay Kudryavtsev @ 2017-01-04  3:47 UTC (permalink / raw)
  To: Tom Tromey, 25349

Using authinfo.gpg works fine for me(and lots of other people). There's 
probably a problem in your configuration.

Try setting auth-source-debug to a more verbose level and see what 
messages you get.

-- 
Best Regards,
Nikolay Kudryavtsev






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-04  3:47 ` Nikolay Kudryavtsev
@ 2017-01-04 11:07   ` Tom Tromey
  2017-01-04 15:15     ` Tom Tromey
  2017-01-05  2:20     ` Nikolay Kudryavtsev
  0 siblings, 2 replies; 12+ messages in thread
From: Tom Tromey @ 2017-01-04 11:07 UTC (permalink / raw)
  To: Nikolay Kudryavtsev; +Cc: 25349, Tom Tromey

>>>>> "Nikolay" == Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com> writes:

Nikolay> Using authinfo.gpg works fine for me(and lots of other
Nikolay> people). There's probably a problem in your configuration.

Nikolay> Try setting auth-source-debug to a more verbose level and see what
Nikolay> messages you get.

What I did is debug erc-server-join-channel and notice that it was
passing in the wrong server name.  Are you specifically using authinfo
with erc and a channel password?

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-03 22:32 bug#25349: 25.1.90; erc join -vs- passwords Tom Tromey
  2017-01-04  3:47 ` Nikolay Kudryavtsev
@ 2017-01-04 15:13 ` Tom Tromey
  2017-05-06  3:47 ` bug#25349: fix checked in Tom Tromey
  2 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2017-01-04 15:13 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> I'm using erc and joining a channel that has a channel password.
Tom> I've tried to put the password in my ~/.authinfo.  However, there
Tom> are two erc bugs that prevent this from working.

This patch seems to work for me.

Tom

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 151ea15..9474b11 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -129,7 +129,7 @@ erc-autojoin-after-ident
       (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))))
@@ -166,27 +166,12 @@ erc-autojoin-channels
   ;; 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))
@@ -209,7 +194,7 @@ erc-autojoin-remove
   (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))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 3dcb7ef..3cc9f52 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3022,6 +3022,23 @@ erc-cmd-HELP
 (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
@@ -3041,10 +3058,9 @@ erc-cmd-JOIN
         (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)





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-04 11:07   ` Tom Tromey
@ 2017-01-04 15:15     ` Tom Tromey
  2017-01-05 22:36       ` Tom Tromey
  2017-01-05  2:20     ` Nikolay Kudryavtsev
  1 sibling, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2017-01-04 15:15 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349, Nikolay Kudryavtsev

I'm not sure if my earlier patch made it through.
This seems to work for me.

Tom

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 151ea15..9474b11 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -129,7 +129,7 @@ erc-autojoin-after-ident
       (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))))
@@ -166,27 +166,12 @@ erc-autojoin-channels
   ;; 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))
@@ -209,7 +194,7 @@ erc-autojoin-remove
   (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))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 3dcb7ef..3cc9f52 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3022,6 +3022,23 @@ erc-cmd-HELP
 (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
@@ -3041,10 +3058,9 @@ erc-cmd-JOIN
         (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)





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-04 11:07   ` Tom Tromey
  2017-01-04 15:15     ` Tom Tromey
@ 2017-01-05  2:20     ` Nikolay Kudryavtsev
  2017-01-05  4:43       ` Tom Tromey
  1 sibling, 1 reply; 12+ messages in thread
From: Nikolay Kudryavtsev @ 2017-01-05  2:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349

Oh, you're talking about password protected channels specifically. I 
see. Yeah, this patch makes sense.

Though one thing - I'm not sure whether you even need to use "or" here. 
Would there ever be a case where erc-session-server is nil, but there is 
erc-server-announced-name?

-- 
Best Regards,
Nikolay Kudryavtsev






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-05  2:20     ` Nikolay Kudryavtsev
@ 2017-01-05  4:43       ` Tom Tromey
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2017-01-05  4:43 UTC (permalink / raw)
  To: Nikolay Kudryavtsev; +Cc: 25349, Tom Tromey

>>>>> "Nikolay" == Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com> writes:

Nikolay> Though one thing - I'm not sure whether you even need to use "or"
Nikolay> here. Would there ever be a case where erc-session-server is nil, but
Nikolay> there is erc-server-announced-name?

I don't actually know, so I just swapped them out of paranoia.

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-04 15:15     ` Tom Tromey
@ 2017-01-05 22:36       ` Tom Tromey
  2017-01-06 15:14         ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2017-01-05 22:36 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349, Nikolay Kudryavtsev

Tom> I'm not sure if my earlier patch made it through.
Tom> This seems to work for me.

Well, it worked for an explicit /join, but didn't correctly autojoin.
I'll try to debug it some more.

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-05 22:36       ` Tom Tromey
@ 2017-01-06 15:14         ` Tom Tromey
  2017-01-10  3:35           ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2017-01-06 15:14 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349, Nikolay Kudryavtsev

Tom> Well, it worked for an explicit /join, but didn't correctly autojoin.
Tom> I'll try to debug it some more.

erc-autojoin-channels was just using the server that was passed in, but
it should have been checking erc-session-server instead, like the other
code.

The appended works for me for both autojoin and explicit join.  I want
to check it in, but it would probably be good if someone more familiar
with ERC took a look at it.

Tom

diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 151ea15..aa83ffe 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -129,7 +129,7 @@ erc-autojoin-after-ident
       (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))))
@@ -155,38 +155,24 @@ erc-autojoin-channels
     ;; `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))
@@ -209,7 +195,7 @@ erc-autojoin-remove
   (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))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 3dcb7ef..3cc9f52 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3022,6 +3022,23 @@ erc-cmd-HELP
 (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
@@ -3041,10 +3058,9 @@ erc-cmd-JOIN
         (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)





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-06 15:14         ` Tom Tromey
@ 2017-01-10  3:35           ` Tom Tromey
  2017-02-01  3:01             ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2017-01-10  3:35 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349, Nikolay Kudryavtsev

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> The appended works for me for both autojoin and explicit join.  I want
Tom> to check it in, but it would probably be good if someone more familiar
Tom> with ERC took a look at it.

Further testing revealed a bug.

The other day, at the end of the day, I did a /gquit in ERC.
Then, this morning, I reconnected.

Normally this causes ERC to associate the various channel buffers with
the new connection to the server.  However, with this patch in place,
this association did not occur and I was given a new buffer for each
channel (the old buffers being "closed").

I haven't tried debugging this any further yet.

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: 25.1.90; erc join -vs- passwords
  2017-01-10  3:35           ` Tom Tromey
@ 2017-02-01  3:01             ` Tom Tromey
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2017-02-01  3:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25349, Nikolay Kudryavtsev

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> Normally this causes ERC to associate the various channel buffers with
Tom> the new connection to the server.  However, with this patch in place,
Tom> this association did not occur and I was given a new buffer for each
Tom> channel (the old buffers being "closed").

Subsequent reconnects haven't had this problem, so I haven't been able
to debug.  Maybe I've just been lucky and haven't been connected to a
different server.

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#25349: fix checked in
  2017-01-03 22:32 bug#25349: 25.1.90; erc join -vs- passwords Tom Tromey
  2017-01-04  3:47 ` Nikolay Kudryavtsev
  2017-01-04 15:13 ` Tom Tromey
@ 2017-05-06  3:47 ` Tom Tromey
  2 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2017-05-06  3:47 UTC (permalink / raw)
  To: 25349-done

I've checked in the patch.

Tom





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-05-06  3:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-03 22:32 bug#25349: 25.1.90; erc join -vs- passwords Tom Tromey
2017-01-04  3:47 ` Nikolay Kudryavtsev
2017-01-04 11:07   ` Tom Tromey
2017-01-04 15:15     ` Tom Tromey
2017-01-05 22:36       ` Tom Tromey
2017-01-06 15:14         ` Tom Tromey
2017-01-10  3:35           ` Tom Tromey
2017-02-01  3:01             ` Tom Tromey
2017-01-05  2:20     ` Nikolay Kudryavtsev
2017-01-05  4:43       ` Tom Tromey
2017-01-04 15:13 ` Tom Tromey
2017-05-06  3:47 ` bug#25349: fix checked in Tom Tromey

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).