From: Francis L. <fr...@wo...> - 2002-12-21 21:01:34
|
ERC Developers, Current ERC behavior is: When a channel buffer is killed, ERC sends "PART #channelname :Killed buffer" to the server. When a server buffer is killed, ERC does not send a QUIT command to the server. This patch enables a user to set the variable erc-kill-channel-part-reason to configure the PART reason message. The default value of erc-kill-channel-part-reason is "Killed buffer". This patch also causes a QUIT command to be sent when a server buffer is killed. The QUIT reason message is computed using (erc-quit-reason nil). Hope this helps. -- Francis Litterio fr...@wo... http://world.std.com/~franl/ GPG and PGP public keys available on keyservers. --- erc.el 21 Dec 2002 20:04:19 -0000 1.365 +++ erc.el 21 Dec 2002 20:59:59 -0000 @@ -6338,20 +6338,27 @@ (setq imenu-create-index-function 'erc-create-imenu-index))) (autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function") -(defcustom erc-kill-server-hook nil +(defcustom erc-kill-server-hook '(erc-kill-server) "*Invoked whenever a server-buffer is killed via `kill-buffer'." :group 'erc-hooks :type 'hook) + (defcustom erc-kill-channel-hook '(erc-save-buffer-in-logs erc-kill-channel) "*Invoked whenever a channel-buffer is killed via `kill-buffer'." :group 'erc-hooks :type 'hook) + (defcustom erc-kill-buffer-hook '(erc-save-buffer-in-logs) "*Invoked whenever a buffer other than server or channel buffer is killed via `kill-buffer'." :group 'erc-hooks :type 'hook) +(defcustom erc-kill-channel-part-reason "Killed buffer" + "*The parting message used when a channel buffer is killed." + :group 'erc + :type 'string) + (defun erc-kill-buffer-function () (when (eq major-mode 'erc-mode) (cond @@ -6363,10 +6370,15 @@ (t (run-hooks 'erc-kill-buffer-hook))))) +(defun erc-kill-server () + "Sends a QUIT command to the server when the server buffer is killed. This +function is added to erc-kill-server-hook by default." + (erc-send-command (format "QUIT :%s" (erc-quit-reason nil)))) + (defun erc-kill-channel () (erc-send-command - (format "PART %s :Killed buffer" - (erc-default-target)))) + (format "PART %s :%s" + (erc-default-target) erc-kill-channel-part-reason))) (add-hook 'kill-buffer-hook 'erc-kill-buffer-function) |