summaryrefslogtreecommitdiff
path: root/srv/chat
diff options
context:
space:
mode:
Diffstat (limited to 'srv/chat')
-rw-r--r--srv/chat/chat.go2
-rw-r--r--srv/chat/user.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/srv/chat/chat.go b/srv/chat/chat.go
index ae305ac..acb7b2d 100644
--- a/srv/chat/chat.go
+++ b/srv/chat/chat.go
@@ -84,7 +84,7 @@ type HistoryOpts struct {
}
func (o HistoryOpts) sanitize() (HistoryOpts, error) {
- if o.Limit < 0 || o.Limit > 100 {
+ if o.Limit <= 0 || o.Limit > 100 {
o.Limit = 100
}
diff --git a/srv/chat/user.go b/srv/chat/user.go
index 1279a45..3f5ab95 100644
--- a/srv/chat/user.go
+++ b/srv/chat/user.go
@@ -38,8 +38,8 @@ type UserIDCalculator struct {
}
// NewUserIDCalculator returns a UserIDCalculator with sane defaults.
-func NewUserIDCalculator(secret []byte) UserIDCalculator {
- return UserIDCalculator{
+func NewUserIDCalculator(secret []byte) *UserIDCalculator {
+ return &UserIDCalculator{
Secret: secret,
TimeCost: 15,
MemoryCost: 128 * 1024,
@@ -50,7 +50,7 @@ func NewUserIDCalculator(secret []byte) UserIDCalculator {
}
// Calculate accepts a name and password and returns the calculated UserID.
-func (c UserIDCalculator) Calculate(name, password string) UserID {
+func (c *UserIDCalculator) Calculate(name, password string) UserID {
input := fmt.Sprintf("%q:%q", name, password)