emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/ement c2c26a3fc1 1/4: Change: (ement-connect) S


From: ELPA Syncer
Subject: [elpa] externals-release/ement c2c26a3fc1 1/4: Change: (ement-connect) Set device_id and initial_device_display_name
Date: Fri, 31 Mar 2023 05:58:12 -0400 (EDT)

branch: externals-release/ement
commit c2c26a3fc1f61bdf98305dca97146c36b7b6c057
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Change: (ement-connect) Set device_id and initial_device_display_name
    
    Fixes #134.  Thanks to Arto Jantunen (@viiru-) for reporting.
---
 README.org | 1 +
 ement.el   | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/README.org b/README.org
index c2b647066e..dfd801067e 100644
--- a/README.org
+++ b/README.org
@@ -301,6 +301,7 @@ Note that, while ~matrix-client~ remains usable, and 
probably will for some time
 + Command ~ement-room-toggle-space~ toggles a room's membership in a space (a 
way to group rooms in Matrix).
 + Visibility of sections in the room list is saved across sessions.
 + Command ~ement-room-list-kill-buffer~ kills a room's buffer from the room 
list.
++ Set ~device_id~ and ~initial_device_display_name~ upon login (e.g. 
=Ement.el: username@hostname=).  
([[https://github.com/alphapapa/ement.el/issues/134][#134]].  Thanks to 
[[https://github.com/viiru-][Arto Jantunen]] for reporting.)
 
 *Changes*
 
diff --git a/ement.el b/ement.el
index 4ed698e7c6..02ebc22e4c 100644
--- a/ement.el
+++ b/ement.el
@@ -229,8 +229,14 @@ the port, e.g.
                       (uri-prefix (or uri-prefix (ement--hostname-uri 
server-name)))
                       (user (make-ement-user :id user-id :username username))
                       (server (make-ement-server :name server-name :uri-prefix 
uri-prefix))
-                      (transaction-id (ement--initial-transaction-id)))
+                      (transaction-id (ement--initial-transaction-id))
+                      (initial-device-display-name (format "Ement.el: %s@%s"
+                                                           ;; Just to be extra 
careful:
+                                                           (or user-login-name 
"[unknown user-login-name]")
+                                                           (or (system-name) 
"[unknown system-name]")))
+                      (device-id (secure-hash 'sha256 
initial-device-display-name)))
                  (make-ement-session :user user :server server :transaction-id 
transaction-id
+                                     :device-id device-id 
:initial-device-display-name initial-device-display-name
                                      :events (make-hash-table :test #'equal))))
               (password-login
                () (pcase-let* (((cl-struct ement-session user device-id 
initial-device-display-name) session)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]