From 21741b85e543473d37a35afb643e45398eff1a7e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 16 Feb 2022 23:05:55 -0600 Subject: Add chat-disconnect --- lisp/acdw.el | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'lisp/acdw.el') diff --git a/lisp/acdw.el b/lisp/acdw.el index 99e5c1e..d7b25c7 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -277,18 +277,34 @@ always nil; this function is mostly intended for use in init." :type '(repeat function) :group 'applications) +(defun chat-disconnect () + "Disconnect from all chats." + (interactive) + (ignore-errors + (circe-command-GQUIT "☮ 🫀 🍞")) + (ignore-errors + (jabber-disconnect)) + (dolist (team +slack-teams) + (ignore-errors + (slack-team-disconnect team))) + (ignore-errors (slack-ws-close)) + (+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally." + (let ((kill-buffer-query-functions nil)) + (tracking-remove-buffer (current-buffer)) + (kill-buffer))) + (lambda () "Return t if derived from the following modes." + (derived-mode-p 'lui-mode + 'jabber-chat-mode + 'jabber-roster-mode + 'jabber-browse-mode + 'slack-mode)))) + ;; I can never remember all the damn chat things I run, so this just does all of em. (defun chat (&optional arg) "Initiate all chat functions. With optional ARG, kill all chat-related buffers first." (interactive "P") - (when arg - (ignore-errors - (circe-command-GQUIT "Reconnecting") - (+mapc-some-buffers #'kill-buffer (lambda () (derived-mode-p 'lui-mode))) - (jabber-disconnect) - ;; XXX: Slack ? - )) + (when arg (chat-disconnect)) (mapc #'call-interactively chat-functions)) (defun +forward-paragraph (arg) -- cgit 1.4.1-21-gabe81