diff options
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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!") } |