aboutsummaryrefslogtreecommitdiff
path: root/ui/commands.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-06-14 21:01:24 +0300
committerTulir Asokan <tulir@maunium.net>2019-06-14 21:01:24 +0300
commitae3bb9c7a39202ba462b3b8a0a564804a5517cf4 (patch)
treedfb4233137b9c4bebd74f052c890ea1f50fe0cfa /ui/commands.go
parent7c39729ada794aa2bfe91028ae3f3cfd3020de6f (diff)
Add pm command
Diffstat (limited to 'ui/commands.go')
-rw-r--r--ui/commands.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/ui/commands.go b/ui/commands.go
index b418e84..5bcba98 100644
--- a/ui/commands.go
+++ b/ui/commands.go
@@ -27,8 +27,9 @@ import (
"github.com/lucasb-eyer/go-colorful"
- "maunium.net/go/gomuks/debug"
"maunium.net/go/mautrix"
+
+ "maunium.net/go/gomuks/debug"
)
func cmdMe(cmd *Command) {
@@ -122,6 +123,7 @@ func cmdHelp(cmd *Command) {
/rainbow <message> - Send a rainbow message (markdown not supported).
/create [room name] - Create a room.
+/pm <user id> <...> - Create a private chat with the given user(s).
/join <room address> - Join a room.
/leave - Leave the current room.
@@ -201,7 +203,6 @@ func cmdKick(cmd *Command) {
debug.Print("Error in kick call:", err)
debug.Print("Failed to kick user:", err)
}
-
}
func cmdCreateRoom(cmd *Command) {
@@ -217,6 +218,22 @@ func cmdCreateRoom(cmd *Command) {
cmd.MainView.SwitchRoom("", room)
}
+func cmdPrivateMessage(cmd *Command) {
+ if len(cmd.Args) == 0 {
+ cmd.Reply("Usage: /pm <user id> [more user ids...]")
+ }
+ req := &mautrix.ReqCreateRoom{
+ Preset: "trusted_private_chat",
+ Invite: cmd.Args,
+ }
+ room, err := cmd.Matrix.CreateRoom(req)
+ if err != nil {
+ cmd.Reply("Failed to create room:", err)
+ return
+ }
+ cmd.MainView.SwitchRoom("", room)
+}
+
func cmdJoin(cmd *Command) {
if len(cmd.Args) == 0 {
cmd.Reply("Usage: /join <room>")