From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Edmondson Newsgroups: gmane.emacs.devel Subject: [PATCH v1] Fix errors generated when multiple IRC clients talk to a single IRC proxy. Date: Wed, 8 Oct 2014 15:03:17 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412851358 25363 80.91.229.3 (9 Oct 2014 10:42:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Oct 2014 10:42:38 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 09 12:42:32 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XcBB1-0006XF-BH for ged-emacs-devel@m.gmane.org; Thu, 09 Oct 2014 12:42:31 +0200 Original-Received: from localhost ([::1]:41682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcBB0-0005W8-Qp for ged-emacs-devel@m.gmane.org; Thu, 09 Oct 2014 06:42:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcB10-0003XJ-13 for emacs-devel@gnu.org; Thu, 09 Oct 2014 06:32:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XcB0r-0004tG-03 for emacs-devel@gnu.org; Thu, 09 Oct 2014 06:32:09 -0400 Original-Received: from mail-wg0-f51.google.com ([74.125.82.51]:38875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcB0q-0004t8-R2 for emacs-devel@gnu.org; Thu, 09 Oct 2014 06:32:00 -0400 Original-Received: by mail-wg0-f51.google.com with SMTP id b13so916805wgh.22 for ; Thu, 09 Oct 2014 03:32:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:date:user-agent:from:message-id :mime-version:content-type; bh=KwItcOZtiDe/Ze7KC7vB/zqz7eR+qmwQveIvhXFX7jQ=; b=VuJ6gT3zCQYrT42UjAmTpcn1eSfYk0pBAd0gsx2Ai0/bm5857daIvn3JMjGiPty2i2 RR52cvOFq7feeRusqQcp5z7P0A19sC8bnKzevNkfc8BxHQz3CMo3f8pYIakZIr2Or2rV gi2ojI9oDkdsPn/R+6fgVBgQcQtsUjTndfb7gO7/P7xF2s8/U6FUxNt40MDX33uVnjc+ bHKw/rj/ZNDs2Ic2AS1BYh5cCzLCaONJmIq5KgfegakUYpOZ1li0x+hvliR+Ap9ZZc/Q XvbQz6vozu7TnH5mjnDSpJAapozuV/eeFZNvvwhdO2k5c80UnivyzI2D+U70xKOzm3V6 ewVw== X-Gm-Message-State: ALoCoQkPg4DqRZwHmwkLGTmTOycQgkn9g9Nmkgrby7Ia2r5a8jrf9vNlKR7xExjNRWn6PEc8rMJv X-Received: by 10.194.201.232 with SMTP id kd8mr2942816wjc.88.1412850719912; Thu, 09 Oct 2014 03:31:59 -0700 (PDT) Original-Received: from localhost ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) by mx.google.com with ESMTPSA id b6sm5088415wiy.22.2014.10.09.03.31.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Oct 2014 03:31:59 -0700 (PDT) User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.51 X-Mailman-Approved-At: Thu, 09 Oct 2014 06:42:28 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:175179 Archived-At: 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