[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/crdt bdada96 57/80: Disconnect user command for the ser
From: |
ELPA Syncer |
Subject: |
[elpa] externals/crdt bdada96 57/80: Disconnect user command for the server |
Date: |
Sat, 28 Aug 2021 10:57:41 -0400 (EDT) |
branch: externals/crdt
commit bdada9695c15f730498aedae9c081dfb98153724
Author: Qiantan Hong <qhong@mit.edu>
Commit: Qiantan Hong <qhong@mit.edu>
Disconnect user command for the server
---
README.org | 3 +++
crdt.el | 28 +++++++++++++++++++++++-----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/README.org b/README.org
index b4db9b2..701b568 100644
--- a/README.org
+++ b/README.org
@@ -106,6 +106,9 @@ You can also press ~k~ in the session list (show it by =M-x
crdt-list-sessions=)
You can also press ~k~ in the session list (show it by =M-x
crdt-list-sessions=).
+The server Emacs has the privilege to disconnect a user from a session.
+To do so, press ~k~ on an entry in the user list (show it by =M-x
crdt-list-users=).
+
** Synchronizing Org folding status
Turn on =crdt-org-sync-overlay-mode=. All peers that have this enabled have
their
diff --git a/crdt.el b/crdt.el
index eab105a..22529e5 100644
--- a/crdt.el
+++ b/crdt.el
@@ -44,8 +44,8 @@
"Ask for server password everytime a CRDT server is to be started."
:type 'boolean)
-(defcustom crdt-confirm-stop-session t
- "Ask for confirmation when a CRDT server with some client connected is to be
stopped."
+(defcustom crdt-confirm-disconnect t
+ "Ask for confirmation when a CRDT server is to stop the connection from some
client."
:type 'boolean)
(defvar crdt--log-network-traffic nil
@@ -598,9 +598,26 @@ Otherwise use a dedicated buffer for displaying active
users on CRDT-BUFFER."
t)))
(message "Doesn't have position information for this user yet.")))))
+(defun crdt--user-menu-kill ()
+ "Disconnect the user under point in CRDT user menu.
+Only server can perform this action."
+ (interactive)
+ (if (crdt--server-p)
+ (let ((site-id (tabulated-list-get-id)))
+ (if site-id
+ (if (eq site-id (crdt--session-local-id crdt--session))
+ (message "Suicide is not allowed.")
+ (dolist (p (process-list))
+ (when (eq (process-get p 'client-id) site-id)
+ (delete-process p))))
+ (message "We somehow don't have the SITE-ID for this user.
+ Please submit a bug report to crdt.el maintainer.")))
+ (message "Only server can disconnect a user.")))
+
(defvar crdt-user-menu-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") #'crdt--user-menu-goto)
+ (define-key map (kbd "k") #'crdt--user-menu-kill)
map))
(define-derived-mode crdt-user-menu-mode tabulated-list-mode
@@ -610,9 +627,10 @@ Otherwise use a dedicated buffer for displaying active
users on CRDT-BUFFER."
("Address" 15 t)]))
(defun crdt-list-users (&optional crdt-buffer display-buffer)
- "Display a list of active users working on a CRDT-shared buffer CRDT-BUFFER.
+ "Display a list of active users working on a CRDT-shared session.
+Find the session in CRDT-BUFFER if non NIL, or current buffer.
If DISPLAY-BUFFER is provided, display the output there.
-Otherwise use a dedicated buffer for displaying active users on CRDT-BUFFER."
+Otherwise create a dedicated buffer."
(interactive)
(with-current-buffer (or crdt-buffer (current-buffer))
(unless crdt--session
@@ -1543,7 +1561,7 @@ Setup up the server with PASSWORD and assign this Emacs
DISPLAY-NAME."
(defun crdt--stop-session (session)
"Kill the CRDT SESSION.
Disconnect if it's a client session, or stop serving if it's a server session."
- (when (if (and crdt-confirm-stop-session
+ (when (if (and crdt-confirm-disconnect
(crdt--server-p session)
(crdt--session-network-clients session))
(yes-or-no-p "There are yet connected clients. Stop session? ")
- [elpa] externals/crdt 973e761 21/80: Work on Jean's todo list, (continued)
- [elpa] externals/crdt 973e761 21/80: Work on Jean's todo list, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 810af7e 32/80: fix bug when beg/end are markers in crdt--*-change, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt fbcb870 31/80: more consistent name, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 58ca0a6 34/80: documents, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 06a2f1a 46/80: added some docstrings, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 2dfff42 50/80: add license, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 1a08765 51/80: slightly cleanup protocol and doc, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt efdafb9 52/80: fix bug on emacs 25, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 8457254 47/80: fix cursor movement when remote insert/delete, add URL parsing, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 817c265 49/80: fix document, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt bdada96 57/80: Disconnect user command for the server,
ELPA Syncer <=
- [elpa] externals/crdt 7c9d7ee 64/80: avoid spitting error when POSITION-HINT out of range, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt dc72997 66/80: add mouse alias for RETs in menus, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 2889cae 67/80: change order of READY and OVERLAY-* during initial sync. not sure if this creates more problem, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 93af8b0 68/80: PoC visualize author, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 7875e6a 70/80: remove family for ipv6, ELPA Syncer, 2021/08/28
- [elpa] externals/crdt b5a8a28 71/80: Don't enable buffer process related advices by default., ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 96fbbf3 73/80: Change my email to the permanent one., ELPA Syncer, 2021/08/28
- [elpa] externals/crdt 6363427 79/80: Add indentation and debugging information to macros, ELPA Syncer, 2021/08/28