+// FieldOptions flags are sent from v1.5+ clients as part of TranAgreed
+const (
+ UserOptRefusePM = 0 // User has "Refuse private messages" pref set
+ UserOptRefuseChat = 1 // User has "Refuse private chat" pref set
+ UserOptAutoResponse = 2 // User has "Automatic response" pref set
+)
+
+type UserFlags [2]byte
+
+func (flag *UserFlags) IsSet(i int) bool {
+ flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(flag[:])))
+ return flagBitmap.Bit(i) == 1
+}
+
+func (flag *UserFlags) Set(i int, newVal uint) {
+ flagBitmap := big.NewInt(int64(binary.BigEndian.Uint16(flag[:])))
+ flagBitmap.SetBit(flagBitmap, i, newVal)
+ binary.BigEndian.PutUint16(flag[:], uint16(flagBitmap.Int64()))
+}
+