unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: 19034@debbugs.gnu.org
Subject: bug#19034: [PATCH v1] Fix errors generated when multiple IRC clients talk to a single IRC proxy.
Date: Thu, 13 Nov 2014 06:19:07 +0000	[thread overview]
Message-ID: <cunwq6zipwk.fsf@gargravarr.hh.sledj.net> (raw)
In-Reply-To: <cun389ojhvr.fsf@gargravarr.hh.sledj.net> (David Edmondson's message of "Wed, 12 Nov 2014 20:14:48 +0000")

If multiple IRC clients are connected to a single IRC proxy, an
instance of erc can receive the response to a NAMES request issued by
another client. Given that this instance of erc didn't initiate the
NAMES request, `erc-channel-begin-receiving-names' will not have been
called and `erc-channel-new-member-names' will be nil.

To avoid this causing problems, initialise
`erc-channel-new-member-names' by calling
`erc-channel-begin-receiving-names' if it is nil.
---

Michael Olson asked me to send this to emacs-devel after I had posted it
to erc-discuss. I'm not subscribed to the list - please include me
directly in any replies.

 erc.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/erc.el b/erc.el
index 6e37f36..320cc02 100644
--- a/erc.el
+++ b/erc.el
@@ -4539,11 +4539,12 @@ received.  Should be called with the current buffer set to the
 channel buffer.
 
 See also `erc-channel-begin-receiving-names'."
-  (maphash (lambda (nick user)
-	     (if (null (gethash nick erc-channel-new-member-names))
-		 (erc-remove-channel-user nick)))
-	   erc-channel-users)
-  (setq erc-channel-new-member-names nil))
+  (when erc-channel-new-member-names
+    (maphash (lambda (nick user)
+	       (if (null (gethash nick erc-channel-new-member-names))
+		   (erc-remove-channel-user nick)))
+	     erc-channel-users)
+    (setq erc-channel-new-member-names nil)))
 
 (defun erc-parse-prefix ()
   "Return an alist of valid prefix character types and their representations.
@@ -4600,6 +4601,11 @@ channel."
 		  op 'off
 		  voice 'off))
 	  (when updatep
+	    ;; If we didn't issue the NAMES request (consider two clients
+	    ;; talking to an IRC proxy), `erc-channel-begin-receiving-names'
+	    ;; will not have been called, so we have to do it here.
+	    (unless erc-channel-new-member-names
+	      (erc-channel-begin-receiving-names))
 	    (puthash (erc-downcase name) t
 		     erc-channel-new-member-names)
 	    (erc-update-current-channel-member
-- 
2.1.0






  reply	other threads:[~2014-11-13  6:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 20:14 bug#19034: 24.4; erc mishandles a response to a NAMES request that it did not initiate David Edmondson
2014-11-13  6:19 ` David Edmondson [this message]
2015-12-27 20:33   ` bug#19034: [PATCH v1] Fix errors generated when multiple IRC clients talk to a single IRC proxy Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cunwq6zipwk.fsf@gargravarr.hh.sledj.net \
    --to=dme@dme.org \
    --cc=19034@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).