aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/server.go b/server.go
index e81f0b3..2ed598e 100644
--- a/server.go
+++ b/server.go
@@ -259,6 +259,7 @@ func handleSystemMessage(mxid string, msg string) {
ezbrSystemSend(mxid, "- join <protocol or account> <room id>: join public chat room")
ezbrSystemSend(mxid, "- talk <protocol or account> <user id>: open private conversation to contact")
ezbrSystemSend(mxid, "- search <protocol or account> <name>: search for users by name")
+ ezbrSystemSend(mxid, "- cmd <protocol or account> <command>: send special command to account")
case "list", "account", "accounts":
one := false
if accts, ok := registeredAccounts[mxid]; ok {
@@ -332,6 +333,18 @@ func handleSystemMessage(mxid string, msg string) {
} else {
ezbrSystemSendf(mxid, "No account with name or using protocol %s", cmd[1])
}
+ case "cmd":
+ if len(cmd) < 3 {
+ ezbrSystemSendf(mxid, "Usage: %s <protocol or account> <name>", cmd[0])
+ return
+ }
+
+ account := findAccount(mxid, cmd[1])
+ if account != nil {
+ account.Conn.UserCommand(strings.Join(cmd[2:], " "))
+ } else {
+ ezbrSystemSendf(mxid, "No account with name or using protocol %s", cmd[1])
+ }
default:
ezbrSystemSend(mxid, "Unrecognized command. Type `help` if you need some help!")
}