• Validating a moderated message

    From Nightfox@VERT/DIGDIST to All on Sun Jan 22 02:10:49 2017
    Hi all,

    I'm working on my message reader and have added a method (for sysops) to validate a message that requires moderation. It seems to me the way to do that would be to add the MSG_VALIDATED attribute to a message header and save it with msgbase.put_msg_header(), but it seems that if I re-load the message header, it doesn't have the MSG_VALIDATED attribute. msgbase.put_msg_header() returns true, which I'd think would mean it successfully saved the header. I'm wondering what I might be doing wrong?

    This is the code I have for the method:

    function DigDistMsgReader_ValidateMsg(pSubBoardCode, pMsgNum)
    {
    if (!msg_area.sub[pSubBoardCode].is_moderated)
    return true;
    if ((this.msgbase == null) || !this.msgbase.is_open)
    return false;

    var validationSuccessful = false;
    var msgHdr = this.msgbase.get_msg_header(false, pMsgNum, false);
    if (msgHdr != null)
    {
    if ((msgHdr.attr & MSG_VALIDATED) == 0)
    {
    msgHdr.attr &= MSG_VALIDATED;
    validationSuccessful = this.msgbase.put_msg_header(false, msgHdr.number,
    msgHdr);
    }
    else
    validationSuccessful = true;
    }

    return validationSuccessful;
    }


    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From echicken@VERT/ECBBS to Nightfox on Sun Jan 22 07:26:14 2017
    Re: Validating a moderated message
    By: Nightfox to All on Sat Jan 21 2017 18:10:49

    This is the code I have for the method:

    if ((msgHdr.attr & MSG_VALIDATED) == 0)
    {
    msgHdr.attr &= MSG_VALIDATED;

    Try: msgHdr.attr |= MSG_VALIDATED;

    The & operator returns 1 wherever the bits in both operands are set. The | operator returns a 1 wherever a bit in either operand is set.

    ('a&=b' is basically shorthand for 'a=a&b', as 'a|=b' is to 'a=a|b'.)

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From echicken@VERT/ECBBS to Nightfox on Sun Jan 22 07:30:58 2017
    Re: Validating a moderated message
    By: echicken to Nightfox on Sat Jan 21 2017 23:26:14

    ('a&=b' is basically shorthand for 'a=a&b', as 'a|=b' is to 'a=a|b'.)

    ^ May not have come through as intended:

    ('a&=b' is basically shorthand for 'a = a & b', as 'a|=b' is to 'a = a | b'.)

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@VERT/DIGDIST to echicken on Sun Jan 22 19:40:26 2017
    Try: msgHdr.attr |= MSG_VALIDATED;

    The & operator returns 1 wherever the bits in both operands are set. The | operator returns a 1 wherever a bit in either operand is set.

    Of course.. I knew that and just had one of those moments. :)

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com