Subj : MsgBase.put_msg_header() failing to save header
To   : Nightfox
From : Digital Man
Date : Wed Aug 10 2016 01:12 am

 Re: MsgBase.put_msg_header() failing to save header
 By: Nightfox to All on Tue Aug 09 2016 09:05 pm

> I have a message reader script for Synchronet that I've written in
> JavaScript.  I've written it so that when the user reads a message that was
> written to them, it will mark the message as read (by setting the MSG_READ
> attribute).  I'm using the put_msg_header() function to save a header with
> that attribute, and it seems there are some cases where put_msg_header()
> fails to save the header. I am checking to ensure the message was written to
> the user, so I don't think that would be the issue..  I did notice that one
> area where saving the header is failing is a FidoNet area - I'm not sure if
> that matters though.
>
> This is how I enable the read attribute (msgHeader is the message header
> object):
>
> msgHeader.attr |= MSG_READ;
>
> I've tried calling put_msg_header a few different ways, using the message
> number vs. message offset:
>
> msgbase.put_msg_header(true, msgHeader.offset, msgHeader);
> msgbase.put_msg_header(false, msgHeader.number, msgHeader);
> msgbase.put_msg_header(msgHeader.number, msgHeader);

All 3 of those syntaxes should work, assuming the parameters are correct.

> I tried the 3rd one since the first parameter is optional (according to the
> Synchronet JS docs); I've also seen examples that omit the first parameter
> and just use the message number.  Where it fails, I will exit my message
> reader and then read message again, and it thinks the message has not been
> read.  I've also seen put_msg_header() return false in that case.
>
> Why might put_msg_header() fail?

For a number of reasons. Try printing the msgbase.status and msgbase.error
values when whever put_msg_header() fails along with the parameter values
you're passing to put_msg_header(), and then share the results here. That'll
help to isolate the cause of the error.

                                           digital man

Synchronet/BBS Terminology Definition #1:
ANSI = American National Standards Institute
Norco, CA WX: 63.5�F, 89.0% humidity, 1 mph SE wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net