From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Victor J. Orlikowski" Newsgroups: gmane.emacs.devel Subject: [PATCH] Prevent ERC from sending spurious PART messages Date: Thu, 30 Mar 2017 15:41:32 -0400 Message-ID: <6E627702-A0E8-47A6-8794-D90050E2CC13.notmuch@alumni.duke.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1490906186 3623 195.159.176.226 (30 Mar 2017 20:36:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 30 Mar 2017 20:36:26 +0000 (UTC) User-Agent: Notmuch/0.22.2 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-apple-darwin15.6.0) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 30 22:36:21 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctgng-0007dv-36 for ged-emacs-devel@m.gmane.org; Thu, 30 Mar 2017 22:36:08 +0200 Original-Received: from localhost ([::1]:37551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctgnm-0005oz-50 for ged-emacs-devel@m.gmane.org; Thu, 30 Mar 2017 16:36:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctfx2-00037m-PR for emacs-devel@gnu.org; Thu, 30 Mar 2017 15:41:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctfwz-0006eh-NK for emacs-devel@gnu.org; Thu, 30 Mar 2017 15:41:44 -0400 Original-Received: from mailout.easymail.ca ([64.68.201.169]:36387) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctfwz-0006eV-J2 for emacs-devel@gnu.org; Thu, 30 Mar 2017 15:41:41 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 42B15E3A9 for ; Thu, 30 Mar 2017 15:41:39 -0400 (EDT) Original-Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (easymail-mailout.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bWBllCOdxuza for ; Thu, 30 Mar 2017 15:41:37 -0400 (EDT) Original-Received: from critterling.garfield.home (unknown [50.111.97.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 26956E32E for ; Thu, 30 Mar 2017 15:41:35 -0400 (EDT) Original-Received: from localhost (tplink.garfield.home [192.168.8.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by critterling.garfield.home (Postfix) with ESMTPSA id 8D47B33A for ; Thu, 30 Mar 2017 15:41:34 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 64.68.201.169 X-Mailman-Approved-At: Thu, 30 Mar 2017 16:35:18 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:213537 Archived-At: In the existing code, ERC can send a spurious PART message to the server, if a given channel has already been closed, through the operation of erc-channel-hook. The following patch ensures that erc-channel-hook checks to see that the channel is still live, before sending the PART message. >From 05994f7f170bd75c9af6b1990d6d7ce1b9a28875 Mon Sep 17 00:00:00 2001 From: "Victor J. Orlikowski" Date: Thu, 30 Mar 2017 13:13:34 -0400 Subject: [PATCH 2/2] Ensure that PART doesn't get sent to an already-PARTed channel. --- lisp/erc/erc.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 488404d..357d03c 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -6735,9 +6735,10 @@ This function should be on `erc-kill-server-hook'." This function should be on `erc-kill-channel-hook'." (when (erc-server-process-alive) (let ((tgt (erc-default-target))) - (erc-server-send (format "PART %s :%s" tgt - (funcall erc-part-reason nil)) - nil tgt)))) + (unless (not tgt) + (erc-server-send (format "PART %s :%s" tgt + (funcall erc-part-reason nil)) + nil tgt))))) ;;; Dealing with `erc-parsed' -- 2.10.1 (Apple Git-78) Best, Victor -- Victor J. Orlikowski <> victor.j.orlikowski@alumni.duke.edu