aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-05-07 11:56:21 +0300
committerTulir Asokan <tulir@maunium.net>2020-05-07 11:56:21 +0300
commite1b38bb20268a755ce63efb3e8894f983eedc02e (patch)
tree53afb7354ac1417a8d79fd14d723131c52427c8a /ui
parent2b07b80e64e0c1ebe1673a5a534398f1fb8ad086 (diff)
Add command to get e2ee fingerprint
Diffstat (limited to 'ui')
-rw-r--r--ui/command-processor.go2
-rw-r--r--ui/commands.go19
2 files changed, 16 insertions, 5 deletions
diff --git a/ui/command-processor.go b/ui/command-processor.go
index 10478cc..7a67d77 100644
--- a/ui/command-processor.go
+++ b/ui/command-processor.go
@@ -134,6 +134,8 @@ func NewCommandProcessor(parent *MainView) *CommandProcessor {
"hprof": cmdHeapProfile,
"cprof": cmdCPUProfile,
"trace": cmdTrace,
+
+ "fingerprint": cmdFingerprint,
},
}
}
diff --git a/ui/commands.go b/ui/commands.go
index 02d2a3d..961be26 100644
--- a/ui/commands.go
+++ b/ui/commands.go
@@ -237,7 +237,7 @@ func cmdTag(cmd *Command) {
err = cmd.Matrix.Client().AddTag(cmd.Room.MxRoom().ID, cmd.Args[0], order)
}
if err != nil {
- cmd.Reply("Failed to add tag:", err)
+ cmd.Reply("Failed to add tag: %v", err)
}
}
@@ -248,7 +248,7 @@ func cmdUntag(cmd *Command) {
}
err := cmd.Matrix.Client().RemoveTag(cmd.Room.MxRoom().ID, cmd.Args[0])
if err != nil {
- cmd.Reply("Failed to remove tag:", err)
+ cmd.Reply("Failed to remove tag: %v", err)
}
}
@@ -258,7 +258,16 @@ func cmdRoomNick(cmd *Command) {
member.Displayname = strings.Join(cmd.Args, " ")
_, err := cmd.Matrix.Client().SendStateEvent(room.ID, event.StateMember, string(room.SessionUserID), member)
if err != nil {
- cmd.Reply("Failed to set room nick:", err)
+ cmd.Reply("Failed to set room nick: %v", err)
+ }
+}
+
+func cmdFingerprint(cmd *Command) {
+ c := cmd.Matrix.Crypto()
+ if c == nil {
+ cmd.Reply("Encryption support is not enabled")
+ } else {
+ cmd.Reply("Device ID: %s\nFingerprint: %s", cmd.Matrix.Client().DeviceID, c.Fingerprint())
}
}
@@ -440,7 +449,7 @@ func cmdCreateRoom(cmd *Command) {
}
room, err := cmd.Matrix.CreateRoom(req)
if err != nil {
- cmd.Reply("Failed to create room:", err)
+ cmd.Reply("Failed to create room: %v", err)
return
}
cmd.MainView.SwitchRoom("", room)
@@ -465,7 +474,7 @@ func cmdPrivateMessage(cmd *Command) {
}
room, err := cmd.Matrix.CreateRoom(req)
if err != nil {
- cmd.Reply("Failed to create room:", err)
+ cmd.Reply("Failed to create room: %v", err)
return
}
cmd.MainView.SwitchRoom("", room)