From dc6fa21eaa6c8753e1defe71fe0870602f4e2a78 Mon Sep 17 00:00:00 2001 From: mik2k2 <44849223+mik2k2@users.noreply.github.com> Date: Tue, 4 Jan 2022 15:11:14 +0100 Subject: [PATCH] minor message changes --- host.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/host.go b/host.go index 71a5913..23d4eb1 100644 --- a/host.go +++ b/host.go @@ -814,25 +814,26 @@ func (h *Host) InitCommands(c *chat.Commands) { return nil }) if kicked != nil { - room.Send(message.NewAnnounceMsg(fmt.Sprintf("%v were kicked during pubkey reverification.", kicked))) + room.Send(message.NewAnnounceMsg("Kicked during pubkey reverification: " + strings.Join(kicked, ", "))) } return nil } allowlistStatus := func() (msgs []string) { if h.auth.AllowlistMode() { - msgs = []string{"The allowlist is currently enabled."} + msgs = []string{"allowlist enabled"} } else { - msgs = []string{"The allowlist is currently disabled."} + msgs = []string{"allowlist disabled"} } allowlistedUsers := []string{} allowlistedKeys := []string{} + // TODO: if we switch the loops, we can get unlisted users instead of unconnected keys easily h.auth.allowlist.Each(func(key string, item set.Item) error { keyFP := item.Key() if forConnectedUsers(func(user *chat.Member, pk ssh.PublicKey) error { if pk != nil && sshd.Fingerprint(pk) == keyFP { allowlistedUsers = append(allowlistedUsers, user.Name()) - return errors.New("not an actual error, but exit early because we found the key") + return io.EOF } return nil }) == nil { @@ -842,7 +843,7 @@ func (h *Host) InitCommands(c *chat.Commands) { return nil }) if len(allowlistedUsers) != 0 { - msgs = append(msgs, fmt.Sprintf("The following connected users are on the allowlist: %v", allowlistedUsers)) + msgs = append(msgs, "Connected users on the allowlist: "+strings.Join(allowlistedUsers, ", ")) } if len(allowlistedKeys) != 0 { msgs = append(msgs, fmt.Sprintf("The following keys of not connected users are on the allowlist: %v", allowlistedKeys))