all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Victor J. Orlikowski" <victor.j.orlikowski@alumni.duke.edu>
To: emacs-devel@gnu.org
Subject: [PATCH] v2: Prevent ERC from sending spurious PART messages
Date: Thu, 30 Mar 2017 18:56:23 -0400	[thread overview]
Message-ID: <035D481B-379D-42CF-9257-49CAC859C0B3.notmuch@alumni.duke.edu> (raw)
In-Reply-To: 6E627702-A0E8-47A6-8794-D90050E2CC13.notmuch@alumni.duke.edu

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" <vjo@duke.edu>
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



      parent reply	other threads:[~2017-03-30 22:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 19:41 [PATCH] Prevent ERC from sending spurious PART messages Victor J. Orlikowski
2017-03-30 22:02 ` Andreas Schwab
2017-03-30 22:18   ` Victor J. Orlikowski
2017-03-30 22:56 ` Victor J. Orlikowski [this message]

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

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

  git send-email \
    --in-reply-to=035D481B-379D-42CF-9257-49CAC859C0B3.notmuch@alumni.duke.edu \
    --to=victor.j.orlikowski@alumni.duke.edu \
    --cc=emacs-devel@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.