Subj : Re: Synchronet API Documentation?
To   : Mortifis
From : echicken
Date : Sat Jul 13 2019 11:52 pm

 Re: Re: Synchronet API Documentation?
 By: Mortifis to Digital Man on Sat Jul 13 2019 22:33:38

Mo> clear all restrictions, thank you. Is there an easy way to declare a flag
Mo> set variable (I called it NEW_UFLAG_SET as an example) similar to
Mo> NEW_UFLAG_SET = "UFLAG_C | UFLAG_D | UFLAG_E ... etc"; ?

If your goal is to do something like:

 user.security.restrictions = NEW_UFLAG_SET;

then your example is close to what you'd want:

 const NEW_UFLAG_SET = UFLAG_C|UFLAG_D|UFLAG_E; // And so on

Note that you don't want quotes around the right operand, which would make it a
string instead of a bunch of numbers that you're OR-ing together.

This is kind of a flyswatter approach, which is probably what you want anyway.
If you don't want to overwrite the user's entire flag set, it's also possible
to add a single flag:

 user.security.restrictions |= UFLAG_C;

or unset a single flag:

 user.security.restrictions &=~ UFLAG_C;

Various other things are possible.  For some information about these types of
operations:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bit
wise_Operators

---
echicken
electronic chicken bbs - bbs.electronicchicken.com
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com