• User Object USER_DELETED

    From Mortifis@VERT/ALLEYCAT to All on Tue Jul 23 12:52:15 2019
    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@VERT/ECBBS to Mortifis on Tue Jul 23 13:22:51 2019
    Re: User Object USER_DELETED
    By: Mortifis to All on Tue Jul 23 2019 12:52:15

    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated

    user.settings &=~ USER_DELETED;

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Digital Man@VERT to Mortifis on Tue Jul 23 13:55:16 2019
    Re: User Object USER_DELETED
    By: Mortifis to All on Tue Jul 23 2019 12:52 pm

    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated

    USER_DELETED and USER_INACTIVE are bit flags. An integer can hold many bit flags (typically, 32). In the case of user.settings, each bit as a pre-defined purpose and those bits have been assigned symbolic names (in userdefs.js).

    To set (add) a bit-flag, you bit-wise "OR" it into the value, like so:

    user.settings |= USER_DELETED;

    To unset (remove) a bit-flag, you bit-wise "AND" it with the opposite (bit-wise not) value, like so:

    user.settings &= ~USER_DELETED;

    Hope that helps,

    digital man

    This Is Spinal Tap quote #6:
    David St. Hubbins: He was the patron saint of quality footwear.
    Norco, CA WX: 99.6øF, 30.0% humidity, 4 mph ESE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Mortifis@VERT/ALLEYCAT to echicken on Tue Jul 23 19:07:37 2019
    Re: User Object USER_DELETED
    By: Mortifis to All on Tue Jul 23 2019 12:52:15

    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated

    user.settings &=~ USER_DELETED;


    interesting ... that &=~ ... undeletes? no wonder USER_DELETED = 0 didn't work ... thought it was a BOOLEAN o.o

    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Digital Man@VERT to Mortifis on Tue Jul 23 16:07:51 2019
    Re: Re: User Object USER_DELETED
    By: Mortifis to echicken on Tue Jul 23 2019 07:07 pm

    Re: User Object USER_DELETED
    By: Mortifis to All on Tue Jul 23 2019 12:52:15

    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated

    user.settings &=~ USER_DELETED;


    interesting ... that &=~ ... undeletes?

    It unsets a bit (or a set of bits). In this example, it's unsetting the "USER_DELETED" bit.

    no wonder USER_DELETED = 0 didn't
    work ... thought it was a BOOLEAN o.o

    Nope. jsobjs.html is you friend. :-)

    digital man

    Synchronet "Real Fact" #85:
    The ZMODEM file transfer protocol is limited to files of 4 gigabytes or smaller.
    Norco, CA WX: 97.6øF, 35.0% humidity, 16 mph E wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Mortifis@VERT/ALLEYCAT to echicken on Tue Jul 23 22:40:15 2019
    Re: User Object USER_DELETED
    By: Mortifis to All on Tue Jul 23 2019 12:52:15

    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated

    user.settings &=~ USER_DELETED;

    as learning any language ( obviously I am not C adept) what does ~& or even just ~ mean negate a bitwise?


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@VERT/ECBBS to Mortifis on Tue Jul 23 22:04:55 2019
    Re: Re: User Object USER_DELETED
    By: Mortifis to echicken on Tue Jul 23 2019 22:40:15

    as learning any language ( obviously I am not C adept) what does ~& or even just ~ mean negate a bitwise?

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

    '~a' inverts the bits of 'a'

    'a & b' returns ones in positions where both 'a' and 'b' have ones

    'a & ~b' returns ones in positions where both 'a' and the inverse of 'b' have ones

    'a &= b' assigns the result of 'a & b' to 'a'

    'a &= ~b' assigns the result of 'a & ~b' to 'a'

    'a | b' returns ones where either 'a' or 'b' have ones

    'a |= b' assigns the result of 'a | b' to 'a'

    So:

    var a = 1; // 00000001
    var b = 2; // 00000010
    a |= b; // a = 00000001 | 00000010
    a &= ~b; // a = 00000011 & 11111101

    if that makes sense.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@VERT/ALLEYCAT to echicken on Wed Jul 24 01:15:21 2019
    Re: Re: User Object USER_DELETED
    By: Mortifis to echicken on Tue Jul 23 2019 22:40:15

    as learning any language ( obviously I am not C adept) what does ~& or even just ~ mean negate a bitwise?

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

    '~a' inverts the bits of 'a'

    'a & b' returns ones in positions where both 'a' and 'b' have ones

    'a & ~b' returns ones in positions where both 'a' and the inverse of 'b' have ones

    'a &= b' assigns the result of 'a & b' to 'a'

    'a &= ~b' assigns the result of 'a & ~b' to 'a'

    'a | b' returns ones where either 'a' or 'b' have ones

    'a |= b' assigns the result of 'a | b' to 'a'

    So:

    var a = 1; // 00000001
    var b = 2; // 00000010
    a |= b; // a = 00000001 | 00000010
    a &= ~b; // a = 00000011 & 11111101

    if that makes sense.

    huh! starting to ... kinda reminds me of 8 bit assembly, thank you, waking my brain up again after years of octal sleep :-o

    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Mortifis@VERT/ALLEYCAT to Digital Man on Thu Aug 8 09:36:57 2019
    Re: User Object USER_DELETED
    By: Mortifis to All on Tue Jul 23 2019 12:52 pm

    I am unsure how to restore a user with the user.settings.USER_DELETED or restore a USER_INACTIVE any help would be appreciated

    USER_DELETED and USER_INACTIVE are bit flags. An integer can hold many bit flags (typically, 32). In the case of user.settings, each bit as a pre-defined purpose and those bits have been assigned symbolic names (in userdefs.js).

    To set (add) a bit-flag, you bit-wise "OR" it into the value, like so:

    user.settings |= USER_DELETED;

    To unset (remove) a bit-flag, you bit-wise "AND" it with the opposite (bit-wise not) value, like so:

    user.settings &= ~USER_DELETED;

    Hope that helps,

    digital man

    Very helpful ... sorry for taking so long to reply, I was having QWK issues


    My doctor said I have the body of a 25 year old ... and the mind of a 10 :-/

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81