aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/server.go b/server.go
index 294ad7f..84b1893 100644
--- a/server.go
+++ b/server.go
@@ -228,6 +228,7 @@ func handleSystemMessage(mxid string, msg string) {
ezbrSystemSend(mxid, "- accounts: list accounts")
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")
case "list", "account", "accounts":
one := false
if accts, ok := registeredAccounts[mxid]; ok {
@@ -271,6 +272,21 @@ func handleSystemMessage(mxid string, msg string) {
} else {
ezbrSystemSendf(mxid, "No account with name or using protocol %s", cmd[1])
}
+ case "search":
+ account := findAccount(mxid, cmd[1])
+ if account != nil {
+ rep, err := account.Conn.SearchForUsers(cmd[2])
+ if err != nil {
+ ezbrSystemSendf(mxid, "Search error: %s", err)
+ } else {
+ ezbrSystemSendf(mxid, "%d users found", len(rep))
+ for i, user := range rep {
+ ezbrSystemSendf(mxid, "- %s (%s)", i+1, user.DisplayName, user.ID)
+ }
+ }
+ } 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!")
}