diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-07-09 21:36:27 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-07-09 21:42:05 -0700 |
| commit | d9bc63a10d0978d9a5222cf7be74044e55f409b7 (patch) | |
| tree | 1797c9593c279bf1334ed8285de8054a92a28dcb /hotline/user.go | |
| parent | 8fa166777cbcd92e871e937d9557f0f1a732c04d (diff) | |
Extensive refactor and clean up
Diffstat (limited to 'hotline/user.go')
| -rw-r--r-- | hotline/user.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/hotline/user.go b/hotline/user.go index 26625a2..f3754d3 100644 --- a/hotline/user.go +++ b/hotline/user.go @@ -15,7 +15,7 @@ const ( UserFlagRefusePChat = 3 // User refuses private chat ) -// FieldOptions flags are sent from v1.5+ clients as part of TranAgreed +// User options are sent from clients and represent options set in the client's preferences. const ( UserOptRefusePM = 0 // User has "Refuse private messages" pref set UserOptRefuseChat = 1 // User has "Refuse private chat" pref set @@ -24,15 +24,15 @@ const ( type UserFlags [2]byte -func (flag *UserFlags) IsSet(i int) bool { - flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(flag[:]))) +func (f *UserFlags) IsSet(i int) bool { + flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(f[:]))) return flagBitmap.Bit(i) == 1 } -func (flag *UserFlags) Set(i int, newVal uint) { - flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(flag[:]))) +func (f *UserFlags) Set(i int, newVal uint) { + flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(f[:]))) flagBitmap.SetBit(flagBitmap, i, newVal) - binary.BigEndian.PutUint16(flag[:], uint16(flagBitmap.Int64())) + binary.BigEndian.PutUint16(f[:], uint16(flagBitmap.Int64())) } type User struct { |