mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-20 06:10:00 -08:00
User support in MurmurDB import and freezer.
This commit is contained in:
parent
73478072d0
commit
47bb4d0025
6 changed files with 223 additions and 16 deletions
39
user.go
Normal file
39
user.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (c) 2011 The Grumble Authors
|
||||
// The use of this source code is goverened by a BSD-style
|
||||
// license that can be found in the LICENSE-file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// This file implements Server's handling of Users.
|
||||
//
|
||||
// Users are registered clients on the server.
|
||||
|
||||
type User struct {
|
||||
Id uint32
|
||||
Name string
|
||||
CertHash string
|
||||
Email string
|
||||
TextureBlob string
|
||||
CommentBlob string
|
||||
LastChannelId int
|
||||
LastActive uint64
|
||||
}
|
||||
|
||||
// Create a new User
|
||||
func NewUser(id uint32, name string) (user *User, err os.Error) {
|
||||
if id < 0 {
|
||||
return nil, os.NewError("Invalid user id")
|
||||
}
|
||||
if len(name) == 0 || name == "SuperUser" {
|
||||
return nil, os.NewError("Invalid username")
|
||||
}
|
||||
|
||||
return &User{
|
||||
Id: id,
|
||||
Name: name,
|
||||
}, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue