* [PATCH] Prevent ERC from sending spurious PART messages
@ 2017-03-30 19:41 Victor J. Orlikowski
2017-03-30 22:02 ` Andreas Schwab
2017-03-30 22:56 ` [PATCH] v2: " Victor J. Orlikowski
0 siblings, 2 replies; 4+ messages in thread
From: Victor J. Orlikowski @ 2017-03-30 19:41 UTC (permalink / raw)
To: emacs-devel
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" <vjo@duke.edu>
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Prevent ERC from sending spurious PART messages
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 ` [PATCH] v2: " Victor J. Orlikowski
1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2017-03-30 22:02 UTC (permalink / raw)
To: Victor J. Orlikowski; +Cc: emacs-devel
On Mär 30 2017, "Victor J. Orlikowski" <victor.j.orlikowski@alumni.duke.edu> wrote:
> 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)
(unless (not)) == (when)
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Prevent ERC from sending spurious PART messages
2017-03-30 22:02 ` Andreas Schwab
@ 2017-03-30 22:18 ` Victor J. Orlikowski
0 siblings, 0 replies; 4+ messages in thread
From: Victor J. Orlikowski @ 2017-03-30 22:18 UTC (permalink / raw)
To: Andreas Schwab; +Cc: emacs-devel
Works for me. Glad to re-submit shortly.
Best,
Victor
--
Victor J. Orlikowski <> victor.j.orlikowski@alumni.duke.edu
> On Mar 30, 2017, at 6:02 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>
>> On Mär 30 2017, "Victor J. Orlikowski" <victor.j.orlikowski@alumni.duke.edu> wrote:
>>
>> 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)
>
> (unless (not)) == (when)
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] v2: Prevent ERC from sending spurious PART messages
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:56 ` Victor J. Orlikowski
1 sibling, 0 replies; 4+ messages in thread
From: Victor J. Orlikowski @ 2017-03-30 22:56 UTC (permalink / raw)
To: emacs-devel
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-30 22:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] v2: " Victor J. Orlikowski
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).