mirror of
https://github.com/mumble-voip/grumble.git
synced 2026-01-25 21:09:10 -08:00
Hook blobstore into Grumble.
This commit is contained in:
parent
b3fec9315a
commit
ed602e9d8c
8 changed files with 159 additions and 72 deletions
31
user.go
31
user.go
|
|
@ -5,6 +5,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
|
@ -37,3 +38,33 @@ func NewUser(id uint32, name string) (user *User, err os.Error) {
|
|||
Name: name,
|
||||
},nil
|
||||
}
|
||||
|
||||
// Does the channel have comment?
|
||||
func (user *User) HasComment() bool {
|
||||
return len(user.CommentBlob) > 0
|
||||
}
|
||||
|
||||
// Get the hash of the user's comment blob as a byte slice for transmitting via a protobuf message.
|
||||
// Returns nil if there is no such blob.
|
||||
func (user *User) CommentBlobHashBytes() (buf []byte) {
|
||||
buf, err := hex.DecodeString(user.CommentBlob)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
||||
// Does the user have a texture?
|
||||
func (user *User) HasTexture() bool {
|
||||
return len(user.TextureBlob) > 0
|
||||
}
|
||||
|
||||
// Get the hash of the user's texture blob as a byte slice for transmitting via a protobuf message.
|
||||
// Returns nil if there is no such blob.
|
||||
func (user *User) TextureBlobHashBytes() (buf []byte) {
|
||||
buf, err := hex.DecodeString(user.TextureBlob)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return buf
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue