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] v2: Prevent ERC from sending spurious PART messages Date: Thu, 30 Mar 2017 18:56:23 -0400 Message-ID: <035D481B-379D-42CF-9257-49CAC859C0B3.notmuch@alumni.duke.edu> References: <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 1490914632 12963 195.159.176.226 (30 Mar 2017 22:57:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 30 Mar 2017 22:57:12 +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 Fri Mar 31 00:57:09 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 1ctj08-0002tM-JI for ged-emacs-devel@m.gmane.org; Fri, 31 Mar 2017 00:57:08 +0200 Original-Received: from localhost ([::1]:38005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctj0E-00025F-GA for ged-emacs-devel@m.gmane.org; Thu, 30 Mar 2017 18:57:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctiza-00023k-SE for emacs-devel@gnu.org; Thu, 30 Mar 2017 18:56:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctizX-000598-Qk for emacs-devel@gnu.org; Thu, 30 Mar 2017 18:56:34 -0400 Original-Received: from mailout.easymail.ca ([64.68.201.169]:49001) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctizX-00058X-Ls for emacs-devel@gnu.org; Thu, 30 Mar 2017 18:56:31 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id EB694E2E9 for ; Thu, 30 Mar 2017 18:56:29 -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 3Q24CT57EkVc for ; Thu, 30 Mar 2017 18:56:28 -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 8F3B4E32E for ; Thu, 30 Mar 2017 18:56:25 -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 9417933A for ; Thu, 30 Mar 2017 18:56:24 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 64.68.201.169 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:213540 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. This revised version of my initial patch uses the clearer "when" rather than "(unless (not))". >From aae0ca46992337e9d27e85272e52e671ccd5e205 Mon Sep 17 00:00:00 2001 From: "Victor J. Orlikowski" Date: Thu, 30 Mar 2017 18:53:15 -0400 Subject: [PATCH 4/4] Prevent erc-kill-channel from sending spurious PART messages if channel is not active. --- 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..fca19de 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)))) + (when 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